All Products
Search
Document Center

Data Transmission Service:Create a reverse task

Last Updated:Apr 22, 2024

This topic describes how to create a reverse task by using Data Transmission Service (DTS). This feature is used to synchronize data from the destination database back to the source database for database disaster recovery.

Prerequisites

  • A disaster recovery database whose available storage space is larger than the total size of the data in the business database is created. The available storage space of the disaster recovery database is 10% larger than the total size of the data in the business database. This is a recommended prerequisite.

  • The accounts are created for the business database and disaster recovery database to synchronize data. The required permissions are granted to the database accounts. For more information, see Synchronize data between ApsaraDB RDS for MySQL instances or Synchronize data between ApsaraDB RDS for SQL Server instances.

    Important

    The following permissions are granted to the disaster recovery database account:

    • If you synchronize data between SQL Server databases, the destination database account of the original synchronization instance must assume the sysadmin role. You can use the system administrator account to grant the permissions to the destination database account by running the EXEC sp_addsrvrolemember @loginame = N'<Account name>', @rolename = N'sysadmin'; command.

    • If you synchronize data between MySQL databases, the destination database account of the original synchronization instance must be granted the REPLICATION CLIENT, REPLICATION SLAVE, SHOW VIEW, and SELECT permissions. For more information, see GRANT Statement.

Usage notes

  • You can create a reverse instance only for a synchronization instance between SQL Server databases or MySQL databases. A reverse instance supports only incremental data synchronization.

  • The data that is directly written to the destination database of the original synchronization instance before a reverse instance is created is not synchronized.

  • A precheck is immediately performed after a reverse instance is created. After the precheck is passed, DTS collects the incremental data but does not write the data to the source database of the original synchronization instance.

  • You can create only one reverse instance for each synchronization instance. After the reverse instance is started, the original synchronization instance cannot be started.

  • The tables to be synchronized must have PRIMARY KEY or UNIQUE constraints, and all fields must be unique. Otherwise, duplicate data records may occur.

  • You must set the retention period of binary logs based on the estimated time that is required for database restoration if an exception occurs in the business database.

  • If the original synchronization instance is a DTS Serverless instance, the reverse instance that you create for the original synchronization instance supports only the pay-as-you-go billing method and the micro instance class. If the original synchronization instance is a subscription or pay-as-you-go instance, the billing method and instance class of the reverse instance that you create for the original synchronization instance are the same as those of the original synchronization instance by default.

  • If the original synchronization instance is used for cross-region data synchronization, you must select the region in which the source database of the original synchronization instance resides before you can view the reverse instance that is created for the original synchronization instance on the Data Synchronization Tasks page.

  • You are still charged for a created reverse instance during the period when the reverse instance is paused.

  • If the business database fails to be connected due to exceptions, DTS instances enter the Retrying state.Status

Procedure

  1. Create a forward synchronization instance to synchronize data from the business database to the disaster recovery database based on your business requirements.

    Select an instance class based on your business requirements and configure the Retry Time for Failed Connections parameter based on the estimated time that is required for database restoration if an exception occurs in the business database. For more information about how to create a forward synchronization instance, see Synchronize data between ApsaraDB RDS for MySQL instances or Synchronize data between ApsaraDB RDS for SQL Server instances.

  2. Wait until the forward synchronization instance enters the Running state and perform the following steps to create a reverse instance:Status

    1. On the Data Synchronization Tasks page, find the synchronization instance that you have created.

    2. Find the synchronization instance that you want to manage, click the 更多设置 icon in the Actions column, and select Create Reverse Task.

    3. In the Note message, click OK.

      Wait until the precheck of the reverse instance is complete. The instance enters the Performing Initial Synchronization state after the precheck is passed.

      Note
      • If Auto Refresh is disabled, you must click the 刷新 icon above the Actions column to refresh the state of the reverse instance.

      • If the precheck fails, click View Cause. On the Create Task page, click View Details in the Check Result column of the failed check item. Follow the instructions to resolve the issue and run the precheck again.

    4. The reverse instance is created. No more operations are required if no exception occurs.

  3. If the business database fails to be connected due to exceptions, perform the following steps to restore your business:

    1. Pause the original instance.

      1. On the Data Synchronization Tasks page, find the original instance.

      2. In the Actions column, click the 更多设置 icon and select Pause Task.

      3. In the Note message, click OK.

      4. In the The task is paused. message, click OK.

    2. Switch your workloads to the disaster recovery database.

    3. Start the reverse instance.

      1. On the Data Synchronization Tasks page, click the ID of the reverse instance.

      2. Optional. In the left-side navigation pane, click Task Management.

      3. In the Progress section, click the Incremental Write module.

      4. On the Basic Information tab, click Start Incremental Write next to Actions.

      5. In the Note message, click OK.

  4. After the business database is restored, perform the following steps to switch your workloads to the business database and restore the synchronization instances.

    1. Switch your workloads to the business database.

    2. Wait until the incremental synchronization task in the reverse direction is not delayed, pause the reverse instance.

      The reverse instance synchronizes the data that is directly written to the disaster recovery database back to the business database.

    3. Wait until the reverse instance is paused, start the forward synchronization instance.

FAQ

  • How do I select an instance class when I create a forward synchronization instance?

    We recommend that you select the micro instance class that has the smallest maximum records per second (RPS). After you create a reverse instance, you can upgrade the instance based on your business requirements. For more information, see Upgrade a DTS instance.

  • What do I do if a DTS instance is in the Failed state after the business database is restored?

    Start the DTS task. For more information, see Start a DTS task.