Migrate data from a sandbox instance to an ApsaraDB RDS for MySQL instance

Updated at:
Copy as MD

Use Data Transmission Service (DTS) to migrate data from a sandbox instance to an ApsaraDB RDS for MySQL instance — either to preserve data written in the sandbox, or to complete an emergency recovery.

Use cases

  • Preserve sandbox writes: Read and write operations on a sandbox instance don't affect source databases. To keep data written to the sandbox, migrate it to an ApsaraDB RDS for MySQL instance.

  • Accelerate recovery: The sandbox feature restores backup sets faster than standard recovery methods. Create a sandbox instance for emergency disaster recovery, then migrate the required tables or databases to an ApsaraDB RDS for MySQL instance.

Prerequisites

Before you begin, make sure that:

Usage notes

  • DTS reads data from the sandbox instance and copies it to the ApsaraDB RDS for MySQL instance. The data in the sandbox instance is not affected or deleted.

  • To maintain data consistency, stop writing to the sandbox instance during full data migration.

Billing

Migration type Instance configuration fee Internet traffic fee
Schema migration and full data migration Free Charged when Access Method is set to Public IP Address. See Billing overview.
Incremental data migration Charged. See Billing overview.

Migrate data from a sandbox instance

Step 1: Open Data Migration Tasks

  1. Log on to the Data Management (DMS) console.

  2. In the top navigation bar, click Data + AI.

  3. In the left-side navigation pane, choose DTS (DTS) > Data Migration.

Step 2: Create a migration task

  1. From the drop-down list next to Data Migration Tasks, select the region where your migration instance will run.

  2. Click Create Task.

  3. In the Create Data Synchronization Task wizard, configure the source and destination databases.

Warning

After configuring the source and destination databases, read the Limits displayed at the top of the page before proceeding. Skipping this step may cause the task to fail or result in data inconsistency.

General parameters

Parameter Description
Task Name The name of the DTS task. DTS generates a name automatically. Specify a descriptive name to identify the task — it doesn't need to be unique.

Source database parameters

Parameter Description
Select a DMS database instance Select an existing instance to have DTS populate the parameters automatically, or configure parameters manually if you don't use an existing instance.
Database Type Select MySQL.
Access Method Select Express Connect, VPN Gateway, or Smart Access Gateway.
Instance Region The region where the sandbox instance runs.
Replicate Data Across Alibaba Cloud Accounts Select No if migrating within the same account.
Connected VPC The virtual private cloud (VPC) used to connect to the sandbox instance. Check the VPC console to find the VPC.
IP Address or Domain Name The endpoint of the sandbox instance, available on the sandbox instance details page.
Port Number The port to connect to the sandbox instance. Default: 3306.
Database Account The database account for the sandbox instance. This must match the account of the source database that was backed up to the sandbox. For required permissions, see Permissions required for database accounts.
Database Password The password for the database account.
Encryption Select Non-encrypted if SSL encryption is not enabled on the sandbox instance. Select SSL-encrypted if SSL encryption is enabled — you'll also need to upload a CA Certificate and set the CA Key.

Destination database parameters

Parameter Description
Select a DMS database instance Select an existing instance to have DTS populate the parameters automatically, or configure parameters manually if you don't use an existing instance.
Database Type Select MySQL.
Access Method Select Alibaba Cloud Instance.
Instance Region The region where the destination ApsaraDB RDS for MySQL instance runs.
Replicate Data Across Alibaba Cloud Accounts Select No if migrating within the same account.
RDS Instance ID The ID of the destination ApsaraDB RDS for MySQL instance.
Database Account The database account for the destination instance. For required permissions, see Permissions required for database accounts.
Database Password The password for the database account.
Encryption Select Non-encrypted or SSL-encrypted. To use SSL encryption, enable it on the ApsaraDB RDS for MySQL instance before configuring this task. See Use a cloud certificate to enable SSL encryption.
  1. Click Test Connectivity and Proceed.

  2. If an IP address whitelist is configured for the sandbox instance, add the CIDR blocks of DTS servers to the whitelist, then click Test Connectivity.

Warning

Adding DTS server CIDR blocks to a database whitelist creates security risks. Before proceeding, take preventive measures such as: using strong credentials, limiting exposed ports, authenticating API calls, auditing the whitelist regularly, and connecting through Express Connect, VPN Gateway, or Smart Access Gateway instead of a public IP address.

Step 3: Configure migration objects

On the Configure Objects page, set up what to migrate.

Migration types

Choose migration types based on your continuity requirements:

Goal Migration types to select Data consistency note
Full migration only (source can be offline briefly) Schema Migration + Full Data Migration Stop writing to the sandbox instance during migration to keep source and destination data consistent.
Continuous migration with minimal downtime Schema Migration + Full Data Migration + Incremental Data Migration Writing to the sandbox instance during migration is supported.
Note
  • If you don't select Schema Migration, create the target database and tables manually before migrating, and enable object name mapping in Selected Objects.

  • If you don't select Incremental Data Migration, we recommend that you do not write data to the source database during migration. This ensures data consistency between the source and destination databases.

Other configuration options

Configuration Description
Method to Migrate Triggers in Source Database Select how to migrate triggers. Skip this parameter if the objects to migrate don't include triggers. Only configurable when Schema Migration and Incremental Data Migration are both selected. See Synchronize or migrate triggers from the source database.
Enable Migration Assessment Evaluates whether source and destination database structures — such as index length, stored procedures, and dependent tables — meet requirements. Only configurable when Schema Migration is selected. If set to Yes, the precheck may take longer; the assessment result is visible during the precheck but doesn't affect the outcome.
Processing Mode of Conflicting Tables Precheck and Report Errors: fails the precheck if source and destination have tables with identical names. Use object name mapping to resolve conflicts. Ignore Errors and Proceed: skips this check — during full migration, conflicting records are skipped; during incremental migration, they overwrite destination records. Use with caution.
Whether to migrate Event Choose whether to migrate events from the source database. If Yes, complete the related requirements. See Synchronize or migrate events.
Capitalization of Object Names in Destination Instance Controls capitalization of database names, table names, and column names in the destination. Default: DTS default policy. See Specify the capitalization of object names in the destination instance.
Source Objects Select objects to migrate and click Rightwards arrow to add them to Selected Objects. You can select columns, tables, or databases. Selecting tables or columns excludes other object types such as views, triggers, and stored procedures.
Selected Objects Right-click an object to rename it or set SQL filter conditions. Click Batch Edit in the upper-right corner to rename multiple objects at once. Note that object name mapping may cause dependent objects to fail migration. For filter conditions, see Set filter conditions.

Click Next: Advanced Settings.

Step 4: Configure advanced settings

Configuration Description
Dedicated Cluster for Task Scheduling By default, DTS uses the shared cluster. For higher stability, purchase a dedicated cluster. See What is a DTS dedicated cluster.
Copy the temporary table of the Online DDL tool that is generated in the source table to the destination database. Controls how DTS handles temporary tables from online DDL tools. Yes: migrates temporary table data (may introduce latency if the data volume is large). No, Adapt to DMS Online DDL: skips temporary table data and migrates only the original DDL from DMS (destination tables may be locked). No, Adapt to gh-ost: skips temporary table data and migrates only the original DDL from gh-ost, using regular expressions to filter shadow tables (destination tables may be locked).
Important

Do not use tools such as pt-online-schema-change for online DDL operations — doing so will cause the DTS task to fail.

Whether to Migrate Accounts Choose whether to migrate account information from the source database. If Yes, select which accounts to migrate and verify their permissions.
Retry Time for Failed Connections How long DTS retries after a connection failure. Range: 10–1,440 minutes. Default: 720. Set to at least 30 minutes. If DTS reconnects within this window, migration resumes; otherwise, the task fails. When multiple tasks share the same source or destination, the most recently set value applies.
Retry Time for Other Issues How long DTS retries after DDL or DML failures. Range: 1–1,440 minutes. Default: 10. Set to a value greater than 10 minutes. Must be less than Retry Time for Failed Connections.
Enable Throttling for Full Data Migration Limits DTS resource usage during full migration to reduce load on source and destination. Configure Queries per second (QPS) to the source database, RPS of Full Data Migration, and Data migration speed for full migration (MB/s). Only available when Full Data Migration is selected.
Enable Throttling for Incremental Data Migration Limits DTS resource usage during incremental migration. Configure RPS of Incremental Data Migration and Data migration speed for incremental migration (MB/s). Only available when Incremental Data Migration is selected.
Environment Tag (Optional) Tag the instance for environment identification.
Whether to delete SQL operations on heartbeat tables of forward and reverse tasks Controls whether DTS writes heartbeat table SQL to the source database. Yes: no writes to heartbeat tables (latency may appear in the DTS instance). No: writes to heartbeat tables (may affect features like physical backup and cloning of the source database).
Configure ETL Enables the extract, transform, and load (ETL) feature. Yes: enter data processing statements in the code editor. See Configure ETL in a data migration or data synchronization task. No: ETL is disabled. For an overview, see What is ETL?
Monitoring and Alerting Sends notifications when the task fails or migration latency exceeds a threshold. Yes: configure alert thresholds and notification settings. See Configure monitoring and alerting when you create a DTS task. No: alerting is disabled.

Click Next Step: Data Verification to configure data verification. For details, see Configure a data verification task.

Step 5: Run the precheck

Click Next: Save Task Settings and Precheck.

Note

To preview the API parameters for configuring this task programmatically, hover over Next: Save Task Settings and Precheck and click Preview OpenAPI parameters.

DTS runs a precheck before the migration starts. The task can only proceed after passing the precheck.

  • If a check item fails, click View Details next to it, resolve the issue, and run the precheck again.

  • If an alert is triggered for an item:

    • If the alert cannot be ignored, click View Details, fix the issue, and run the precheck again.

    • If the alert can be ignored, click Confirm Alert Details, click Ignore in the dialog box, confirm with OK, then click Precheck Again.

Warning

Ignoring alert items may result in data inconsistency. Proceed only when you're confident the risk is acceptable.

Step 6: Purchase and start the migration instance

  1. Wait until Success Rate reaches 100%, then click Next: Purchase Instance.

  2. On the Purchase Instance page, configure the following:

    Section Parameter Description
    New Instance Class Resource Group The resource group for the migration instance. Default: default resource group. See What is Resource Management?
    Instance Class Controls migration speed. Select based on your workload. See Instance classes of data migration instances.
  3. Select the Data Transmission Service (Pay-as-you-go) Service Terms check box.

  4. Click Buy and Start, then click OK in the confirmation dialog.

Verify the migration

On the Data Migration page, monitor the task progress.