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.
- 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.
- 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
tablein 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_heartbeatto the source database. The following figure shows the schema of the heartbeat table.
|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
|PolarDB for PostgreSQL||A privileged account|
|Self-managed Oracle database||The permissions of the schema owner|
- Log on to the DTS console.
- In the left-side navigation pane, click Data Migration.
- At the top of the Migration Tasks page, select the region where the destination cluster resides.
- In the upper-right corner of the page, click Create Migration Task.
- Configure the source and destination databases.
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.
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.
- 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.
- Select the migration types, the migration policy, and the objects to be migrated.
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.
- 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 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.
- After the task passes the precheck, click Next.
- In the Confirm Settings dialog box, specify the Channel Specification parameter and select Data Transmission Service (Pay-As-You-Go) Service Terms.
- 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.
- 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.
- Wait until the status of incremental data migration changes to The migration task is not delayed again. Then, manually stop the migration task.
- Full data migration