All Products
Search
Document Center

Data Transmission Service:Create an RDS PostgreSQL change tracking task

更新时间:Dec 04, 2025

Data Transmission Service (DTS) supports creating change tracking tasks for self-managed PostgreSQL and RDS PostgreSQL instances. This topic uses an RDS PostgreSQL instance as an example to describe the configuration procedure.

Prerequisites

Precautions

Type

Description

Limits on the source database

  • The source tables must have PRIMARY KEY or UNIQUE constraints, and all fields must be unique. Otherwise, part of the tracked data changes may be duplicate.

  • If you select tables as the objects to be tracked, up to 500 tables can be tracked in a single change tracking task. If you run a change tracking task to track more than 500 tables, a request error occurs. In this case, we recommend that you configure multiple tasks to track the tables in batches or configure a change tracking task for the entire database.

  • Write-Ahead Logging (WAL):

    • Enable WAL. Set the wal_level parameter to logical.

    • DTS requires that you retain WAL logs in the source database for more than 24 hours. Otherwise, DTS may fail to obtain the WAL logs. This can cause the task to fail or, in extreme cases, lead to data inconsistency or loss. Issues caused by setting the WAL log retention period to less than the required time are not covered by the DTS Service-Level Agreement (SLA).

  • If the source instance is a read-only instance or a temporary instance, ensure that the instance has logs that record transactions.

  • To ensure that the change tracking task runs as expected and to prevent interruptions caused by primary/secondary switchovers, RDS PostgreSQL must support and enable Logical Replication Slot Failover. For more information, see Logical Replication Slot Failover.

  • Logical subscriptions in the source database have limits. During the change tracking process, if a single updated data record exceeds 256 MB, the change tracking instance may fail and cannot be recovered. If this occurs, you must reconfigure the change tracking instance.

Other limits

  • To track schema updates (CREATE, DROP, and ALTER operations) in the source instance, create triggers and functions in the source database to capture Data Definition Language (DDL) information. For more information, see Implement incremental DDL migration for PostgreSQL using triggers and functions.

  • To ensure the accuracy of the displayed change tracking latency, DTS adds a heartbeat table named dts_postgres_heartbeat to the source database.

  • During incremental data tracking, DTS creates a replication slot that has the prefix dts_sync_ in the source database to replicate data. DTS automatically clears historical replication slots every 90 minutes to prevent them from consuming excessive disk space.

    Note

    When the change tracking task is released or fails, DTS automatically clears the replication slot. If a primary/secondary switchover occurs on the RDS PostgreSQL instance, you must log on to the secondary database to manually clear the replication slot.

    Amazon slot查询信息

  • A single change tracking task can track data changes from only one database. To track data changes from multiple databases, you must create a change tracking task for each database.

  • If a single row of data that you track exceeds 16 MB, the data cannot be consumed. This may cause an out-of-memory (OOM) error on the consumer client.

  • Make sure that the precision settings for columns of the FLOAT or DOUBLE data type meet your business requirements. DTS uses the ROUND(COLUMN,PRECISION) function to retrieve values from columns of the FLOAT or DOUBLE data type. If you do not specify a precision, DTS sets the precision for columns of the FLOAT data type to 38 digits and the precision for columns of the DOUBLE data type to 308 digits.

  • By default, time data types that include a time zone are converted to the corresponding time in the UTC+8 time zone.

  • If an instance fails, DTS helpdesk will try to recover the instance within 8 hours. During the recovery process, operations such as restarting the instance and adjusting parameters may be performed.

    Note

    When parameters are adjusted, only the parameters of the DTS instance are modified. The parameters of the database are not modified.

Special cases

If the source instance is an RDS PostgreSQL instance, do not modify the endpoint or zone of the RDS PostgreSQL instance during the change tracking process. Otherwise, the change tracking task fails.

Procedure

  1. Use one of the following methods to go to the Change Tracking Tasks page and select the region in which the change tracking instance resides.

    DTS console

    1. Log on to the DTS console.

    2. In the left-side navigation pane, click Change Tracking.

    3. In the upper-left corner of the page, select the region in which the change tracking instance resides.

    DMS console

    Note

    The actual operations may vary based on the mode and layout of the DMS console. For more information, see Simple mode and Customize the layout and style of the DMS console.

    1. Log on to the DMS console.

    2. In the top navigation bar, move the pointer over Data + AI > DTS (DTS) > Change Tracking.

    3. From the drop-down list to the right of Change Tracking Tasks, select the region in which the change tracking instance resides.

  2. Click Create Task to go to the task configuration page.

  3. Configure parameters in the Source Database and Consumer Network Type sections.

    Warning

    After you specify the source database instance, we recommend that you read the Limits that are displayed in the upper part of the page. Otherwise, the task may fail or the tracked data cannot be consumed.

    Category

    Configuration

    Description

    None

    Task Name

    The name of the change tracking task. DTS automatically assigns a name to the task. We recommend that you specify a descriptive name that makes it easy to identify the task. You do not need to use a unique task name.

    Source Database

    Select Existing Connection

    • If you use a database instance that is registered with DTS, select the instance from the drop-down list. DTS automatically populates the following database parameters for the instance. For more information, see Manage database connections.

      Note

      In the DMS console, you can select the database instance from the Select a DMS database instance drop-down list.

    • If you fail to register the instance with DTS, or you do not need to use the instance that is registered with DTS, you must configure the following database information.

    Database Type

    Select PostgreSQL.

    Access Method

    Select Alibaba Cloud Instance.

    Instance Region

    Select the region where the RDS PostgreSQL instance resides.

    Replicate Data Across Alibaba Cloud Accounts

    Specifies whether to track data across Alibaba Cloud accounts. In this example, No is selected.

    Important

    If you want to access cloud resources across Alibaba Cloud accounts, set this parameter to Yes and specify the Alibaba Cloud Account and RAM Role Name parameters. You must configure Resource Access Management (RAM) authorization for the Alibaba Cloud account that is used to configure the DTS task. For more information about how to configure RAM authorization, see Configure RAM authorization for cross-account DTS tasks.

    Instance ID

    Select the RDS PostgreSQL instance ID.

    Database Name

    Enter the name of the database to track.

    Database Account

    Enter the privileged account of the RDS PostgreSQL instance. The account must be the owner of the selected database. For more information about how to create an account and grant permissions, see Create an account and Create a database.

    Database Password

    The password that is used to access the database instance.

    Encryption

    Specifies whether to encrypt the connection to the source database. You can configure this parameter based on your business requirements. In this example, Non-encrypted is selected.

    If you want to establish an SSL-encrypted connection to the source database, perform the following steps: Select SSL-encrypted, upload CA Certificate, Client Certificate, and Private Key of Client Certificate as needed, and then specify Private Key Password of Client Certificate.

    Note
    • If you set Encryption to SSL-encrypted for a self-managed PostgreSQL database, you must upload CA Certificate.

    • If you want to use the client certificate, you must upload Client Certificate and Private Key of Client Certificate and specify Private Key Password of Client Certificate.

    • For information about how to configure SSL encryption for an ApsaraDB RDS for PostgreSQL instance, see SSL encryption.

    Consumer Network Type

    Network Type

    The value of the Network Type parameter is fixed to VPC. You must select a VPC and a vSwitch. For more information, see VPCs.

    Note
    • After a change tracking task is configured, you cannot change the settings in the Consumer Network Type section.

    • If your change tracking client is deployed in a VPC, we recommend that you select the same VPC and vSwitch connected to the client.

    • If you track data changes over internal networks, the network latency is minimal.

  4. In the lower part of the page, click Test Connectivity and Proceed.

    Note
    • Make sure that the CIDR blocks of DTS servers can be automatically or manually added to the security settings of the source and destination databases to allow access from DTS servers. For more information, see Add DTS server IP addresses to a whitelist.

    • If the source database is a self-managed database and its Access Method is not set to Alibaba Cloud Instance, click Test Connectivity in the CIDR Blocks of DTS Servers dialog box.

  5. Configure the objects for change tracking.

    1. On the Configure Objects page, configure the objects for change tracking.

      Configuration

      Description

      Data Change Types

      The Data Change Types option is selected by default and cannot be changed.

      • Data Update

        DTS tracks data updates of the selected objects, including the INSERT, DELETE, and UPDATE operations.

      • Schema Update

        DTS tracks the create, delete, and modify operations that are performed on all object schemas of the source instance. You must use the change tracking client to filter the data to be tracked.

      Note

      To track Schema Update, create triggers and functions in the source database to capture DDL information. For more information, see Implement incremental DDL migration for PostgreSQL using triggers and functions.

      Source Objects

      Select one or more objects from the Source Objects section and click the 向右小箭头 icon to add the objects to the Selected Objects section.

      Note

      You can select tables or databases as the objects for change tracking.

      • If you select a database as the object, DTS tracks incremental data of all objects, including new objects in the database.

      • If you select a table as the object, DTS tracks only incremental data of this table. In this case, if you want to track data changes of another table, you must add the table to the object list. For more information, see Modify the objects for change tracking.

    2. Click Next: Advanced Settings to configure advanced settings.

      Configuration

      Description

      Dedicated Cluster for Task Scheduling

      By default, DTS schedules the task to a shared cluster. You do not need to configure this parameter. You can purchase dedicated clusters of specified specifications to run DTS change tracking tasks. For more information, see What is a DTS dedicated cluster.

      Retry Time for Failed Connections

      The retry time range for failed connections. If the change tracking task fails, DTS immediately retries a connection within the time range. Valid values: 10 to 1440. Unit: minutes. Default value: 720. We recommend that you set the parameter to a value greater than 30. If DTS is reconnected to the source database instance within the specified time range, DTS resumes the change tracking task. Otherwise, the change tracking task fails.

      Note
      • If multiple change tracking tasks are configured for a database instance, the shortest retry time range takes precedence. For example, Task A and Task B are configured for the same database instance. Task A is configured with a retry time range of 30 minutes, and Task B is configured with a retry time range of 60 minutes. In this case, the retry time range of 30 minutes takes precedence.

      • When DTS retries a connection, fees are charged. We recommend that you specify the retry time range based on your business requirements, or release the DTS instance at the earliest opportunity after the source database instance is released.

      Retry Time for Other Issues

      The retry time range for other issues. For example, if DDL or DML operations fail to be performed after the change tracking task is started, DTS immediately retries the operations within the retry time range. Valid values: 1 to 1440. Unit: minutes. Default value: 10. We recommend that you set the parameter to a value greater than 10. If the failed operations are successfully performed within the specified retry time range, DTS resumes the change tracking task. Otherwise, the change tracking task fails.

      Important

      The value of the Retry Time for Other Issues parameter must be smaller than the value of the Retry Time for Failed Connections parameter.

      Environment Tag

      Select an environment tag to identify the instance as needed. In this example, no environment tag is selected.

      Monitoring and Alerting

      Specifies whether to enable alerting for the change tracking task. If alerting is configured and the task fails or the latency exceeds the threshold, alert notifications are sent. Valid values:

  6. In the lower part of the page, click Next: Save Task Settings and Precheck.

    • To view the parameters to be specified when you call the relevant API operation to configure the DTS task, move the pointer over Next: Save Task Settings and Precheck and click Preview OpenAPI parameters.

    • If you do not need to view or have viewed the parameters, click Next: Save Task Settings and Precheck in the lower part of the page.

    Note
    • Before you can start the change tracking task, DTS performs a precheck. You can start the change tracking task only after the task passes the precheck.

    • If the task fails to pass the precheck, click View Details next to each failed item. After you troubleshoot the issues based on the error message, you can run a precheck again.

    • If an alert is generated for an item during the precheck, perform the following operations based on the scenario:

      • If an alert item cannot be ignored, click View Details next to the failed item and troubleshoot the issues. Then, run a precheck again.

      • If the alert item can be ignored, click Confirm Alert Details. In the View Details dialog box, click Ignore. In the message that appears, click OK. Then, click Precheck Again to run a precheck again. If you ignore the alert item, data inconsistency may occur and your business may be exposed to potential risks.

  7. Purchase the instance.

    1. Wait until Success Rate becomes 100%. Then, click Next: Purchase Instance.

    2. On the Purchase page, specify the billing method of the change tracking instance. The following table describes the parameters.

      Parameter

      Description

      Billing method

      • Subscription: You pay for your subscription when you create an instance. The subscription billing method is more cost-effective than the pay-as-you-go billing method for long-term use. You are offered lower prices for longer subscription durations.

      • Pay-as-you-go: A pay-as-you-go instance is billed on an hourly basis. We recommend that you select the pay-as-you-go billing method for short-term use. If you no longer require a pay-as-you-go instance, you can release the instance to reduce costs.

      Resource Group Settings

      The resource group to which the instance belongs. Default value: default resource group. For more information, see What is Resource Management?

      Subscription Duration

      If you select the subscription billing method, set the subscription duration and the number of instances that you want to create. The subscription duration can be one to nine months, one year, two years, three years, or five years.

      Note

      This parameter is available only if you select the Subscription billing method.

    3. Read and select the Data Transmission Service (Pay-as-you-go) Service Terms.

    4. Click Buy and Start to start the change tracking task. You can view the progress of the task in the task list.

What to do next

When the change tracking task is running, you can create consumer groups based on the downstream client to consume the tracked data.

  1. For more information about how to create and manage consumer groups, see Create consumer groups.

  2. Use one of the following methods to consume the tracked data: