All Products
Search
Document Center

AnalyticDB:Synchronize data from an ApsaraDB RDS for SQL Server instance to an AnalyticDB for PostgreSQL instance

Last Updated:Mar 28, 2026

Use Data Transmission Service (DTS) to synchronize data from ApsaraDB RDS for SQL Server to AnalyticDB for PostgreSQL. DTS handles schema synchronization, full data synchronization, and incremental data synchronization, keeping your analytical database current as your transactional database changes.

What DTS supports in this scenario

CapabilityDetails
Supported SQL Server versions2012, 2014, 2016, 2017, 2019
Schema synchronization objectsSchema, table, view, function, procedure
DDL operationsADD COLUMN only. Transactional DDL operations are not supported.
DML operationsINSERT, UPDATE, DELETE
Synchronization topologyOne-way synchronization
BillingSchema and full data synchronization: free. Incremental data synchronization: charged. See Billing overview.

Limitations

Unsupported data types

DTS does not synchronize columns of the following data types: TIMESTAMP, CURSOR, ROWVERSION, HIERARCHYID, SQL\_VARIANT, SPATIAL GEOMETRY, SPATIAL GEOGRAPHY, and TABLE.

Heterogeneous database constraints

SQL Server and AnalyticDB for PostgreSQL are heterogeneous databases. Data types do not map one-to-one between them. Review the data type mappings for schema synchronization before you start, and evaluate the impact on your business.

Source and destination table requirements

  • Source tables must have primary keys.

  • Destination tables must have primary keys or unique indexes.

Prerequisites

Before you begin, ensure that you have:

Required permissions

Grant the following permissions before configuring the synchronization task.

ApsaraDB RDS for SQL Server

The database account must have owner-level permissions on the source database. See Modify the permissions of an account.

AnalyticDB for PostgreSQL

The database account needs the following permissions. You can use the instance's initial account, which has these permissions by default.

  • LOGIN permission

  • SELECT, CREATE, INSERT, UPDATE, and DELETE permissions on the destination tables

  • CONNECT and CREATE permissions on the destination database

  • CREATE permission on the destination schemas

  • COPY permission (required for memory-based batch copy operations)

See Manage users and permissions for more information.

Usage notes

  • DTS adds a heartbeat table named dts_log_heart_beat to the source database to maintain synchronization latency accuracy.

  • DTS consumes read and write resources on both databases during synchronization. To avoid degrading database performance, run synchronization tasks during off-peak hours—ideally when CPU utilization on both databases is below 30%.

  • If DTS fails to connect to the source or destination database, it retries for up to 720 minutes (12 hours) by default. Adjust this value based on your business requirements. During retries, you are charged for the DTS instance.

Warning

When DTS CIDR blocks are added to database whitelists or ECS security group rules, security risks may arise. Before starting synchronization, take preventive measures including: strengthening username and password security, limiting exposed ports, authenticating API calls, and regularly auditing whitelist rules. As an alternative, connect your database to DTS through Express Connect, VPN Gateway, or Smart Access Gateway.

Configure the synchronization task

Setting up a synchronization task involves three phases: purchasing and configuring the DTS instance, selecting objects to synchronize, and configuring AnalyticDB for PostgreSQL-specific table settings.

Step 1: Purchase and configure the DTS instance

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

    • Source Instance: SQL Server

    • Destination Instance: AnalyticDB for PostgreSQL

    • Synchronization Topology: One-way Synchronization

  2. Log on to the DTS console.

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

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

  5. Find the synchronization instance and click Configure Synchronization Channel in the Actions column.

  6. Configure the source and destination instances.

    SectionParameterDescription
    N/ASynchronization task nameA name for this task. Use a descriptive name to identify the task easily. Task names do not need to be unique.
    Source instance detailsInstance typeSelect RDS Instance.
    Instance regionThe source region selected on the buy page. Read-only.
    Instance IDThe ID of the source ApsaraDB RDS for SQL Server instance.
    Database accountThe account with owner-level permissions on the source database.
    Database passwordThe password for the database account.
    EncryptionSelect Non-encrypted or SSL-encrypted. To use SSL encryption, enable SSL encryption on the RDS instance first.
    Note

    The Encryption parameter is available only for regions in the Chinese mainland and the China (Hong Kong) region.

    Destination instance detailsInstance typeFixed to AnalyticDB for PostgreSQL.
    Instance regionThe destination region selected on the buy page. Read-only.
    Instance IDThe ID of the destination AnalyticDB for PostgreSQL instance.
    Database nameThe name of the destination database.
    Database accountThe account with the required permissions on the destination instance.
    Database passwordThe password for the database account.

    Configure the source and destination instances

  7. Click Set Whitelist and Next in the lower-right corner. DTS automatically adds its server CIDR blocks to the IP address whitelist of Alibaba Cloud database instances and to the security group rules of ECS-hosted databases. For self-managed databases in data centers or on third-party cloud platforms, manually add the CIDR blocks. See Add the CIDR blocks of DTS servers.

Step 2: Select the synchronization policy and objects

  1. Configure the synchronization policy and select the objects to synchronize.

    Requirements for merging tables

    When Merge Multi Tables is set to Yes:

    • Add a column named __dts_data_source (data type: TEXT) to the destination table. DTS uses this column to record the source of each row in the format: <Data synchronization instance ID>:<Source database name>.<Source schema name>.<Source table name>. For example: dts********:dtstestdata.testschema.customer1.

    • Use object name mapping to rename all selected source tables to the destination table name in AnalyticDB for PostgreSQL.

    • All source tables selected in the task are merged into the same destination table. To exclude specific tables from merging, create a separate synchronization task for those tables.

    SettingDescription
    Initialize synchronizationInitial Schema Synchronization, Initial Full Data Synchronization, and Initial Incremental Data Synchronization are selected by default. DTS synchronizes schemas and existing data before starting incremental synchronization.
    Processing mode in existed target tablePre-check and Intercept: fails the precheck if the destination database has tables with the same names as source tables. Use object name mapping to rename conflicting tables. Ignore Errors and Proceed: skips the precheck for duplicate table names. If schemas match, DTS skips records with duplicate primary keys. If schemas differ, the task may fail or synchronize only partial columns.
    Merge multi tablesYes: merges multiple source tables with the same schema into a single destination table. Useful for OLTP sharding scenarios where you want to consolidate data in AnalyticDB for PostgreSQL. See requirements for merging tables below. No (default): each source table maps to its own destination table.
    Select the operation typesSelect the types of operations that you want to synchronize based on your business requirements. All operation types are selected by default.
    Select the objects to be synchronizedSelect objects from the Available section and move them to the Selected section. Because this is a heterogeneous database synchronization, only tables are synchronized—views, triggers, and stored procedures are not. Use object name mapping to rename objects in the destination instance.
    Add quotation marks to the target objectSelect Yes if any of the following conditions apply: the source database environment is case-sensitive with mixed-case names; table names start with non-letter characters or contain unsupported characters (allowed special characters: underscores _, number signs #, dollar signs $); or object names are reserved keywords in the destination database. After DTS synchronizes data, reference quoted objects using their quoted names.
    Rename databases and tablesUse object name mapping to rename objects in the destination instance.
    Retry time for failed connectionsDTS retries failed connections for 720 minutes (12 hours) by default. Adjust based on your requirements.

    Select the synchronization policy and the objects to be synchronized

Step 3: Configure AnalyticDB for PostgreSQL table settings

  1. Specify the table type, primary key column, and distribution key for each table to synchronize to the AnalyticDB for PostgreSQL instance. For more information about primary key columns and distribution columns, see Manage tables and Define table distribution.

    Specify the table type, primary key column, and distribution key

  2. Click Precheck in the lower-right corner. DTS runs a precheck before starting the synchronization task. If any items fail:

    1. Click the icon next to the failed item to view details.

    2. Fix the issue based on the details, then initiate a new precheck.

    3. To skip an issue without fixing it, ignore the failed items and initiate a new precheck.

  3. Close the Precheck dialog after the message The precheck is passed. appears. The synchronization task starts automatically.

  4. Wait until initial synchronization completes and the task status changes to Synchronizing. Monitor the task status on the Synchronization Tasks page.

    View the status of a data synchronization task

FAQ

Where do synchronized tables appear in the AnalyticDB for PostgreSQL instance?

During schema synchronization, DTS creates tables in the destination database using the same schema structure as the source database. For example, if you synchronize the customer and Student tables from the dbo schema of the dtstestdata database, you can find these tables in the dbo schema of the destination instance.

View destination tables in AnalyticDB for PostgreSQL

Related topics