All Products
Search
Document Center

Data Transmission Service:Switch workloads to the destination database

Last Updated:Apr 27, 2025

To minimize the impact of data synchronization or migration on your business, you can switch workloads to the destination database after a DTS instance synchronizes or migrates data to the destination database. This topic uses a migration instance as an example to describe how to switch workloads to the destination database.

Prerequisites

A data migration instance is configured, and the data migration instance is in the Running or Completed state. For more information about how to configure a data migration instance, see Overview of data migration scenarios.

Overview

  1. Pause write operations to the source database.

    To avoid data loss, suspend your business and stop writing data to the source database.

  2. Pause the data migration instance.

    After the data from the source database is written to the destination database, pause the data migration instance.

  3. Create and start a data migration task in the opposite direction.

    Migrate incremental data in the destination database to the source database in real time to provide a rollback solution for your business. After you switches workloads to the destination database, if an error occurs, you can switch workloads back to the source database.

  4. Switch workloads.

    Switch the database to which your business writes data, and resume your business.

Usage notes

  • We recommend that you switch workloads to the destination database during off-peak hours to minimize the negative impact. Before you switch workloads to the destination database, you must stop writing data to the source database and suspend the business.

  • We recommend that you create and authorize a database account for data migration. This allows you to distinguish session information and improve data security.

  • You must pause the data migration instance before you switch workloads to the destination database. Instances that are paused for more than seven days cannot be resumed.

  • If you no longer use a subscription task that auto-renewal is enabled, we recommend that you manually disable the auto-renewal or release the instance to which the task belongs. Otherwise, you will be charged additional fees. For more information, see Renewal guide and Release DTS instances.

Procedure

Switch workloads to the destination database

  1. Wait until the data migration instance enters the Incremental Data Migration stage and the latency in the Running Information column is less than 5 seconds.

    screenshot_2025-02-14_10-05-38

    Note

    If the migration instance does not have an Incremental Data Migration stage (that is, you do not select Incremental Data Migration for Migration Types when you configure the instance), the instance automatically ends after data migration is complete. Wait until the Status of the instance changes to Completed.

  2. Suspend your business and stop writing data to the source database.

  3. Log on to the source database and view session information. Make sure that no new sessions are used for write operations.

    Run the following statements based on the source database type:

    MySQL

    show processlist;

    SQL Server

    select * from sys.dm_exec_connections;

    Oracle

    select sid,serial#,username,program,machine,status from v$session;

    PostgreSQL

    select * from pg_stat_activity;

    Redis

    CLIENT LIST

    MongoDB

    use admin
    db.runCommand({currentOp: 1, $all:[{"active" : true}]})
    Note

    The process or session information returned by the preceding statements includes the processes or sessions between DTS and the source database.

  4. Pause the data migration instance.

    Important
    • Proceed with caution if you need to start the instance during the period in which the data migration instance is paused. Otherwise, data inconsistency may occur.

    • If the migration instance does not have an Incremental Data Migration stage, skip this step.

    1. Wait until the latency of the migration instance is 0 milliseconds.

      Note
      • If the Auto Refresh feature is disabled, click the image icon above the Actions column on the right to refresh the latency displayed on the page.

      • A latency of 0 may be a state for a short period.

      At this point, the data to be migrated from the source database is successfully migrated to the destination database.

    2. Continue to wait for 1 to 3 minutes.

      During this period, the latency of the instance may fluctuate within 2 seconds.

    3. On the Data Synchronization page, find the data synchronization instance that you want to pause and choose 更多设置 > Pause Task in the Actions column.

    4. In the message that appears, click OK.

    5. Wait until the Status of the instance changes to Paused.

  5. Create a data migration task in the opposite direction.

    1. Keep your business suspended.

    2. Remove the limit on writing data to the source database.

    3. Create and start a data migration task in the opposite direction.

      Important
    4. Wait until the Status of the instance changes to Running.

  6. Switch workloads to the destination database

    1. Switch workloads to the destination database.

    2. Resume data write operations.

    3. Test whether your instance runs as expected.

Rollback solution

Note

Perform the following steps to resume your service in exceptional cases such as failed to switch workloads to the destination database.

  1. Suspend your business and stop writing data to the database.

  2. Switch workloads back to the source database.

  3. Resume data write operations.

What to do next

After you switch workloads to the destination database and test all the business-related features, you can stop the task in the opposite direction. For more information, see Stop a data migration task.

Warning

The database accounts that are used for data migration have the read and write permissions. After data is migrated, you must delete the accounts or revoke the write permissions to ensure security.

FAQ

  • Q: How do I handle the original migration instance after I switch workloads to the destination database?

    A: You can end or release the instance based on your business requirements. For more information, see Terminate a DTS instance and Release DTS instances.

  • Q: What do I do if data is written to the source database due to a misoperation after I switch workloads to the destination database?

    A: You can use the data verification feature to compare the data of the source and destination databases. Then, you can make changes to ensure data consistency.

OSZAR »