This topic describes how to migrate data from an ApsaraDB RDS for MySQL database to a user-created MySQL database by using Data Transmission Service (DTS). This is applicable to scenarios such as data analysis and functional test.
Prerequisites
- The tables to be migrated from the ApsaraDB RDS for MySQL database contain primary keys or UNIQUE NOT NULL indexes.
- The available storage space of the user-created MySQL database is greater than the total size of the data in the ApsaraDB RDS for MySQL database.
- The version of the user-created MySQL database is the same as that of the ApsaraDB RDS for MySQL database. This ensures compatibility.
Background information
- 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%.
- If your ApsaraDB RDS for MySQL database does not have primary key or unique constraints and each field in the database has duplicate values, the data migrated to the destination database may be duplicated.
- Concurrent insertions are performed during full data migration. This results in table fragmentation in the destination instance. After a full data migration task is completed, the tablespace of the destination instance is larger than that of the source instance.
- If a data migration task fails, DTS attempts to resume the task. In this case, before you switch your workloads to the destination database, you must stop or release the task. Otherwise, the data in the source database will overwrite the data in the destination database after the task is resumed.
Limits
- DTS supports schema migration of the following objects: tables, views, triggers, stored
procedures, and stored functions.
Note During schema migration, the
DEFINER
mode of views, stored procedures, and stored functions is shifted to theINVOKER
mode. - The information of the source database account cannot be migrated. If you need to use views, stored procedures, and stored functions, you must grant read and write permissions to the destination database account.
Migration types
DTS supports schema migration, full data migration, and incremental data migration.
For more information, see Terms.
Note You can use these three migration types together to migrate data without service interruptions.
Billing
Migration type | Migration channel fee | Public network traffic fee |
---|---|---|
Schema migration or full data migration | Free of charge | Migrating data from Alibaba Cloud over the Internet incurs fees. For more information, see Pricing. |
Incremental data migration | Billed. For more information, see Pricing. |
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 | Permission |
---|---|
ApsaraDB RDS for MySQL database | The read permission for the objects to be migrated |
User-created MySQL database | The read/write permissions for the objects to be migrated |
For more information about how to create and authorize a database account, see the following topics: