All Products
Search
Document Center

AnalyticDB:Synchronize data from a self-managed PostgreSQL database to an AnalyticDB for PostgreSQL instance

Last Updated:Mar 28, 2026

Data Transmission Service (DTS) supports one-way synchronization from a self-managed PostgreSQL database to an AnalyticDB for PostgreSQL instance, covering both initial full data load and ongoing incremental changes.

Prerequisites

Before you begin, ensure that you have:

  • Tables to be synchronized with primary keys defined

  • A destination AnalyticDB for PostgreSQL instance created. For more information, see Create an instance

  • A database, schema, and table created in the destination instance that match the schema of the source objects. For more information, see SQL syntax

Limitations

LimitationDetails
Scope per taskOne task covers one database. Create a separate task for each additional database.
Supported objectsOnly tables can be selected as synchronization objects.
Schema synchronizationNot supported. Create the required schemas in the destination instance manually before starting the task.
DDL operationsDDL changes on source objects during synchronization are not automatically replicated. Apply the same DDL to the destination, then restart the task.
Supported DML operationsINSERT, UPDATE, DELETE
Unsupported data typesBIT, VARBIT, GEOMETRY, UUID, TSQUERY, TSVECTOR, TXID_SNAPSHOT

Usage notes

New tables created during synchronization

DTS uses PostgreSQL logical replication to capture row-level changes. For UPDATE and DELETE operations to replicate correctly, the write-ahead logging (WAL) logs must include the full row image. Run the following statement on each new table before it can be synchronized:

ALTER TABLE schema.table REPLICA IDENTITY FULL;

Without this setting, WAL logs for UPDATE and DELETE operations do not include the full row image, and DTS cannot replicate those changes.

Warning

REPLICA IDENTITY FULL increases WAL volume for the affected tables. Apply it selectively to tables that require CDC replication.

Primary/secondary switchover

Switchover is supported only on ApsaraDB RDS for PostgreSQL 11 instances. Before performing a switchover, set the rds_failover_slot_mode parameter to sync. For more information, see Logical Replication Slot Failover.

Warning

Performing a primary/secondary switchover on a self-managed PostgreSQL database or an ApsaraDB RDS for PostgreSQL instance of any other version causes the synchronization task to fail.

Long-running transactions

Long-running transactions in the source database cause WAL logs to accumulate until those transactions commit. If left unaddressed, this can exhaust disk space on the source database. Monitor and commit or roll back long-running transactions promptly.

Configure the synchronization task

The end-to-end flow consists of four stages:

  1. Purchase a DTS instance

  2. Open the DTS console and navigate to your synchronization task

  3. Configure source and destination instances, then set the synchronization policy

  4. Run the precheck and start the task

Step 1: Purchase a DTS instance

Purchase a DTS instance. On the buy page, set the following:

ParameterValue
Source InstancePostgreSQL
Destination InstanceAnalyticDB for PostgreSQL
Synchronization TopologyOne-Way Synchronization

Step 2: Open the DTS console

Log on to the DTS console.

Note

If you are redirected to the Data Management (DMS) console, click the old icon in the image to switch to the previous version of the DTS console.

Step 3: Navigate to the synchronization task

In the left-side navigation pane, click Data Synchronization.

Step 4: Select the destination region

At the top of the Synchronization Tasks page, select the region where the destination instance resides.

Step 5: Open the task configuration

Find the synchronization instance and click Configure Task in the Actions column.

Step 6: Configure the source and destination instances

Configure the source and destination databases

Source instance details

ParameterDescription
Synchronization task nameDTS generates a name automatically. Specify a descriptive name for easy identification. The name does not need to be unique.
Instance typeSelect based on how your source database is deployed. This example uses User-Created Database in ECS Instance. For other instance types, configure the network environment first. For more information, see Preparation overview.
Instance regionThe source region selected on the buy page. Read-only.
ECS instance IDSelect the Elastic Compute Service (ECS) instance where the self-managed PostgreSQL database is deployed.
Database typePostgreSQL. Read-only.
Port numberThe service port of the self-managed PostgreSQL database.
Database nameThe name of the source database.
Database accountAn account with schema owner permissions.
Database passwordThe password for the database account.

Destination instance details

ParameterDescription
Instance typeAnalyticDB for PostgreSQL. Read-only.
Instance regionThe destination region selected on the buy page. Read-only.
Instance IDSelect the AnalyticDB for PostgreSQL instance.
Database nameThe name of the destination database.
Database accountThe initial account of the AnalyticDB for PostgreSQL instance, or an account with the RDS_SUPERUSER permission. For more information, see Create a database account and Manage users and permissions.
Database passwordThe password for the database account.

Step 7: Add DTS IP addresses to the whitelist

Click Set Whitelist and Next. DTS automatically adds its server CIDR blocks to the inbound security group rule of the ECS instance and the whitelist of the AnalyticDB for PostgreSQL instance, so DTS can connect to both ends.

Step 8: Configure the synchronization policy and objects

Select the objects to be synchronized
ParameterDescription
Initialize synchronizationInitial Full Data Synchronization is selected by default. After the precheck passes, DTS copies all existing data from the source database to the destination instance as the baseline for incremental synchronization.
Processing mode of conflicting tablesClear Data: Skips the empty-table check and clears destination table data before the full sync. Use this when you want to test the task and then synchronize production data. Ignore: Skips the empty-table check and appends incoming data to existing destination data. Use this when synchronizing from multiple source tables into one destination table.
Synchronization typeSelect the DML operations to synchronize: Insert, Update, and Delete. The AlterTable option is shown but not supported.
Objects to synchronizeSelect tables from the Available list and move them to the Selected list using the Rightwards arrow icon. Only tables can be selected. To rename objects in the destination, use the object name mapping feature. For more information, see Rename an object to be synchronized and Object name mapping.
Retry time for failed connectionsDefault is 720 minutes (12 hours). If DTS reconnects within this window, the task resumes automatically. Otherwise, the task fails. DTS charges apply during the retry period. Set this value based on your business needs and release the DTS instance promptly if both the source and destination instances are released.

Step 9: Run the precheck

Click Precheck in the lower-right corner. The task cannot start until the precheck passes.

If any item fails, click the 提示 icon next to the failed item to view details. After resolving the issue, start a new precheck. If you choose not to fix an issue, ignore the failed item and start a new precheck.

Step 10: Start the task

After the Precheck Passed message appears, close the Precheck dialog box. The synchronization task starts automatically.

Step 11: Verify the task status

Wait for the initial full synchronization to complete. Once finished, the task transitions to the Synchronizing state.

View the status of a data synchronization task

Monitor the task on the Synchronization Tasks page.