Use Data Transmission Service (DTS) to migrate data from a PolarDB for PostgreSQL cluster to a self-managed Oracle database. DTS supports full data migration and incremental data migration, so you can migrate with zero downtime or perform a one-time full copy.
Prerequisites
Before you begin, make sure that:
The self-managed Oracle database is created with enough disk space — the Oracle disk space must exceed the used storage space of the source PolarDB for PostgreSQL cluster
The destination schema and tables are created in the Oracle database before you start migration (DTS does not perform schema migration for this source-to-destination pair)
The source database account has privileged account permissions. For instructions, see Create a database account
The target Oracle database account has schema owner permissions for the destination schema. Grant permissions using Oracle's CREATE USER and GRANT statements
(Incremental migration only) The
wal_levelparameter of the source PolarDB for PostgreSQL cluster is set tological. For instructions, see Set cluster parameters(Incremental migration only) The PolarDB for PostgreSQL cluster supports and has enabled Logical Replication Slot Failover to prevent logical replication from being interrupted by a primary/secondary switchover
(Oracle RAC only) If the self-managed Oracle database is a Real Application Clusters (RAC) database and connects to Alibaba Cloud through a VPC, connect the SCAN IP and the virtual IP address (VIP) of each node to the Alibaba Cloud VPC and configure routes. For instructions, see Overview of solutions for connecting an on-premises data center to Alibaba Cloud and Connect an on-premises data center to DTS through a VPN Gateway
Limitations
Blocking limitations
Address these before starting the migration. Ignoring them may cause the task to fail or become unrecoverable.
No schema migration. Create all destination schemas and tables in Oracle before configuring the migration task.
Logical Replication Slot Failover required for incremental migration. If the source PolarDB for PostgreSQL cluster does not support Logical Replication Slot Failover (for example, if the cluster's Database Engine is PostgreSQL 14), a high availability (HA) switchover during migration may cause the migration instance to fail and become unrecoverable.
256 MB per-row limit for incremental migration. If a single row exceeds 256 MB after an incremental change, the migration instance fails and cannot be recovered. To resume, reconfigure the migration instance.
Primary key or non-null unique index required. Tables to be migrated must have a primary key or a non-null unique index.
No DDL operations during full migration. DDL operations that change database or table structure cause the migration task to fail.
Foreign keys and triggers in the destination database. Disable foreign keys and triggers in the destination Oracle database before migration. If they remain active, the migration task may fail.
REPLICA IDENTITY setting for incremental migration. Before writing data to migrated tables, run the following command in the source database. Run this during off-peak hours and avoid concurrent table lock operations to prevent deadlocks.
ALTER TABLE schema.table REPLICA IDENTITY FULL;Run this command in the following scenarios: when the instance runs for the first time; when the migration object is a schema and a new table is created in the schema; or when the migration object is a schema and an existing table is rebuilt using the RENAME command. If you skip the related precheck item, DTS automatically runs this command during instance initialization.
Partitioned tables. Include both the parent table and all child tables as migration objects. In PostgreSQL, parent tables of partitioned tables do not store data directly — all data is in child tables. Omitting child tables causes data inconsistency.
General limitations
A migration task migrates only one database. Configure a separate task for each database you want to migrate.
DTS does not support migrating TimescaleDB extension tables, tables with cross-schema inheritance, or tables with unique indexes based on expressions.
Schemas created by installing plugins cannot be migrated and do not appear in the console when you configure the task.
Cascade update and delete operations in the source database may cause data inconsistency in the destination.
Because full data migration runs concurrent INSERT operations, the destination table space may be larger than the source after full migration.
DTS validates data content but does not validate metadata such as sequences. Validate sequences and other metadata separately.
Long-running transactions combined with an incremental migration task cause write-ahead log (WAL) accumulation, which may exhaust disk space on the source database.
Replication slot management
During incremental data migration, DTS creates a replication slot with the prefix dts_sync_ in the source database. This slot holds incremental logs from the last 15 minutes. When migration fails or the migration instance is released, DTS attempts to clean up the slot automatically.
Automatic cleanup fails in the following cases, and you must clean up the slot manually to prevent disk accumulation:
The source database account password is changed during migration.
The DTS IP address is removed from the source database's IP address whitelist during migration.
A failover occurs on the source database — log in to the secondary database to clean up the slot.
DTS temporary tables
DTS creates the following temporary tables in the source database during migration. Do not delete them — deleting them causes the migration task to fail. DTS deletes them automatically when the migration instance is released.
public.dts_pg_class, public.dts_pg_attribute, public.dts_pg_type, public.dts_pg_enum, public.dts_postgres_heartbeat, public.dts_ddl_command, public.dts_args_session, public.aliyun_dts_instance
Billing
| Migration type | Instance configuration fee | Internet traffic fee |
|---|---|---|
| Full data migration | Free | Charged when Access Method of destination is Public IP Address. See Billing overview. |
| Incremental data migration | Charged. See Billing overview. | — |
SQL operations supported for incremental migration
| Operation type | SQL statements |
|---|---|
| DML | INSERT, UPDATE, DELETE |
Migrate data
Step 1: Open the migration task configuration page
Use one of the following entry points.
From the DTS console:
Log on to the Data Transmission Service (DTS) console.
In the left navigation pane, click Data Migration.
In the upper-left corner, select the region where the migration instance will be located.
Click Create Task.
From the DMS console:
The actual navigation may vary based on the DMS console mode and layout. For details, see Simple mode console and Customize the layout and style of the DMS console.
Log on to the Data Management (DMS) console.
In the top menu bar, choose Data + AI > Data Transmission (DTS) > Data Migration.
To the right of Data Migration Tasks, select the destination region.
Click Create Task.
Step 2: Configure source and destination databases
On the task configuration page, set Task Name to a descriptive name for easy identification. The name does not need to be unique.
Source database (PolarDB for PostgreSQL):
| Parameter | Value |
|---|---|
| Select Existing Connection | Select a previously registered instance, or leave blank to configure manually. |
| Database Type | PolarDB for PostgreSQL |
| Access Method | Alibaba Cloud Instance |
| Instance Region | Select the region of the source PolarDB for PostgreSQL cluster. |
| Replicate Data Across Alibaba Cloud Accounts | Select No if using an instance under the current Alibaba Cloud account. |
| Instance ID | Select the ID of the source PolarDB for PostgreSQL cluster. |
| Database Name | Enter the name of the database containing the objects to migrate. |
| Database Account | Enter the privileged account. See Prerequisites. |
| Database Password | Enter the account password. |
Destination database (Oracle):
| Parameter | Value |
|---|---|
| Select Existing Connection | Select a previously registered instance, or leave blank to configure manually. |
| Database Type | Oracle |
| Access Method | Select based on the deployment location. This guide uses Self-managed Database on ECS as an example. For other deployment types, see Preparations overview. |
| Instance Region | Select the region of the destination Oracle database. |
| ECS Instance ID | Select the ECS instance hosting the Oracle database. |
| Port Number | Enter the Oracle service port. Default: 1521. |
| Oracle Type | Select Non-RAC Instance (enter SID) or RAC or PDB Instance (enter Service Name). In this example, select RAC or PDB Instance and enter the Service Name. |
| Database Account | Enter the Oracle account with schema owner permissions. |
| Database Password | Enter the account password. |
After completing the configuration, click Test Connectivity and Proceed. In the CIDR Blocks of DTS Servers dialog box, click Test Connectivity.
Make sure the DTS server IP address ranges are added to the security settings of both the source and destination databases. See Add DTS server IP addresses to a whitelist.
Step 3: Configure migration objects
On the Configure Objects page, set the following parameters:
| Parameter | Description |
|---|---|
| Migration Types | Select Full Data Migration for a one-time copy. Select both Full Data Migration and Incremental Data Migration for a zero-downtime migration. If you select only full migration, do not write new data to the source database during migration to maintain data consistency. |
| Processing Mode of Conflicting Tables | Precheck and Report Errors (default): the precheck fails if a table with the same name exists in the destination. Ignore Errors and Proceed: skips the conflict check. Use with caution — this may overwrite data in the destination or cause migration failures if table schemas differ. |
| Capitalization of object names in destination instance | Set the case sensitivity policy for migrated object names. Default is DTS default policy. See Case sensitivity of object names in the destination database. |
| Source Objects | Click objects in the Source Objects box and move them to Selected Objects using the arrow. You can select schemas or tables. |
| Selected Objects | Right-click a migration object to use object name mapping (map to a specific schema, table, or column in the target Oracle database), select SQL operations at the table level, or set filter conditions. See Database, Table, and Column Name Mapping and Set filter conditions. Note |
Click Next: Advanced Settings.
Step 4: Configure advanced settings
| Parameter | Description |
|---|---|
| Dedicated Cluster for Task Scheduling | DTS schedules tasks on a shared cluster by default. For more stable tasks, purchase a dedicated cluster. |
| Retry Time for Failed Connections | Duration DTS retries after a connection failure. Default: 720 minutes. Set to a value from 10 to 1,440 minutes. Set to more than 30 minutes for production use. During this period, the task is billed. |
| Retry Time for Other Issues | Duration DTS retries after non-connectivity errors (DDL or DML exceptions). Default: 10 minutes. Set to a value from 1 to 1,440 minutes. Must be less than Retry Time for Failed Connections. |
| Enable Throttling for Full Data Migration | Limit QPS to the source database, RPS of Full Data Migration, and data migration speed (MB/s) to reduce database load. Available only when Full Data Migration is selected. You can also adjust throttling after the task starts. |
| Enable Throttling for Incremental Data Migration | Limit RPS of Incremental Data Migration and data migration speed (MB/s). Available only when Incremental Data Migration is selected. You can also adjust throttling after the task starts. |
| Environment Tag | (Optional) Select a tag to identify the instance. |
| Configure ETL | Select Yes to configure the ETL feature and enter data processing statements. Select No to skip ETL. |
| Monitoring and Alerting | Select Yes to set an alert threshold and alert notifications for migration failures or latency exceeding the threshold. |
Step 5: Run the precheck
Click Next: Save Task Settings and Precheck.
To preview the API parameters for this instance configuration, hover over the Next: Save Task Settings and Precheck button and click Preview OpenAPI parameters.
DTS runs a precheck before starting the migration. If the precheck fails:
Click View Details next to the failed item, fix the issue, then run the precheck again.
For warnings that can be ignored, click Confirm Alert Details > Ignore > OK > Precheck Again. Ignoring warnings may cause data inconsistency.
Step 6: Purchase the instance and start migration
When the Success Rate reaches 100%, click Next: Purchase Instance.
On the Purchase page, select the resource group and instance class. The instance class affects migration speed. See Data migration link specifications.
Read and accept Data Transmission Service (Pay-as-you-go) Service Terms.
Click Buy and Start, then click OK in the confirmation dialog.
The migration task appears on the Data Migration Tasks list page. Full migration tasks stop automatically when complete (status: Completed). Incremental migration tasks continue running (status: Running) until you stop them.
Switch your business to the destination database
For incremental migration, wait until the task's Incremental Data Migration phase shows a latency of 0s, then:
Stop writing data to the source database.
Wait a few minutes for the latency to return to 0s.
Stop the migration task.
Switch your business connections to the destination Oracle database.
DTS attempts to automatically recover failed tasks within seven days. Before switching your business to the destination, end or release the migration task, or revoke write permissions for the DTS account on the destination database. This prevents the source data from overwriting destination data if the task recovers automatically.
DTS technical support will attempt to recover failed tasks within 8 hours. During recovery, DTS may restart the task or adjust task parameters. Only DTS task parameters are modified — database parameters remain unchanged. For modifiable parameters, see Modify instance parameters.