Migrate a self-managed Oracle database to PolarDB-X 2.0

Updated at:

Data Transmission Service (DTS) supports full and incremental data migration. You can combine these migration types to migrate data from a self-managed Oracle database to a PolarDB-X 2.0 instance with minimal disruption to your application. This topic shows how to use DTS to migrate a self-managed Oracle database to PolarDB-X 2.0.

Prerequisites

  • Your self-managed Oracle database must be version 9i, 10g, 11g, 12c, 18c, or 19c.

  • Supplemental logging, including supplemental_log_data_pk and supplemental_log_data_ui, must be enabled on the self-managed Oracle database. For more information, see Supplemental Logging.

  • The self-managed Oracle database must run in ARCHIVELOG mode. Ensure archived logs are accessible and have a reasonable retention period. For more information, see ARCHIVELOG.

  • The self-managed Oracle database service port must be accessible over the internet.

  • You must have a destination PolarDB-X instance. For more information, see Create an instance.

    Note

    For a PolarDB-X 1.0 instance, the MySQL version must be MySQL 5.

  • Databases in PolarDB-X must use ApsaraDB RDS for MySQL. DTS does not support databases created based on PolarDB for MySQL.

  • The ApsaraDB RDS for MySQL instance for your PolarDB-X database must have more storage space than the source self-managed Oracle database uses.

  • DTS does not support schema migration when migrating from Oracle to PolarDB-X. You must create the required databases and tables in the destination PolarDB-X instance, matching the schema of the source Oracle tables. For more information, see Create a database and Perform basic SQL operations.

    Note

    Data types between Oracle and PolarDB-X do not have a one-to-one mapping. You must define the appropriate data types in the destination PolarDB-X instance. For more information, see Data type mapping between heterogeneous databases.

  • If the self-managed Oracle database uses an RAC architecture and is connected over a leased line, VPN Gateway, Smart Access Gateway, Database Gateway (DG), or Cloud Enterprise Network (CEN), or from an ECS instance, you cannot configure a Single Client Access Name (SCAN) IP address. You can only configure one of the VIPs in the connection information. If you use this method, node switching for RAC is not supported.

  • Before you perform a data migration, we recommend that you understand the capabilities and limitations of DTS for Oracle sources and use ADAM to perform a database evaluation. This ensures a smooth cloud migration. For more information, see Limitations and preparations for Oracle databases and Overview of database evaluation.

  • Operations not allowed on the source database:

    • Do not run DDL operations that change database or table schemas during schema migration or full migration. Otherwise, the migration task fails.

      Note

      During full migration, DTS queries the source database. This creates metadata locks that may block DDL operations on the source database.

    • If you run only full migration, do not write new data to the source instance. Otherwise, source and destination data become inconsistent. To keep data consistent in real time, select schema migration, full migration, and incremental migration.

Limitations

  • During a full data migration, DTS consumes read and write resources on the source and destination databases, increasing their load. If your databases have poor performance, low specifications, or high workloads (for example, if the source database has many slow SQL queries or tables without primary keys, or if deadlocks occur in the destination database), the increased load can strain your databases or even cause service interruptions. Perform the data migration during off-peak hours, such as when the CPU utilization of both databases is below 30%.

  • If a source table lacks a primary key or a unique constraint and contains non-unique data, duplicate data may be created in the destination database.

  • If the self-managed Oracle database is deployed in a Real Application Cluster (RAC) architecture and is connected to DTS over an Alibaba Cloud virtual private cloud (VPC), you must connect the Single Client Access Name (SCAN) IP address of the Oracle RAC and the virtual IP address (VIP) of each node to the VPC and configure routes. The settings ensure that your DTS task can run as expected. For more information, see Connect a data center to DTS through VPN Gateway.

    Important

    When you configure the source Oracle database in the DTS console, you can specify the SCAN IP address of the Oracle RAC as the database endpoint or IP address.

  • If a data migration task fails, DTS triggers an automatic recovery. Before you switch your business workloads to the destination instance, you must stop or release the task. This prevents an automatic recovery, which would otherwise cause data from the source database to overwrite data in the destination instance.

  • If the data to be migrated contains empty strings of the `varchar2` type, which Oracle treats as null, and the corresponding destination database field has a NOT NULL constraint, the migration task fails.

  • If the FGA (Fine-Grained Audit) policy is enabled on the table to be migrated, DTS cannot recognize the ORA_ROWSCN pseudocolumn, which will cause the migration job to fail.

    Note

    You can disable the FGA policy for the tables to be migrated, or choose not to migrate data from these tables.

  • Migration of foreign tables is not supported.

  • During incremental migration, importing data into the source database by using Oracle Data Pump is not supported. This may cause data loss.

  • DTS migrates foreign keys during schema migration.

  • During full and incremental data migration, DTS temporarily disables constraint checks and foreign key cascades at the session level. Cascade updates or deletes on the source database while the task runs may cause data inconsistency.

  • If a task fails, DTS support staff will attempt to restore it within eight hours. During restoration, they may restart the task or adjust its parameters.

    Note

    Only DTS task parameters are modified—not database parameters. Parameters that may be adjusted include those listed in Modify instance parameters.

  • If the destination PolarDB-X 2.0 table has auto partitioning enabled (auto_partition=true), each DDL statement executed on the source can contain only one alter_specification. Otherwise, DTS reports an error (TDDL-4998: Multi alter specifications when create GSI not support yet). To execute a DDL statement that contains multiple alter_specification items, split each alter_specification into a separate DDL statement and execute them one by one. For more information, see ALTER TABLE (DRDS mode) and ALTER TABLE (AUTO mode).

Billing

Migration type

Task configuration fee

Internet traffic fee

Schema migration and full data migration

Free of charge.

DTS charges an Internet traffic fee when the Access Method of the destination database is set to Public IP Address. Billing overview.

Incremental data migration

Charged. Billing overview.

Migration types

  • Full data migration

    DTS migrates all existing data from the selected objects in the source Oracle database to the destination PolarDB-X database.

    Note

    Do not write new data to the source Oracle database during full data migration. This ensures data consistency.

  • Incremental data migration

    After full data migration completes, DTS reads redo logs from the source Oracle database and synchronizes incremental changes to the destination PolarDB-X database. This minimizes application downtime during migration.

    Note

    Incremental data migration supports INSERT, DELETE, and UPDATE operations. DDL operations are not synchronized.

Supported SQL operations

Type

SQL statement

DML

INSERT, UPDATE, DELETE

DDL

  • CREATE TABLE, ALTER TABLE, DROP TABLE, RENAME TABLE, TRUNCATE TABLE

    Important

    A RENAME TABLE operation may cause data inconsistency. For example, if you select only one table as the migration object and rename the table in the source instance during migration, the data of this table is not migrated to the destination database. To prevent this issue, select the entire database to which the table belongs as the migration object when you configure the data migration task. Make sure that the databases to which the table belongs before and after the RENAME TABLE operation are both included in the migration objects.

  • CREATE VIEW, ALTER VIEW, DROP VIEW

  • CREATE PROCEDURE, ALTER PROCEDURE, DROP PROCEDURE

  • CREATE FUNCTION, DROP FUNCTION, CREATE TRIGGER, DROP TRIGGER

  • CREATE INDEX, DROP INDEX

Database account permissions

Database

Full data migration

Incremental data migration

Account setup

Self-managed Oracle database

Schema owner permissions

Requires fine-grained authorization

Database account preparation, CREATE USER, and GRANT

PolarDB-X

Write permission on the destination database

Write permission on the destination database

Account management

Important

To migrate incremental data, you must also enable archive logging and supplemental logging. For more information, see database configuration.

Procedure

  1. Navigate to the migration task list page for the destination region using one of the following methods.

    From the DTS console

    1. Log on to the Data Transmission Service (DTS) console.

    2. In the navigation pane on the left, click Data Migration.

    3. In the upper-left corner of the page, select the region where the migration instance is located.

    From the DMS console

    Note

    The actual operations may vary based on the mode and layout of the DMS console. For more information, see Simple mode console and Customize the layout and style of the DMS console.

    1. Log on to the Data Management (DMS) console.

    2. In the top menu bar, choose Data + AI > Data Transmission (DTS) > Data Migration.

    3. To the right of Data Migration Tasks, select the region where the migration instance is located.

  2. Click Create Task to navigate to the task configuration page.

  3. Configure the source and destination databases.

    Category

    Parameter

    Description

    N/A

    Task Name

    DTS automatically generates a task name. We recommend that you specify a descriptive name for easy identification. The name does not need to be unique.

    Source Database

    Database Type

    Select Oracle.

    Connection Type

    Select the connection type that matches your source database deployment. This topic uses Self-managed Database on ECS as an example.

    Note

    If the source instance is a self-managed database, you must also complete the required preparations.

    Instance Region

    Select the region where the source Oracle database is located.

    ECS Instance ID

    Select the ID of the ECS instance that hosts the self-managed Oracle database.

    Port

    Enter the service port of the self-managed Oracle database. The default port is 1521.

    Oracle Type

    This example uses the RAC or PDB Instance option.

    • Non-RAC Instance: This option requires you to specify the SID.

    • RAC or PDB Instance: This option requires you to specify the Service Name.

    Database Account

    Enter the database account of the source self-managed Oracle instance.

    Database Password

    Enter the password for the specified database account.

    Destination Database

    Database Type

    Select PolarDB-X 2.0.

    Connection Type

    Select Alibaba Cloud Instance.

    Instance Region

    Select the region where the destination PolarDB-X 2.0 instance is located.

    Instance ID

    Select the ID of the destination PolarDB-X 2.0 instance.

    Database Account

    Enter the database account of the destination PolarDB-X 2.0 instance.

    Database Password

    Enter the password for the specified database account.

  4. After you complete the configuration, click Test Connectivity and Proceed at the bottom of the page. In the CIDR Blocks of DTS Servers dialog box that appears, click Test Connectivity.

    Note

    Ensure that the IP address segments of the DTS service are automatically or manually added to the security settings of the source and destination databases to allow access from DTS servers. For more information, see Add DTS server IP addresses to a whitelist.

  5. Configure the task objects.

    1. On the Configure Objects page, configure the objects that you want to migrate.

      Parameter

      Description

      Synchronization Type

      • If you only need to perform a full migration, select both Schema Migration and Full Data Migration.

      • To perform a migration with no downtime, select Schema Migration, Full Data Migration, and Incremental Data Migration.

      Note
      • If you do not select Schema Migration, you must ensure that a database and tables to receive the data exist in the destination database. You can also use the object name mapping feature in the Selected Objects box as needed.

      • If you do not select Incremental Data Migration, do not write new data to the source instance during data migration to ensure data consistency.

      Processing Mode for Existing Destination Tables

      • Precheck and Report Errors: Checks whether tables with the same names exist in the destination database. If no tables with the same names exist, the precheck is passed. If tables with the same names exist, an error is reported during the precheck, and the data migration task does not start.

        Note

        If a table in the destination database has the same name but cannot be easily deleted or renamed, you can change the name of the table in the destination database. For more information, see Object name mapping.

      • Ignore Errors and Proceed: Skips the check for tables with the same names.

        Warning

        Selecting Ignore Errors and Proceed may cause data inconsistency and business risks. For example:

        • If the table schemas are consistent and a record in the destination database has the same primary key value as a record in the source database:

          • During full migration, DTS keeps the record in the destination database. The record from the source database is not migrated.

          • During incremental migration, DTS does not keep the record in the destination database. The record from the source database overwrites the record in the destination database.

        • If the table schemas are inconsistent, only some columns of data may be migrated, or the migration may fail. Proceed with caution.

      Source Objects

      In the Source Objects pane, select the objects to migrate, and then click 向右小箭头 to move them to the Selected Objects pane.

      Selected Objects

      Note
      • Using object name mapping may cause migrations to fail for objects that depend on the renamed object.

      • To filter data with WHERE clauses, right-click the target table in the Selected Objects pane and define the filter conditions in the dialog box. For more information, see Set filter conditions.

      • To select SQL operations for incremental migration at the database or table level, right-click the migration object in the Selected Objects pane and select the desired SQL operations in the dialog box.

    2. Click Next: Advanced Settings to configure advanced parameters.

      Parameter

      Description

      Dedicated Cluster for Task Scheduling

      By default, DTS schedules tasks on a shared cluster. You do not need to select one. If you want more stable tasks, you can purchase a dedicated cluster to run DTS migration tasks.

      Retry Time for Failed Connections

      After the migration task starts, if the connection to the source or destination database fails, DTS reports an error and immediately begins to retry the connection. The default retry duration is 720 minutes. You can customize the retry time to a value from 10 to 1440 minutes. We recommend that you set the duration to more than 30 minutes. If DTS reconnects to the source and destination databases within the specified duration, the migration task automatically resumes. Otherwise, the task fails.

      Note
      • For multiple DTS instances that share the same source or destination, the network retry time is determined by the setting of the last created task.

      • Because you are charged for the task during the connection retry period, we recommend that you customize the retry time based on your business needs, or release the DTS instance as soon as possible after the source and destination database instances are released.

      Retry Time for Other Issues

      After the migration task starts, if a non-connectivity issue, such as a DDL or DML execution exception, occurs in the source or destination database, DTS reports an error and immediately begins to retry the operation. The default retry duration is 10 minutes. You can customize the retry time to a value from 1 to 1440 minutes. We recommend that you set the duration to more than 10 minutes. If the related operations succeed within the specified retry duration, the migration task automatically resumes. Otherwise, the task fails.

      Important

      The value of Retry Time for Other Issues must be less than the value of Retry Time for Failed Connections.

      Enable Throttling for Full Data Migration

      During full migration, DTS consumes read and write resources on the source and destination databases, which may increase the database load. If required, you can enable throttling for the full migration task. You can set Queries per second (QPS) to the source database, RPS of Full Data Migration, and Data migration speed for full migration (MB/s) to reduce the load on the destination database.

      Note
      • This configuration item is available only if you select Full Data Migration for Migration Types.

      • You can also adjust the full migration speed after the migration instance is running.

      Enable Throttling for Incremental Data Migration

      If required, you can also choose to set speed limits for the incremental migration task. You can set RPS of Incremental Data Migration and Data migration speed for incremental migration (MB/s) to reduce the load on the destination database.

      Note
      • This configuration item is available only if you select Incremental Data Migration for Migration Types.

      • You can also adjust the incremental migration speed after the migration instance is running.

      Environment Tag

      You can optionally select an environment tag to identify the instance.

      Actual Write Code

      You can select the encoding type for data written to the destination based on your needs.

      Configure ETL

      Choose whether to enable the extract, transform, and load (ETL) feature. For more information, see What is ETL? Valid values:

      Monitoring and Alerting

      Select whether to set alerts and receive alert notifications based on your business needs.

      • No: Does not set an alert.

      • Yes: Configure alerts by setting an alert threshold and an alert contact. If a migration fails or the latency exceeds the threshold, the system sends an alert notification.

  6. Save the task and run a precheck.

    • To view the parameters for configuring this instance when you call the API operation, move the pointer over the Next: Save Task Settings and Precheck button and click Preview OpenAPI parameters in the bubble that appears.

    • If you do not need to view or have finished viewing the API parameters, click Next: Save Task Settings and Precheck at the bottom of the page.

    Note
    • Before the migration task starts, DTS performs a precheck. The task starts only after it passes the precheck.

    • If the precheck fails, click View Details next to the failed check item, fix the issue based on the prompt, and then run the precheck again.

    • If a warning is reported during the precheck:

      • For check items that cannot be ignored, click View Details next to the failed item, fix the issue based on the prompt, and then run the precheck again.

      • For check items that can be ignored, you can click Confirm Alert Details, Ignore, OK, and Precheck Again to skip the alert item and run the precheck again. If you choose to ignore a warning, it may cause issues such as data inconsistency and pose risks to your business.

  7. Purchase the instance.

    1. When the Success Rate is 100%, click Next: Purchase Instance.

    2. On the Purchase page, select the link specification for the data migration instance. For more information, see the following table.

      Category

      Parameter

      Description

      New Instance Class

      Resource Group Settings

      Select the resource group to which the instance belongs. The default value is default resource group. For more information, see What is Resource Management?

      Instance Class

      DTS provides migration specifications with different performance levels. The link specification affects the migration speed. You can select a specification based on your business scenario. For more information, see Data migration link specifications.

    3. After the configuration is complete, read and select Data Transmission Service (Pay-as-you-go) Service Terms.

    4. Click Buy and Start. In the OK dialog box that appears, click OK.

      You can view the progress of the migration task on the Data Migration Tasks list page.

      Note
      • If the migration task does not include incremental migration, it stops automatically after the full migration is complete. After the task stops, its Status changes to Completed.

      • If the migration task includes incremental migration, it does not stop automatically. The incremental migration task continues to run. While the incremental migration task is running, the Status of the task is Running.

Next steps

The database accounts used for data migration have read and write permissions. To ensure database security, delete these accounts from both the self-managed Oracle database and the PolarDB-X instance once the data migration is complete.