All Products
Search
Document Center

Data Transmission Service:Migrate data from RDS MySQL to ApsaraDB for SelectDB

Last Updated:Mar 28, 2026

Data Transmission Service (DTS) migrates MySQL data to ApsaraDB for SelectDB with support for schema migration, full data migration, and incremental data migration. This topic walks through the setup using an ApsaraDB RDS for MySQL instance as the source.

Prerequisites

Before you begin, make sure you have:

Migration types

Choose one of the following migration type combinations based on your requirements:

Migration type combinationUse caseDowntime
Schema migration + Full data migrationOne-time bulk migration where writes to the source can be pausedRequired during cutover
Schema migration + Full data migration + Incremental data migrationZero-downtime migration with continuous replication until cutoverNone
Important
  • When migrating from MySQL to SelectDB, DTS converts data types. If you do not select Schema Migration, create Unique or Duplicate model tables with the correct structure in SelectDB manually before starting. See Data type mapping, Additional columns, and Data Model.

Required permissions

Minimum permissions by migration type

DatabaseSchema migrationFull data migrationIncremental data migration
Source (ApsaraDB RDS for MySQL)SELECTSELECTRead/write
Destination (ApsaraDB for SelectDB)Usage_priv, Select_priv, Load_priv, Alter_priv, Create_priv, Drop_privSameSame
If the source database account was not created through the RDS MySQL console, it must also have the REPLICATION CLIENT, REPLICATION SLAVE, SHOW VIEW, and SELECT privileges.

Grant permissions

Billing

Migration typeLink configuration feeData transfer
Schema migration + full data migrationFreeFree (unless Access Method is set to Public IP Address)
Incremental data migrationBilledSee Billing overview

Supported SQL operations for incremental migration

Operation typeSupported statements
DMLINSERT, UPDATE, DELETE
DDLADD COLUMN, MODIFY COLUMN, CHANGE COLUMN, DROP COLUMN, DROP TABLE, TRUNCATE TABLE, RENAME TABLE
Important

RENAME TABLE may cause data inconsistency. If a table is renamed during migration, its data may not be migrated to the destination. To prevent this, select the entire database (not just the table) as the migration object, and make sure both the pre-rename and post-rename databases are included in the migration objects.

Binary log requirements

For incremental migration, configure the following binary log parameters on the source database before starting the task:

ParameterRequired valueNotes
Binary loggingEnabledThe precheck fails if binary logging is disabled
binlog_formatrowThe precheck fails if set to a different value
binlog_row_imagefullThe precheck fails if set to a different value
log_slave_updatesEnabledRequired only for dual-primary self-managed MySQL clusters

Binary log retention:

Source typeMinimum retentionRecommended
ApsaraDB RDS for MySQL3 days7 days
Self-managed MySQL7 days7 days

Retention periods shorter than the minimum may cause DTS to fail because it cannot retrieve binary logs. In extreme cases, this can lead to data inconsistency or data loss. Issues caused by insufficient retention are not covered by the DTS Service-Level Agreement (SLA).

To set the Retention Period for binary logs on an RDS for MySQL instance, see Automatically delete binary logs.

Limitations

Source database

  • Bandwidth: The server hosting the source database must have sufficient outbound bandwidth. Low bandwidth reduces migration speed.

  • Table requirements:

    • Tables with primary keys or UNIQUE constraints: make sure table fields are unique to avoid duplicate data at the destination.

    • Tables without primary keys or UNIQUE constraints: select Schema Migration for Migration Types and set Engine to duplicate in the Configurations for Databases, Tables, and Columns step. Otherwise, the data migration instance may fail or data loss may occur. > Note: During schema migration, DTS adds fields to the destination table. See Additional columns.

  • Table-level migration limit: A single data migration task supports up to 1,000 tables when migrating at the table level with object edits (such as name mapping). If you exceed this limit, split the tables into multiple tasks or migrate the entire database.

  • DDL during migration: Do not perform DDL operations that change the schema during schema migration or full data migration. DTS queries the source database during full migration, which creates a metadata lock that may block DDL operations.

  • Full migration only: If you run only full data migration without incremental migration, do not write new data to the source during migration. For real-time data consistency, use schema migration, full data migration, and incremental data migration together.

  • Operations not captured in binary logs: Data changes from physical backup recovery and cascade operations are not migrated. If this occurs, run a full data migration again when your schedule allows.

  • Invisible columns (MySQL 8.0.23+): Data in invisible columns cannot be retrieved, which may cause data loss. Run ALTER TABLE <table_name> ALTER COLUMN <column_name> SET VISIBLE; to make invisible columns visible before migration. See Invisible Columns.

Destination database

  • Supported engines: You can migrate data only to tables that use the Unique or Duplicate engine in SelectDB.

    Destination table uses the Unique engine

    Make sure all unique keys in the destination table also exist in the source table and are included in the migration objects. Otherwise, data inconsistency may occur.

    Destination table uses the Duplicate engine

    Duplicate data may appear in the destination database in these cases: Use the additional columns (_is_deleted, _version, _record_id) to identify and remove duplicate rows. See Additional columns.

    • The data migration instance was retried or restarted.

    • Two or more DML operations were performed on the same record before migration completed.

      Note

      DTS converts UPDATE and DELETE statements into INSERT statements when the destination table uses the Duplicate engine.

  • Unsupported objects: INDEX, PARTITION, VIEW, PROCEDURE, FUNCTION, TRIGGER, and FK objects cannot be migrated.

  • `bucket_count` parameter: In the Selected Objects box, you can set only the bucket_count parameter (number of buckets). The value must be a positive integer. The default is auto.

  • No new clusters during migration: Do not create a new cluster in the destination SelectDB instance during migration. Restart the data migration instance to recover a failed task.

  • Naming requirements: Database and table names in SelectDB must start with a letter. Use the mapping feature to rename any object that does not meet this requirement.

  • Chinese characters in names: If a migration object name (database, table, or column) contains Chinese characters, use the mapping feature to rename it to English. Otherwise, the task may fail.

  • DDL limitations:

    • DDL operations that modify multiple columns at once cannot be migrated.

    • DDL operations that continuously modify the same table cannot be migrated.

  • No backend nodes during migration: Do not add backend (BE) nodes to the SelectDB instance during migration. Restart the data migration instance to recover a failed task.

  • Multi-table merge: When migrating data from multiple source tables into a single destination table, the source tables must have the same schema. Otherwise, data inconsistency or task failure may occur.

  • VARCHAR length difference: In MySQL, VARCHAR(M) specifies the character length. In SelectDB, VARCHAR(N) specifies the byte length. If you create the destination table manually without schema migration, set the VARCHAR field length in SelectDB to four times the corresponding length in MySQL.

  • Online DDL tools:

    • DMS or gh-ost: DTS migrates only the original DDL statements to the destination without migrating temporary table data. This may cause locked tables at the destination.

    • pt-online-schema-change: Online DDL changes from this tool cannot be migrated. If such changes exist on the source, data loss or task failure may occur at the destination.

  • Migration timing: Run data migration during off-peak hours. Full data migration reads from the source and writes to the destination concurrently, which increases database workloads.

  • Tablespace after full migration: Full data migration executes INSERT operations concurrently, causing table fragmentation at the destination. The destination tablespace will be larger than the source after full migration.

  • Encryption:

    • Always-encrypted (EncDB): full data migration is not supported.

    • Transparent Data Encryption (TDE): schema migration, full data migration, and incremental data migration are all supported.

  • Incremental migration latency: DTS uses a batch synchronization policy for incremental migration. For a single migration object, DTS writes data at most once every 5 seconds by default, resulting in a normal synchronization latency within 10 seconds. To reduce this latency, adjust the selectdb.reservoir.timeout.milliseconds parameter (range: 1,000–10,000 milliseconds) for the data migration instance in the DTS console.

    A shorter batching time increases DTS write frequency, which may increase write load and response time (RT) at the destination, in turn increasing synchronization latency. Adjust based on the destination's current load.
  • Instance recovery: If the data migration instance fails, the DTS helpdesk will attempt recovery within 8 hours. During recovery, the instance may be restarted or its parameters adjusted.

Special cases

Self-managed MySQL as the source:

  • A primary/secondary switchover during migration causes the task to fail.

  • DTS calculates latency by comparing the timestamp of the last migrated record with the current time. If no DML operations occur on the source for an extended period, the latency display may be inaccurate. Perform a DML operation on the source to refresh the latency. Alternatively, create a heartbeat table — DTS updates it every second.

  • DTS periodically runs CREATE DATABASE IF NOT EXISTS \test\`` on the source to advance the binary log offset.

  • For Amazon Aurora MySQL or other clustered MySQL instances, make sure the domain name or IP address configured for the task always resolves to the read/write (RW) node.

ApsaraDB RDS for MySQL as the source:

  • RDS for MySQL instances that do not record transaction logs — such as read-only instances of RDS for MySQL 5.6 — cannot be used as the source for incremental data migration.

  • DTS periodically runs CREATE DATABASE IF NOT EXISTS \test\`` on the source to advance the binary log offset.

Create a migration task

Step 1: Go to the Data Migration page

Use one of the following consoles:

DTS console

  1. Log on to the DTS console.DTS console

  2. In the left-side navigation pane, click Data Migration.

  3. In the upper-left corner, select the region where the data migration instance resides.

DMS console

Note

The actual steps may vary based on the DMS console mode and layout. See Simple mode and Customize the layout and style of the DMS console.

  1. Log on to the DMS console.DMS console

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

  3. From the drop-down list to the right of Data Migration Tasks, select the region where the data migration instance resides.

Step 2: Configure source and destination databases

  1. Click Create Task.

  2. Configure the source database:

    ParameterValue
    Task NameEnter a descriptive name. Task names do not need to be unique.
    Select Existing ConnectionSelect a registered instance, or configure the connection manually.
    Database TypeSelect MySQL.
    Access MethodSelect Alibaba Cloud Instance.
    Instance RegionSelect the region of the source RDS for MySQL instance.
    Replicate Data Across Alibaba Cloud AccountsSelect No for a migration within the same account.
    RDS Instance IDSelect the source RDS for MySQL instance.
    Database AccountEnter the database account. See Required permissions.
    Database PasswordEnter the account password.
    EncryptionSelect Non-encrypted or SSL-encrypted. To use SSL encryption, enable SSL for the RDS for MySQL instance before configuring this task.
  3. Configure the destination database:

    ParameterValue
    Select Existing ConnectionSelect a registered instance, or configure the connection manually.
    Database TypeSelect SelectDB.
    Access MethodSelect Alibaba Cloud Instance.
    Instance RegionSelect the region of the destination SelectDB instance.
    Replicate Data Across Alibaba Cloud AccountsSelect No for a migration within the same account.
    Instance IDSelect the destination SelectDB instance.
    Database AccountEnter the database account. See Required permissions.
    Database PasswordEnter the account password.
  4. Click Test Connectivity and Proceed.

    Make sure the DTS server CIDR blocks are added to the security settings (whitelist) of the source and destination databases. See Add DTS server IP addresses to a whitelist. For self-managed databases, click Test Connectivity in the CIDR Blocks of DTS Servers dialog box.

Step 3: Configure migration objects

  1. On the Configure Objects page, set the following:

    If you do not select Incremental Data Migration, do not write new data to the source instance during migration.
    ParameterDescription
    Migration TypesSelect one of the following combinations: Schema Migration + Full Data Migration for a one-time full migration; or Schema Migration + Full Data Migration + Incremental Data Migration for zero-downtime migration.
    Processing Mode of Conflicting TablesPrecheck and Report Errors: reports an error and stops the task if a table with the same name exists in the destination. Ignore Errors and Proceed: skips the duplicate-table check. Use with caution — this may cause data inconsistency or migration failure if table schemas differ.
    Capitalization of Object Names in Destination InstanceSpecifies how database, table, and column names are capitalized at the destination. The default is DTS default policy. See Specify the capitalization of object names in the destination instance.
    Source ObjectsSelect the objects to migrate. Click 向右小箭头 to add them to Selected Objects.
    Selected ObjectsTo rename an object at the destination, right-click it in Selected Objects. See Schema, table, and column name mapping. To set the bucket_count parameter, right-click the table in Selected Objects, enable Parameter Settings, enter the value, and click OK. To filter rows, right-click the table and set a WHERE condition. See Set filter conditions.
  2. Click Next: Advanced Settings and configure the following:

    ParameterDescription
    Dedicated Cluster for Task SchedulingDTS schedules to the shared cluster by default. For higher stability, purchase a dedicated cluster. See What is a DTS dedicated cluster.
    Retry Time for Failed ConnectionsHow long DTS retries after a connection failure. Range: 10–1,440 minutes. Default: 720 minutes. Set to more than 30 minutes.
    Retry Time for Other IssuesHow long DTS retries after DDL or DML failures. Range: 1–1,440 minutes. Default: 10 minutes. Set to more than 10 minutes. Must be less than Retry Time for Failed Connections.
    Enable Throttling for Full Data MigrationLimits the QPS, RPS, and data transfer speed for full migration to reduce source and destination load. Available only when Full Data Migration is selected.
    Enable Throttling for Incremental Data MigrationLimits the RPS and data transfer speed for incremental migration. Available only when Incremental Data Migration is selected.
    Environment TagOptional. Tag the instance for organizational purposes.
    Whether to delete SQL operations on heartbeat tables of forward and reverse tasksYesalert notification settings: DTS does not write heartbeat table operations to the source. A latency offset may appear for the data migration instance. No: DTS writes heartbeat operations to the source. Features like physical backup and cloning may be affected.
    Configure ETLYes: enables extract, transform, and load (ETL). Enter data processing statements in the code editor. See Configure ETL in a data migration or data synchronization task. No: disables ETL.
    Monitoring and AlertingYes: configure alert thresholds and notification contacts. See Configure monitoring and alerting. No: no alerting.
  3. (Optional) Click Next: Configure Database and Table Fields to set the Primary Key Column, Distribution Key, and Engine for destination tables.

    This step is available only when Schema Migration is selected. Set Definition Status to All to edit all tables. The Primary Key Column can be a composite key — select one or more columns as the Distribution Key. For tables without a primary key or UNIQUE constraint, set Engine to duplicate.

Step 4: Run the precheck

Click Next: Save Task Settings and Precheck.

To preview the API parameters for this configuration, hover over the button and click Preview OpenAPI parameters.

DTS runs a precheck before starting the data migration task. After the precheck completes:

  • If an item fails, click View Details, resolve the issue, and click Precheck Again.

  • If an item triggers an alert:

    • For alerts that cannot be ignored: click View Details, resolve the issue, and rerun the precheck.

    • For alerts that can be ignored: click Confirm Alert Details, then Ignore, then OK, and then Precheck Again. Ignoring alerts may result in data inconsistency.

Step 5: Purchase and start the instance

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

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

    ParameterDescription
    Resource GroupThe resource group for the data migration instance. Default: default resource group. See What is Resource Management?
    Instance ClassSelect the instance class based on your required migration speed. See Instance classes of data migration instances.
  3. Read and agree to Data Transmission Service (Pay-as-you-go) Service Terms.

  4. Click Buy and Start, then click OK.

After the task starts, monitor its progress on the Data Migration page:

  • Tasks without incremental migration stop automatically when full migration completes. The status shows Completed.

  • Tasks with incremental migration run continuously. The status shows Running.

Data type mapping

DTS converts MySQL data types to the corresponding SelectDB types during schema migration. Review the mapping table to identify any types that require special handling.

CategoryMySQL data typeSelectDB data typeNotes
IntegerTINYINTTINYINT
TINYINT UNSIGNEDSMALLINT
SMALLINTSMALLINT
SMALLINT UNSIGNEDINT
MEDIUMINTINT
MEDIUMINT UNSIGNEDBIGINT
INTINT
INT UNSIGNEDBIGINT
BIGINTBIGINT
BIGINT UNSIGNEDLARGEINT
BIT(M)INT
DecimalDECIMALDECIMALThe zerofill attribute is not supported
NUMERICDECIMAL
FLOATFLOAT
DOUBLEDOUBLE
BOOL / BOOLEANBOOLEAN
Date and timeDATEDATEV2
DATETIME[(fsp)]DATETIMEV2
TIMESTAMP[(fsp)]DATETIMEV2
TIME[(fsp)]VARCHAR
YEAR[(4)]INT
StringCHAR / VARCHARVARCHARTo prevent data loss, data of the CHAR and VARCHAR(n) types is converted to VARCHAR(4*n) after being migrated to SelectDB. If no length is specified, defaults to VARCHAR(65533). If the length exceeds 65533, the type is converted to STRING.
BINARY / VARBINARYSTRING
TINYTEXT / TEXT / MEDIUMTEXT / LONGTEXTSTRING
TINYBLOB / BLOB / MEDIUMBLOB / LONGBLOBSTRING
ENUMSTRING
SETSTRING
JSONSTRING

Additional columns

For destination tables that use the Duplicate engine, DTS automatically adds the following columns. Use these columns to identify and remove duplicate rows.

ColumnData typeDefaultDescription
_is_deletedINT0Insert: 0; Update: 0; Delete: 1
_versionBIGINT0Full migration: 0; Incremental migration: binary log timestamp (seconds)
_record_idBIGINT0Full migration: 0; Incremental migration: unique incremental log record ID (unique and incremental)