This topic describes how to migrate data from a user-created Oracle database to a Distributed Relational Database System (DRDS) instance by using Data Transmission Service (DTS). DTS supports full data migration and incremental data migration. When you migrate data from a user-created Oracle database, you can select the two migration types to ensure service continuity.

Prerequisites

  • The version of the user-created Oracle database is 9i, 10g, 11g, 12c, 18c, or 19c.
  • Supplemental logging, including SUPPLEMENTAL_LOG_DATA_PK and SUPPLEMENTAL_LOG_DATA_UI, is enabled for the user-created Oracle database. For more information, see Supplemental Logging.
  • The ARCHIVELOG mode is enabled for the user-created Oracle database. Archived log files are accessible and a suitable retention period is set for archived log files. For more information, see Managing Archived Redo Log Files.
  • The service port of the user-created Oracle database is accessible over the Internet.
  • The databases in DRDS instances are created based on ApsaraDB RDS for MySQL instances that you purchased. DTS does not support databases that are created based on private ApsaraDB RDS for MySQL instances or Apsara PolarDB for MySQL clusters.
  • A DRDS instance is created based on an RDS instance. The available storage space of the destination RDS instance is larger than the total size of the data in the user-created Oracle database.

Precautions

  • DTS does not support schema migration from a user-created Oracle database to a DRDS instance.
    Note During schema migration, DTS migrates the schemas of the required objects, such as tables, from the source database to the destination database.
  • 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 automatically resumes a failed data migration task. Before you switch your workloads to the destination instance, stop or release the data migration task. Otherwise, the data in the source database will overwrite the data in the destination instance 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

  • Full data migration
    DTS migrates historical data of the required objects from the user-created Oracle database to the database in the destination DRDS instance.
    Note To ensure data consistency, do not write data into the source Oracle database during full data migration.
  • Incremental data migration
    After full data migration is complete, DTS retrieves redo log files from the user-created Oracle database. Then, DTS synchronizes incremental data from the user-created Oracle database to the database in the destination DRDS instance. Incremental data migration allows you to ensure service continuity when you migrate data from the user-created Oracle database to the database in the destination DRDS instance.
    Note The following SQL operations can be synchronized during incremental data migration: INSERT, DELETE, and UPDATE operations. DDL operations cannot be synchronized during incremental data migration.

Preparations

  1. Create a database and tables in the destination DRDS instance based on the schema of the user-created Oracle database. For more information, see Create a DRDS database and Create a DRDS table.
    Note The data types of Oracle databases and DRDS instances do not have one-to-one correspondence. You must define the corresponding data types in DRDS instances. For more information, see Data type mappings between heterogeneous databases.
  2. Log on to the source Oracle database, create an account for data collection, and grant permissions to the account.
    Database Full data migration Incremental data migration
    User-created Oracle database The owner permission on schemas The database administrator (DBA) permission
    DRDS instance The write permission on the destination database The write permission on the destination database

    For more information about how to create and authorize an account for a user-created Oracle database, see CREATE USER and GRANT.

    Notice If you want to migrate incremental data from an Oracle database but the DBA permission cannot be granted to the database account, you can grant fine-grained permissions to the account. The following sample statements show you how to grant specific permissions to an Oracle database account.
    create session;
    connect;
    resource;
    execute on sys.dbms_logmnr;
    select on v_$logmnr_contents;
    select on v_$log;
    select on v_$logfile;
    select on v_$archived_log;
    select on v_$logmnr_logs;
    select on v_$parameter;
    select on v_$database;
    select on all_objects;
    select on all_tab_cols;
    select on dba_registry;
    select any table;
    select any transaction;
    select on v$active_instances;
    select on v$instance;
    select on sys.USER$;
    select on SYS.OBJ$;
    select on SYS.COL$;
    select on SYS.IND$;
    select on SYS.ICOL$;
    select on SYS.CDEF$;
    select on SYS.CCOL$;
    select on SYS.TABPART$;
    select on SYS.TABSUBPART$;
    select on SYS.TABCOMPART$;
    select on gv_$listener_network;
    #Grant permissions on the pluggable database (PDB) and container database (CDB).
    #Grant permissions on the PDB:
    create   session;
    connect;
    resource;
    select on  all_objects;
    select on  all_tab_cols;
    select on  dba_registry;
    select any table;
    select any transaction;
    select on v_$log;
    select on v_$logfile;
    select on v_$archived_log;
    select on v_$parameter;
    select on v_$database;
    select on v_$active_instances;
    select on v_$instance;
    select on V_$PDBS;
    select on sys.USER$;
    select on SYS.OBJ$;
    select on SYS.COL$;
    select on SYS.IND$;
    select on SYS.ICOL$;
    select on SYS.CDEF$;
    select on SYS.CCOL$;
    select on SYS.TABPART$;
    select on SYS.TABSUBPART$;
    select on SYS.TABCOMPART$;
    
    #Grant permissions on the CDB:
    create   session;
    LOGMINING;
    select on v_$logmnr_contents;
    
    

    #The following sample statements show you how to grant permissions to a database account named dtstest.
    create user dtstest IDENTIFIED BY rdsdt_dtsacct;
    grant create session to dtstest;
    grant connect to dtstest;
    grant resource to dtstest;
    grant execute on sys.dbms_logmnr to dtstest;
    grant select on v_$logmnr_contents to dtstest;
    grant select on v_$log to dtstest;
    grant select on v_$logfile to dtstest;
    grant select on v_$archived_log to dtstest;
    grant select on v_$logmnr_logs to dtstest;
    grant select on v_$parameter to dtstest;
    grant select on v_$database to dtstest;
    grant select on all_objects to dtstest;
    grant select on all_tab_cols to dtstest;
    grant select on dba_registry to dtstest;
    grant select any table to dtstest;
    grant select any transaction to dtstest;
    grant select on v$active_instances to dtstest;
    grant select on v$instance to dtstest;
    grant select on sys.USER$ to dtstest;
    grant select on SYS.OBJ$ to dtstest;
    grant select on SYS.COL$ to dtstest;
    grant select on SYS.IND$ to dtstest;
    grant select on SYS.ICOL$ to dtstest;
    grant select on SYS.CDEF$ to dtstest;
    grant select on SYS.CCOL$ to dtstest;
    grant select on SYS.TABPART$ to dtstest;
    grant select on SYS.TABSUBPART$ to dtstest;
    grant select on SYS.TABCOMPART$ to dtstest;
    grant select on gv_$listener_network to dtstest;
    #The following sample statements show you how to grant permissions on the pluggable database (PDB) and container database (CDB) to a database account named dtstest.
    #Grant permissions on the PDB:
    create user dtstest IDENTIFIED BY rdsdt_dtsacct;
    grant create  session to dtstest;
    grant connect  to dtstest;
    grant resource to dtstest;
    grant select on  all_objects to dtstest;
    grant select on  all_tab_cols to dtstest;
    grant select on  dba_registry to dtstest;
    grant select any table to dtstest;
    grant select any transaction to dtstest;
    -- v$log privileges
    grant select on v_$log to dtstest;
    -- v$logfile privileges
    grant select on v_$logfile to dtstest;
    -- v$archived_log privileges
    grant select on v_$archived_log to dtstest;
    -- v$parameter privileges
    grant select on v_$parameter to dtstest;
    -- v$database privileges
    grant select on v_$database to dtstest;
    -- v$active_instances privileges
    grant select on v_$active_instances to dtstest;
    -- v$instance privileges
    grant select on v_$instance to dtstest;
    -- V$PDBS privileges
    grant select on V_$PDBS to dtstest;
    grant select on sys.USER$ to dtstest;
    grant select on SYS.OBJ$ to dtstest;
    grant select on SYS.COL$ to dtstest;
    grant select on SYS.IND$ to dtstest;
    grant select on SYS.ICOL$ to dtstest;
    grant select on SYS.CDEF$ to dtstest;
    grant select on SYS.CCOL$ to dtstest;
    grant select on SYS.TABPART$ to dtstest;
    grant select on SYS.TABSUBPART$ to dtstest;
    grant select on SYS.TABCOMPART$ to dtstest;
    
    #Grant permissions on the CDB:
    create user dtstest IDENTIFIED BY rdsdt_dtsacct;
    grant create   session to dtstest;
    grant LOGMINING TO dtstest;
    -- v$logmnr_contents privileges
    grant select on v_$logmnr_contents to dtstest;

Procedure

  1. Log on to the DTS console.
  2. In the left-side navigation pane, click Data Migration.
  3. At the top of the Migration Tasks page, select the region where the destination RDS instance resides.Select a region
  4. In the upper-right corner of the page, click Create Migration Task.
  5. Configure the source and destination databases for the data migration task.
    Section Parameter Description
    N/A Task Name DTS automatically generates a task name. We recommend that you specify an informative name for easy identification. You do not need to use a unique task name.
    Source Database Instance Type Select an instance type based on where the source database is deployed. The procedure in this topic uses User-Created Database with Public IP Address as an example.
    Note If you select other instance types, you must prepare the environments that are required for the source database. For more information, see Preparation overview.
    Instance Region If the instance type is set to User-Created Database with Public IP Address, you do not need to specify the instance region.
    Note If a whitelist is configured for the user-created Oracle database, you must add the CIDR blocks of DTS servers to the whitelist of the user-created Oracle database. You can click Get IP Address Segment of DTS next to Instance Region to obtain the CIDR blocks of DTS servers.
    Database Type Select Oracle.
    Hostname or IP Address Enter the IP address that is used to connect to the user-created Oracle database. In this example, enter the public IP address.
    Port Number Enter the service port number of the user-created 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.
    Database Account Enter the account of the user-created Oracle database. For more information about the permissions that are required for the account, see Preparations.
    Database Password Enter the password for the source database account.
    Note After you specify the source database parameters, click Test Connectivity next to Database Password to verify whether the specified parameters are valid. If the specified parameters are valid, the Passed message appears. If the Failed message appears, click Check next to Failed. Modify the source database parameters based on the check results.
    Destination Database Instance Type Select DRDS Instance.
    Instance Region Select the region where the destination DRDS instance resides.
    DRDS Instance ID Select the ID of the destination DRDS instance.
    Database Account Enter the database account of the destination DRDS instance. For more information about the permissions that are required for the account, see Preparations.
    Database Password Enter the password for the destination database account.
    Note After you specify the destination database parameters, click Test Connectivity next to Database Password to verify whether the parameters are valid. If the specified parameters are valid, the Passed message appears. If the Failed message appears, click Check next to Failed. Modify the destination database parameters based on the check results.
  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 destination DRDS instance. This ensures that DTS servers can connect to the destination DRDS instance.
  7. Select the migration types and objects to be migrated. Select the migration types and objects to be migrated
    Parameter Description
    Migration Types
    • To perform only full data migration, select Full Data Migration.
    • To migrate data with minimal downtime, select 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

    Select objects from the Available section and click the Right arrow icon to move the objects to the Selected section.

    Note
    • You can select columns, tables, or databases as the objects to be migrated.
    • After an object is migrated to the destination database, the name of the object remains the same as that in the source database. You can change the names of the objects that are migrated to the destination database by using the object name mapping feature. For more information about how to use this feature, see Object name mapping.
    • If you use the object name mapping feature on an object, other objects that are dependent on the object may fail to be migrated.
  8. In the lower-right corner of the page, click Precheck.
    Note
    • Before you can start the data migration task, a precheck is performed. You can start the data migration task only after the task passes the precheck.
    • If the task fails to pass the precheck, click the Info icon icon next to each failed item to view details. Troubleshoot the issues based on the causes and run the precheck again.
  9. After the task passes the precheck, click Next.
  10. In the Confirm Settings dialog box, specify the Channel Specification and select the Data Transmission Service (Pay-As-You-Go) Service Terms.
  11. Click Buy and Start to start the migration task.
    • Full data migration

      Do not manually stop a task during full data migration. Otherwise, data migrated to the destination database will be incomplete. Wait until the migration task automatically stops.

    • Incremental data migration

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

      Note Select an appropriate time to manually stop the migration task. For example, you can stop the migration task during off-peak hours or before you switch your workloads to the destination instance.
      1. Wait until Incremental Data Migration and The migration task is not delayed appear in the progress bar of the migration task. Then, stop writing data to the source database for a few minutes. The delay time of incremental data migration may be displayed in the progress bar.
      2. After the status of incremental data migration changes to The migration task is not delayed, manually stop the migration task.The migration task is not delayed
  12. Switch your workloads to the destination DRDS instance.

What to do next

The database accounts used for data migration have the read/write permissions. After the data migration is complete, you must delete the accounts of both the user-created Oracle database and the DRDS database to ensure database security.