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 suitable for scenarios such as data reflow tests and functional tests.
- The tables to migrate from the source PolarDB for PostgreSQL cluster contain primary keys or UNIQUE NOT NULL indexes.
- The version number 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.
- 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
Configure a route between DTS and Express Connect, VPN Gateway, or Smart Access Gateway.
Notice 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.
- A data migration task can migrate data from only a single 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 migrate,
take note of the following limits: If you create a table in the schema or execute
the RENAME statement to rename the table, you must execute the
ALTER TABLE schema.table REPLICA IDENTITY FULL;statement before you write data to the table.Note Replace the
tablein the preceding sample statement with the actual schema name and table name.
- To ensure that the latency of incremental data migration is accurate, DTS adds a heartbeat
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||Charged. 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 cluster||Permissions of a privileged account|
|Self-managed Oracle database||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 The task name that DTS automatically generates. We recommend that you specify a descriptive name that makes it easy to identify the task. You do not need to specify a unique task name. Source Database Instance Type Select PolarDB. Instance Region The region where the source PolarDB cluster resides. PolarDB Instance ID The ID of the source PolarDB for PostgreSQL cluster. Database Account The database account of the source cluster. For information about the permissions that are required for the account, see Permissions required for database accounts. Database Password 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 is displayed. If the Failed message is displayed, click Check next to Failed. Modify the source database parameters based on the check results. Destination Database Instance Type The access method of the destination self-managed database. In this example, Public IP Address is selected.Note If the self-managed database is connected over other methods, you must set up the environment that is required for the 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 The IP address that is used to access the self-managed Oracle database. In this example, enter the public IP address. Port Number The service port number of the self-managed Oracle database. In this example, 1521 is used. Instance Type
- If you select Non-RAC Instance, you must configure the SID parameter.
- If you select RAC or PDB Instance, you must specify the Service Name parameter.
SID The system ID (SID) of the destination database. Database Account 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 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 is displayed. If the Failed message is displayed, 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.
- Select the migration types, the migration policy, and the objects to migrate.
Parameter Description Rename Databases and Tables 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. Retry Time for Failed Connection 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 range based on your needs. If DTS reconnects to the source and destination databases within the specified time period, 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 range 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 may be incomplete. You can wait until the full data migration task automatically stops.
- Full data migration and incremental data migration
An incremental data migration task does not automatically stop. 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 are displayed in the progress bar of the migration task. Then, stop writing data to the source database for a few minutes. The latency of incremental data migration may be displayed in the progress bar.
- Wait until the state of incremental data migration changes to The data migration task is not delayed again. Then, manually stop the migration task.
- Full data migration