All Products
Search
Document Center

Data Transmission Service:Call operations to configure DTS tasks

Last Updated:May 21, 2025

This topic describes how to configure synchronization, migration, and subscription tasks in Data Transmission Service (DTS) by calling operations.

Background information

Configuring DTS tasks by calling operations is similar to configuring DTS tasks in the DTS console. You can purchase a DTS instance first and then configure it, or configure a DTS task first and then purchase an instance.

  • For DTS tasks where you purchase an instance first and then configure it:

    • Synchronization or migration tasks: Whether the precheck module is started depends on the value of autoStartModulesAfterConfig in the Reserve parameter) of the ConfigureDtsJob operation.

    • Subscription tasks: The precheck module is not started by default.

  • For DTS tasks where you configure a task first and then purchase an instance:

    Whether the precheck module is started depends on the value of AutoStart in the CreateDtsInstance operation.

Usage notes

  • When you call operations, ensure that parameters are correctly specified. Otherwise, the calls may fail.

  • When you call operations to purchase a synchronization or migration task first and then configure it, and the precheck module is executed without errors, the DTS task automatically executes all subsequent modules.

Preparations

You need to collect database instance information, such as the ID, region, endpoint or IP address, port, database account, and password of the source database instance.

Procedure

Note

This section uses a migration task as an example to describe how to configure DTS tasks by calling operations.

Scenario 1: Purchase an instance first and then configure it

Do not start the precheck module

  1. Call the CreateDtsInstance operation to purchase a DTS instance.

    Sample requests

    {
      "DestinationEndpointEngineName":"MySQL",
      "DestinationRegion":"cn-hangzhou",
      "InstanceClass":"small",
      "PayType":"PostPaid",
      "RegionId":"cn-hangzhou",
      "SourceEndpointEngineName":"MySQL",
      "SourceRegion":"cn-hangzhou",
      "Type":"MIGRATION"
    }

    Sample responses

    {
      "RequestId": "76C0****-879D-5FB7-8F08-BC11B67C****",
      "InstanceId": "dtsza0i4l8x167****",
      "Success": true,
      "JobId": "za0i4l8x167****"
    }
  2. Call the ConfigureDtsJob operation to configure a DTS task.

    Note

    Sample requests

    {
      "DataInitialization":"true",
      "DataSynchronization":"false",
      "DestinationEndpointInstanceType":"RDS",
      "DtsJobName":"rdsmysql_to_rdsmysql",
      "JobType":"MIGRATION",
      "SourceEndpointInstanceType":"RDS",
      "StructureInitialization":"true",
      "DbList":{
        "dtsdb":{
          "name":"dtsdb_1",
          "all":"false",
          "Table":{
            "person":{
              "name":"person",
               "all":"true"
            }
          }
        }
      },
      "DestinationEndpointEngineName":"MYSQL",
      "DestinationEndpointInstanceID":"rm-bp1072qxu5q3h****",
      "DestinationEndpointPassword":"**********",
      "DestinationEndpointRegion":"cn-hangzhou",
      "DestinationEndpointUserName":"dtstest",
      "DtsInstanceId":"dtsza0i4l8x167****",
      "RegionId":"cn-hangzhou",
      "Reserve":{
        "targetTableMode":"0",
        "autoStartModulesAfterConfig":"none"
      },
      "SourceEndpointDatabaseName":"dtsdb",
      "SourceEndpointEngineName":"MYSQL",
      "SourceEndpointInstanceID":"rm-bp1072qxu5q3h****",
      "SourceEndpointPassword":"**********",
      "SourceEndpointRegion":"cn-hangzhou",
      "SourceEndpointUserName":"dtstest"
    }

    Sample responses

    {
      "DtsJobId": "za0i4l8x167****",
      "RequestId": "9233****-9539-5DB7-B801-69AADEB9****",
      "HttpStatusCode": 200,
      "DtsInstanceId": "dtsza0i4l8x167****",
      "Success": true
    }
  3. Optional. Call the StartDtsJob operation to start the DTS task based on your business requirements. Then, the DTS task executes the precheck module and subsequent modules.

    Sample requests

    {
    "DtsJobId":"za0i4l8x167****",
    "RegionId":"cn-hangzhou"
    }

    Sample responses

    {
      "RequestId": "CE51****-40F3-5913-AA27-C50251E2****",
      "HttpStatusCode": 200,
      "Success": true
    }

Start the precheck module

Note

This case is not applicable to subscription tasks.

  1. Call the CreateDtsInstance operation to purchase a DTS instance.

    Sample requests

    {
      "DestinationEndpointEngineName":"MySQL",
      "DestinationRegion":"cn-hangzhou",
      "InstanceClass":"small",
      "PayType":"PostPaid",
      "RegionId":"cn-hangzhou",
      "SourceEndpointEngineName":"MySQL",
      "SourceRegion":"cn-hangzhou",
      "Type":"MIGRATION"
    }

    Sample responses

    {
      "RequestId": "63F4****-935A-5E55-A7BC-D0464BA1****",
      "InstanceId": "dtsdg6e4m0e177****",
      "Success": true,
      "JobId": "dg6e4m0e177****"
    }
  2. Call the ConfigureDtsJob operation to configure a DTS task.

    Note
    • You need to leave the dulesAfterConfig parameter unspecified or set the value of this parameter to auto in the Reserve parameter.

    • If the precheck module is executed without errors, the DTS task automatically executes all subsequent modules.

    Sample requests

    {
      "DataInitialization":"true",
      "DataSynchronization":"false",
      "DestinationEndpointInstanceType":"RDS",
      "DtsJobName":"rdsmysql_to_rdsmysql_1",
      "JobType":"MIGRATION",
      "SourceEndpointInstanceType":"RDS",
      "StructureInitialization":"true",
      "DbList":{
        "dtsdb":{
          "name":"dtsdb_1",
          "all":"false",
          "Table":{
            "person":{
              "name":"person_1",
               "all":"true"
            }
          }
        }
      },
      "DestinationEndpointEngineName":"MYSQL",
      "DestinationEndpointInstanceID":"rm-bp1072qxu5q3h****",
      "DestinationEndpointPassword":"**********",
      "DestinationEndpointRegion":"cn-hangzhou",
      "DestinationEndpointUserName":"dtstest",
      "DtsInstanceId":"dtsdg6e4m0e177****",
      "RegionId":"cn-hangzhou",
      "SourceEndpointDatabaseName":"dtsdb",
      "SourceEndpointEngineName":"MYSQL",
      "SourceEndpointInstanceID":"rm-bp1072qxu5q3h****",
      "SourceEndpointPassword":"**********",
      "SourceEndpointRegion":"cn-hangzhou",
      "SourceEndpointUserName":"dtstest"
    }

    Sample responses

    {
      "DtsJobId": "za0i4l8x167****",
      "RequestId": "9233****-9539-5DB7-B801-69AADEB9****",
      "HttpStatusCode": 200,
      "DtsInstanceId": "dtsza0i4l8x167****",
      "Success": true
    }

Scenario 2: Configure a task first and then purchase an instance

+Do not start the precheck module

  1. Call the ConfigureDtsJob operation to configure a DTS task.

    Note

    For subscription tasks, you need to call the ConfigureSubscription operation.

    Sample requests

    {
      "DataInitialization":"true",
      "DataSynchronization":"false",
      "DestinationEndpointInstanceType":"RDS",
      "DtsJobName":"rdsmysql_to_rdsmysql_2",
      "JobType":"MIGRATION",
      "SourceEndpointInstanceType":"RDS",
      "StructureInitialization":"true",
      "DbList":{
        "dtsdb":{
          "name":"dtsdb_1",
          "all":"false",
          "Table":{
            "person":{
              "name":"person_2",
               "all":"true"
            }
          }
        }
      },
      "DestinationEndpointEngineName":"MYSQL",
      "DestinationEndpointInstanceID":"rm-bp1072qxu5q3h****",
      "DestinationEndpointPassword":"**********",
      "DestinationEndpointRegion":"cn-hangzhou",
      "DestinationEndpointUserName":"dtstest",
      "RegionId":"cn-hangzhou",
      "Reserve":{
        "targetTableMode":"0",
        "autoStartModulesAfterConfig":"none"
      },
      "SourceEndpointDatabaseName":"dtsdb",
      "SourceEndpointEngineName":"MYSQL",
      "SourceEndpointInstanceID":"rm-bp1072qxu5q3h****",
      "SourceEndpointPassword":"**********",
      "SourceEndpointRegion":"cn-hangzhou",
      "SourceEndpointUserName":"dtstest"
    }

    Sample responses

    {
      "DtsJobId": "w4rg4pj4169****",
      "RequestId": "F0CC****-A556-5A9D-AFF0-85D2B284****",
      "HttpStatusCode": 200,
      "Success": true
    }
  2. Optional. Start the DTS task based on your business requirements. Then, the DTS task executes the precheck module and subsequent modules. For more information, see step 2 and beyond of Start the precheck module without starting the DTS task or Start the precheck module and the DTS task.

Start the precheck module without starting the DTS task

  1. Call the ConfigureDtsJob operation to configure a DTS task.

    Note

    For subscription tasks, you need to call the ConfigureSubscription operation.

    Sample requests

    {
      "DataInitialization":"true",
      "DataSynchronization":"false",
      "DestinationEndpointInstanceType":"RDS",
      "DtsJobName":"rdsmysql_to_rdsmysql_3",
      "JobType":"MIGRATION",
      "SourceEndpointInstanceType":"RDS",
      "StructureInitialization":"true",
      "DbList":{
        "dtsdb":{
          "name":"dtsdb_1",
          "all":"false",
          "Table":{
            "person":{
              "name":"person_3",
               "all":"true"
            }
          }
        }
      },
      "DestinationEndpointEngineName":"MYSQL",
      "DestinationEndpointInstanceID":"rm-bp1072qxu5q3h****",
      "DestinationEndpointPassword":"**********",
      "DestinationEndpointRegion":"cn-hangzhou",
      "DestinationEndpointUserName":"dtstest",
      "RegionId":"cn-hangzhou",
      "SourceEndpointDatabaseName":"dtsdb",
      "SourceEndpointEngineName":"MYSQL",
      "SourceEndpointInstanceID":"rm-bp1072qxu5q3h****",
      "SourceEndpointPassword":"**********",
      "SourceEndpointRegion":"cn-hangzhou",
      "SourceEndpointUserName":"dtstest"
    }

    Sample responses

    {
      "DtsJobId": "w4rg4pj4169****",
      "RequestId": "F0CC****-A556-5A9D-AFF0-85D2B284****",
      "HttpStatusCode": 200,
      "Success": true
    }
  2. Call the StartDtsJob operation to start the precheck module.

    Sample requests

    {
    "DtsJobId":"w4rg4pj4169****",
    "RegionId":"cn-hangzhou"
    }

    Sample responses

    {
      "RequestId": "2A54****-4467-520E-B45A-D144A0C8****",
      "HttpStatusCode": 200,
      "Success": true
    }
  3. Call the DescribePreCheckStatus operation to check the execution status of the precheck module.

    Sample requests

    {
    "DtsJobId":"w4rg4pj4169****",
    "JobCode":"01",
    "RegionId":"cn-hangzhou",
    "StructType":"before"
    }

    Sample responses

    If the following information is returned, the precheck module is completed without errors.

    {
      ******
      "AnalysisJobProgress": [],
      "PageRecordCount": 20,
      "RequestId": "4436****-EE62-5DC3-8838-30807292****",
      "FullNetCheckJobStatus": [],
      "JobName": "****",
      "ErrorItem": 0,
      "SubDistributedJobStatus": [],
      "Code": "01",
      "Success": true,
      "PageNumber": 1,
      "State": "Finished",
      "Total": 9,
      "HttpStatusCode": 200,
      "JobId": "w4rg4pj4169****",
      ******
    }
  4. Call the CreateDtsInstance operation to purchase a DTS instance.

    Note

    You need to leave the AutoStart parameter unspecified or set its value to false. In this case, the DTS instance does not execute subsequent modules. This operation is equivalent to clicking Buy and Save in the DTS console.

    Sample requests

    {
    "InstanceClass":"small",
    "JobId":"w4rg4pj4169****",
    "PayType":"PostPaid",
    "RegionId":"cn-hangzhou"
    }

    Sample responses

    {
      "RequestId": "63F4****-935A-5E55-A7BC-D0464BA1****",
      "InstanceId": "dtsgvbn4c28167****",
      "Success": true,
      "JobId": "w4rg4pj4169****"
    }
  5. Optional. Call the StartDtsJob operation to start the DTS task based on your business requirements.

    Sample requests

    {
    "DtsJobId":"w4rg4pj4169****",
    "RegionId":"cn-hangzhou"
    }

    Sample responses

    {
      "RequestId": "EC1F****-10B0-501E-8B3E-71963809****",
      "HttpStatusCode": 200,
      "Success": true
    }

Start the precheck module and the DTS task

  1. Call the ConfigureDtsJob operation to configure a DTS task.

    Note

    For subscription tasks, you need to call the ConfigureSubscription operation.

    Sample requests

    {
      "DataInitialization":"true",
      "DataSynchronization":"false",
      "DestinationEndpointInstanceType":"RDS",
      "DtsJobName":"rdsmysql_to_rdsmysql_4",
      "JobType":"MIGRATION",
      "SourceEndpointInstanceType":"RDS",
      "StructureInitialization":"true",
      "DbList":{
        "dtsdb":{
          "name":"dtsdb_1",
          "all":"false",
          "Table":{
            "person":{
              "name":"person_4",
               "all":"true"
            }
          }
        }
      },
      "DestinationEndpointEngineName":"MYSQL",
      "DestinationEndpointInstanceID":"rm-bp1072qxu5q3h****",
      "DestinationEndpointPassword":"**********",
      "DestinationEndpointRegion":"cn-hangzhou",
      "DestinationEndpointUserName":"dtstest",
      "RegionId":"cn-hangzhou",
      "SourceEndpointDatabaseName":"dtsdb",
      "SourceEndpointEngineName":"MYSQL",
      "SourceEndpointInstanceID":"rm-bp1072qxu5q3h****",
      "SourceEndpointPassword":"**********",
      "SourceEndpointRegion":"cn-hangzhou",
      "SourceEndpointUserName":"dtstest"
    }

    Sample responses

    {
      "DtsJobId": "etom45sg17e****",
      "RequestId": "46F2****-69DD-59D7-8FF5-A119D72A****",
      "HttpStatusCode": 200,
      "Success": true
    }
  2. Call the StartDtsJob operation to start the precheck module.

    Sample requests

    {
    "DtsJobId":"etom45sg17e****",
    "RegionId":"cn-hangzhou"
    }

    Sample responses

    {
      "RequestId": "2A54****-4467-520E-B45A-D144A0C8****",
      "HttpStatusCode": 200,
      "Success": true
    }
  3. Call the DescribePreCheckStatus operation to check the execution status of the precheck module.

    Sample requests

    {
    "DtsJobId":"etom45sg17e****",
    "JobCode":"01",
    "RegionId":"cn-hangzhou",
    "StructType":"before"
    }

    Sample responses

    If the following information is returned, the precheck module is completed without errors.

    {
      ******
      "AnalysisJobProgress": [],
      "PageRecordCount": 20,
      "RequestId": "4436****-EE62-5DC3-8838-30807292****",
      "FullNetCheckJobStatus": [],
      "JobName": "****",
      "ErrorItem": 0,
      "SubDistributedJobStatus": [],
      "Code": "01",
      "Success": true,
      "PageNumber": 1,
      "State": "Finished",
      "Total": 9,
      "HttpStatusCode": 200,
      "JobId": "etom45sg17e****",
      ******
    }
  4. Call the CreateDtsInstance operation to purchase a DTS instance.

    Note

    You need to set the AutoStart parameter to true. Then, the DTS instance automatically executes subsequent modules. This operation is equivalent to clicking Buy and Save in the DTS console.

    Sample requests

    {
    "AutoStart":"true",
    "InstanceClass":"small",
    "JobId":"etom45sg17e****",
    "PayType":"PostPaid",
    "RegionId":"cn-hangzhou"
    }

    Sample responses

    {
      "RequestId": "4280****-9D5C-5053-9CA3-FAE47248****",
      "InstanceId": "dtst7lg4f20178****",
      "Success": true,
      "JobId": "etom45sg17e****"
    }

References