This topic describes how to migrate data from an ApsaraDB RDS for MariaDB TX instance to an ApsaraDB RDS for MySQL instance by using Data Transmission Service (DTS). DTS supports schema migration, full data migration, and incremental data migration. When you migrate data from an ApsaraDB RDS for MariaDB TX instance to an ApsaraDB RDS for MySQL instance, you can select all of the supported migration types to ensure service continuity.
Prerequisites
Precautions
- DTS uses read and write resources of the source and destination databases during full data migration. This may increase the database load. If the database performance is unfavorable, the specification is low, or the data volume is large, database services may become unavailable. For example, DTS occupies a large amount of read and write resources in the following cases: a large number of slow SQL queries are performed on the source database, the tables have no primary keys, or a deadlock occurs in the destination database. Before you migrate data, evaluate the performance of the source and destination databases. We recommend that you migrate data during off-peak hours. For example, you can migrate data when the CPU usage of the source and destination databases is less than 30%.
- The source database must have PRIMARY KEY or UNIQUE constraints and all fields must be unique. Otherwise, duplicate data may exist in the destination database.
- DTS automatically resumes a failed data migration task. Before you switch your workloads to the destination instance, stop or release the data migration task. Otherwise, the data in the source instance will overwrite the data in the destination instance after the task is resumed.
Billing
Migration type | Instance configurations | Internet traffic |
---|---|---|
Schema migration and full data migration | Free of charge. | Charged only when data is migrated from Alibaba Cloud over the Internet. For more information, see Pricing. |
Incremental data migration | Charged. For more information, see Pricing. |
Migration types
- Schema migration
DTS migrates the schemas of the required objects to the destination instance. DTS supports schema migration for the following types of object: table, view, trigger, stored procedure, and function. DTS does not support schema migration for events.
Note- During schema migration, DTS changes the value of the SECURITY attribute from DEFINER to INVOKER for views, stored procedures, and functions.
- DTS does not migrate user information. Before a user can call views, stored procedures, and functions of the destination instance, you must grant the read/write permissions to the user.
- Full data migration
DTS migrates historical data of the required objects to the destination instance.Note
- During full data migration, concurrent INSERT operations cause segments in the tables of the destination instance. After full data migration is completed, the tablespace of the destination instance is larger than that of the source instance.
- To ensure successful data migration, do not perform DDL operations on the source instance during full data migration.
- Incremental data migration
After full migration is completed, DTS retrieves binary log files from the source instance, and migrates incremental data to the destination instance in real time.
SQL operations that can be synchronized during incremental data migration
Operation type | SQL statements |
---|---|
DML | INSERT, UPDATE, DELETE, and REPLACE |
DDL |
|
Permissions required for database accounts
Database | Schema migration | Full data migration | Incremental data migration |
---|---|---|---|
Source ApsaraDB RDS for MariaDB TX instance | The SELECT permission | The SELECT permission | The REPLICATION SLAVE permission, the REPLICATION CLIENT permission, the SHOW VIEW permission, and the permission to perform SELECT operations on the required objects |
Destination ApsaraDB RDS for MySQL instance | The read/write permissions | The read/write permissions | The read/write permissions |
For information about how to create and authorize a database account, see the following topics:
Procedure
Stop the migration task
- Full data migration
Do not manually stop a task during full data migration. Otherwise, the system may fail to migrate all data. Wait until the migration task automatically ends.
- Incremental data migration
The task does not automatically end during incremental data migration. You must manually stop the migration task.
- Wait until the task progress bar shows Incremental Data Migration and The migration task is not delayed. Then, stop writing data to the source database for a few minutes. In some cases, the progress bar shows the delay time of incremental data migration.
- After the status of incremental data migration changes to The migration task is not delayed, manually stop the migration task.