This topic describes how to migrate data from a PolarDB for PostgreSQL cluster to a self-managed Oracle database by using Data Transmission Service (DTS). This is applicable to scenarios such as data reflow tests and functional tests.

Prerequisites

  • The tables to be migrated from the source PolarDB for PostgreSQL cluster contain primary keys or UNIQUE NOT NULL indexes.
  • The version of the self-managed Oracle database is 9i, 10g, 11g, 12c, 18c, or 19c.
  • The schemas of objects such as tables are created in the self-managed Oracle database.
  • The available storage space of the self-managed Oracle database is larger than the total size of the data in the PolarDB for PostgreSQL cluster.

Precautions

  • In this scenario, DTS supports only full data migration and incremental data migration. DTS does not support schema migration.
  • During full data migration, DTS uses read and write resources of the source and destination databases. This may increase the loads of the database servers. Before you migrate data, evaluate the impact of data migration on the performance of the source and destination databases. We recommend that you migrate data during off-peak hours.
  • A single data migration task can migrate data from only one database. To migrate data from multiple databases, you must create a data migration task for each database.
  • During incremental data migration, if you select a schema as the object to be migrated, take note of the following limits: If you create a table in the schema or run the RENAME command to rename the table, you must run the ALTER TABLE schema.table REPLICA IDENTITY FULL; command before you write data to the table.
    Note Replace the schema and table in the preceding sample command with the actual schema name and table name.
  • To ensure that the delay time of incremental data migration is accurate, DTS adds a heartbeat table named dts_postgres_heartbeat to the source database. The following figure shows the schema of the heartbeat table. polarPG to O-1

Billing

Migration type Task configuration fee Internet traffic fee
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 Billed. For more information, see Pricing.

SQL operations that can be synchronized during incremental data migration

INSERT, UPDATE, and DELETE

Permissions required for database accounts

Database Required permissions
PolarDB for PostgreSQL A privileged account
Self-managed Oracle database The permissions of the schema owner

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 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.
    polarPG to O-2
    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 PolarDB.
    Instance Region Select the region where the source PolarDB cluster resides.
    PolarDB Instance ID Select the ID of the source PolarDB for PostgreSQL cluster.
    Database Account Enter the database account of the source PolarDB cluster. For information about the permissions that are required for the account, see Permissions required for database accounts.
    Database Password Enter the password of the 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 an instance type based on the deployment of the source database. In this example, select User-Created Database with Public IP Address.
    Note If you select other instance types, you must deploy the network environment for the source database. For more information, see Preparation overview.
    Instance Region You do not need to specify this parameter.
    Database Type Select Oracle.
    Hostname or IP Address Enter the endpoint that is used to access the self-managed Oracle database. In this example, enter the public IP address.
    Port Number Enter the service port number of the self-managed Oracle database. In this example, enter 1521.
    Instance Type
    • If you select Non-RAC Instance, you must specify the SID parameter.
    • If you select RAC or PDB Instance, you must specify the Service Name parameter.
    In this example, select Non-RAC Instance.
    SID Enter the system ID (SID) of the destination database.
    Database Account Enter the account of the self-managed Oracle database. For information about the permissions that are required for the account, see Permissions required for database accounts.
    Database Password Enter the password of the database account.
    Note After you specify the destination 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 destination database parameters based on the check results.
  6. In the lower-right corner of the page, click Set Whitelist and Next.
    Note DTS adds the CIDR blocks of DTS servers to the whitelist of the source PolarDB for PostgreSQL cluster. This ensures that DTS servers can connect to the source cluster.
  7. Select the migration types, the migration policy, and the objects to be migrated.
    polarPG to O-3
    Setting Description
    Specify whether to rename objects You can use the object name mapping feature to rename the objects that are migrated to the destination instance. For more information, see Object name mapping.
    Specify the retry time for failed connections to the source or destination database By default, if DTS fails to connect to the source or destination database, DTS retries within the next 720 minutes (12 hours). You can specify the retry time based on your needs. If DTS reconnects to the source and destination databases within the specified time, DTS resumes the data migration task. Otherwise, the data migration task fails.
    Note When DTS retries a connection, you are charged for the DTS instance. We recommend that you specify the retry time based on your business needs. You can also release the DTS instance at your earliest opportunity after the source and destination instances are released.
  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, you can click the Info icon icon next to each failed item to view details.
      • You can troubleshoot the issues based on the causes and run a precheck again.
      • If you do not need to troubleshoot the issues, you can ignore failed items and run a precheck again.
  9. After the task passes the precheck, click Next.
  10. In the Confirm Settings dialog box, specify the Channel Specification parameter and select Data Transmission Service (Pay-As-You-Go) Service Terms.
  11. Click Buy and Start to start the data migration task.
    • Full data migration

      We recommend that you do not manually stop the task during full data migration. Otherwise, the data migrated to the destination database will be incomplete. You can wait until the data migration task automatically stops.

    • Full data migration and incremental data migration

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

      Notice We recommend that you select an appropriate time to manually stop the data migration task. For example, you can stop the task during off-peak hours or before you switch your workloads to the destination cluster.
      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. Wait until the status of incremental data migration changes to The migration task is not delayed again. Then, manually stop the migration task.