This topic describes how to migrate data from an Amazon RDS for Oracle database to an ApsaraDB RDS for MySQL database by using Data Transmission Service (DTS). DTS supports schema migration, full data migration, and incremental data migration. You can select all of the three migration types to migrate data without service interruptions.

Prerequisites

  • Public Availability is set to Yes for the Amazon RDS for Oracle database. This ensures that DTS can access the Amazon RDS for Oracle database through the public network.
  • The version of the Amazon RDS for Oracle database is 9i, 10g, or 11g.
  • The version of the ApsaraDB RDS for MySQL database is 5.6 or 5.7.
  • The available storage space of the ApsaraDB RDS for MySQL database is larger than the total size of the data in the Amazon RDS for Oracle database.
    Note The binary log files generated during the migration occupy some space. They are automatically cleared when the migration is complete.

Precautions

  • DTS uses read and write resources of the source and destination databases during full data migration. This may increase the database load. If the database performance is unfavorable, the specification is low, or the data volume is large, database services may become unavailable. For example, DTS occupies a large amount of read and write resources in the following cases: a large number of slow SQL queries are performed on the source database, the tables have no primary keys, or a deadlock occurs in the destination database. Before you migrate data, evaluate the performance of the source and destination databases. We recommend that you migrate data during off-peak hours. For example, you can migrate data when the CPU usage of the source and destination databases is less than 30%.
  • The source database must have PRIMARY KEY or UNIQUE constraints and all fields must be unique. Otherwise, duplicate data may exist in the destination database.
  • DTS uses the ROUND(COLUMN,PRECISION) function to retrieve values from columns of the float or double data type. If the precision is not specified, DTS sets the precision for the float data type to 38 digits and the precision for the double data type to 308 digits. You must check whether the precision settings meet your business requirements.
  • DTS automatically creates a destination database in the ApsaraDB RDS for MySQL instance. However, if the name of the source database is invalid, you must manually create a database in the ApsaraDB RDS for MySQL instance before you configure the data migration task.
    Note For more information about how to create a database and the database naming conventions, see Create databases and accounts.
  • DTS automatically resumes a failed data migration task. Before you switch your workloads to the destination database, stop or release the data migration task. Otherwise, the data in the source database will overwrite the data in the destination database after the task is resumed.

Billing

Migration type Instance configurations Internet traffic
Schema migration and full data migration Free of charge. Charged only when data is migrated from Alibaba Cloud over the Internet. For more information, see Pricing.
Incremental data migration Charged. For more information, see Pricing.

Migration types

  • Schema migration

    DTS supports schema migration of tables, indexes, constraints, and sequences. However, DTS does not support schema migration of views, synonyms, triggers, stored procedures, stored functions, packages, and custom object types.

  • Full data migration

    DTS migrates full data of objects to be migrated from the Amazon RDS for Oracle database to the database in the ApsaraDB RDS for MySQL instance.

  • Incremental data migration

    During full data migration, DTS polls and captures the redo log files from the Amazon RDS for Oracle database. After the full data migration is complete, DTS synchronizes incremental data from the Amazon RDS for Oracle database to the destination ApsaraDB RDS for MySQL database. Incremental data migration helps you achieve service continuity when migrating data from an Amazon RDS for Oracle database to the destination database.

SQL operations that can be synchronized during incremental data migration

  • INSERT, DELETE, and UPDATE
  • CREATE TABLE
    Note The operations on tables or partitions that contain computed columns cannot be synchronized.
  • ALTER TABLE operations, including ADD COLUMN, DROP COLUMN, RENAME COLUMN, and ADD INDEX
  • DROP TABLE
  • RENAME TABLE, TRUNCATE TABLE, and CREATE INDEX

Permissions required for database accounts

Database Schema migration Full data migration Incremental data migration
Amazon RDS for Oracle database Owner permissions on schemas to be migrated Owner permissions on schemas to be migrated Master user permissions
ApsaraDB RDS for MySQL. Read and write permissions on the destination database Read and write permissions on the destination database Read and write permissions on the destination database

For more information about how to create a database account and grant permissions to the account, see the following topics:

Data type mappings

For more information, see Data type mappings between heterogeneous databases.

Preparation

  1. Log on to the Amazon RDS Management Console.
  2. Go to the Basic Information page of the source Amazon RDS for Oracle instance.
  3. In the Security group rules section, click the name of the security group corresponding to the existing inbound rule.
    Security group rules
  4. On the Security Groups page, click the Inbound tab in the Security Group section. On the Inbound tab, click Edit, and add CIDR blocks of DTS servers to the Edit inbound rules dialog box that appears. The CIDR blocks of DTS servers vary with the region where the destination database resides. For more information about the CIDR blocks of DTS servers, see Add the CIDR blocks of DTS servers to the security settings of on-premises databases.
    Edit inbound rules
    Note
    • You only need to add the CIDR blocks of DTS servers that are located in the same region as the destination database. For example, the source database is located in Singapore and the destination database is located in Hangzhou. You only need to add the CIDR blocks of DTS servers that are located in the China (Hangzhou) region.
    • You can add all the required CIDR blocks to the inbound rule at one time.
  5. Change log configurations for the Amazon RDS for Oracle database. Skip this step if you do not need to perform incremental data migration.
    1. Use the master user account and the SQL*Plus tool provided by Oracle to connect to the Amazon RDS for Oracle database.
    2. Run the archive log list; command to check whether archiving is enabled for the Amazon RDS for Oracle database.
      Note If archiving is disabled for the instance, enable the archiving mode. For more information, see Managing Archived Redo Logs.
    3. Enable force logging.
      exec rdsadmin.rdsadmin_util.force_logging(p_enable => true);
    4. Enable supplemental logging for primary keys.
      begin rdsadmin.rdsadmin_util.alter_supplemental_logging(p_action => 'ADD',p_type => 'PRIMARY KEY');end;/
    5. Enable supplemental logging for unique keys.
      begin rdsadmin.rdsadmin_util.alter_supplemental_logging(p_action => 'ADD',p_type => 'UNIQUE');end;/
    6. Set a retention period for archived logs.
      begin rdsadmin.rdsadmin_util.set_configuration(name => 'archivelog retention hours', value => '24');end;/
      Note We recommend that you set the retention period of archived logs to at least 24 hours.
    7. Commit the changes.
      commit;

Procedure

  1. Log on to the DTS console.
  2. In the left-side navigation pane, click Data Migration.
  3. At the top of Migration Tasks the page, select the region where the destination cluster resides.
    Select a region
  4. In the upper-right corner of the page, click Create Migration Task.
  5. Configure the source and destination databases.
    Configure Source and Destination Databases
    Section Parameter Description
    N/A Task Name DTS generates a random task name. However, we recommend that you specify an informative name to ease management.
    Source Database Instance Type Select User-Created Database with Public IP Address.
    Instance Region When the instance type is set to User-Created Database with Public IP Address, you do not need to set Instance Region.
    Database Type Select Oracle.
    Hostname or IP Address Enter the endpoint for accessing the Amazon RDS for Oracle database.
    Note You can obtain the endpoint on the Basic information page of the source Amazon RDS for Oracle database.
    Endpoint
    Port Number Enter the port number configured for the Amazon RDS for Oracle database. The default port number is 1521.
    Instance Type
    • Non-RAC Instance: If you select this option, you must specify the SID.
    • RAC Instance: If you select this option, you must specify the Service Name.

    In this example, select Non-RAC Instance and enter SID.

    Database Account Enter the account for the Amazon RDS for Oracle database. For more information about permissions required for the account, see Permissions required for database accounts.
    Database Password Enter the password of the database account.
    Note After the source database information is specified, click Test Connectivity next to Database Password to verify whether the specified information is valid. If the specified information is valid, the Passed message appears. If the Failed message appears, click Check in the Failed message. Modify the source database information as prompted.
    Destination Database Instance Type Select RDS Instance.
    Instance Region Select the region where the destination ApsaraDB RDS for MySQL instance resides.
    RDS Instance ID Select the RDS instance ID.
    Database Account Enter the database account of the ApsaraDB RDS for MySQL instance. For more information about permissions required for the account, see Permissions required for database accounts.
    Database Password Enter the password of the database account.
    Note After the destination database information is specified, click Test Connectivity next to Database Password to verify whether the specified information is valid. If the specified information is valid, the Passed message appears. If the Failed message appears, click Check in the Failed message. Modify the destination database information as prompted.
  6. In the lower-right corner of the page, click Set Whitelist and Next.
    Note The CIDR blocks of DTS servers are automatically added to the whitelist of the ApsaraDB for RDS instance. This ensures that DTS servers can connect to the ApsaraDB for RDS instance.
  7. Configure migration types and objects.
    Configure Migration Types and Objects
    Section Description
    Migration Types
    • To perform only full data migration, select Schema Migration and Full Data Migration.
    • To achieve service continuity during migration, select Schema Migration, Full Data Migration, and Incremental Data Migration.
    Note If Incremental Data Migration is not selected, do not write data into the source database during full data migration. This ensures data consistency between the source and destination databases.
    Objects to be migrated

    Select the objects to be migrated in the Available section and click > to move them to the Selected section.

    Note
    • Objects to be migrated can be databases, tables, or columns.
    • By default, the selected objects are not renamed after the migration. If you want to rename the objects that are migrated to the destination instance, you can use the object name mapping feature provided by DTS. For more information about how to use this feature, see Object name mapping.
    • If you use the object name mapping feature for an object, objects that depend on the object may fail to be migrated.
  8. Click Precheck on the lower right of the page.
    Note
    • A precheck is performed for a data migration task. A data migration task can be started only if it passes the precheck.
    • If the precheck fails, click Note icon corresponding to each failed item to view the details. Fix the problems as instructed and run the precheck again.
  9. After the precheck is passed, click Next.
  10. On the Confirm Settings dialog box that appears, specify Channel Specification and select the Data Transmission Service (Pay-As-You-Go) Service Terms.
  11. Click Buy and Start to start the data migration task.
    • Schema migration and full data migration

      Do not manually stop a migration task. Otherwise, data migrated to the destination database will be incomplete. Wait until the data migration task stops when it is complete.

    • Schema migration, full data migration, and incremental data migration

      An incremental data migration task does not automatically end. You must manually end the migration task.

      Note Select an appropriate time point to manually end the migration task. For example, you can end the migration task during off-peak hours or before you switch your workloads to the destination cluster.
      1. When the task progress bar switches to Incremental Data Migration and the message The migration task is not delayed appears, stop writing new data to the source database for a few minutes. Then, the progress bar will show the latency of the incremental data migration.
      2. When the status of incremental data migration changes to The migration task is not delayed, manually stop the migration task.Stop the incremental migration task
  12. Switch your workloads to the ApsaraDB RDS for MySQL database.