This topic describes how to use the task orchestration feature of Data Management Service (DMS) to regularly migrate historical data from an ApsaraDB RDS for MySQL database that uses the InnoDB engine to an ApsaraDB RDS for MySQL database that uses X-Engine. This is a cost-effective storage solution.
Prerequisites
- The source database is an ApsaraDB RDS for MySQL database that uses the InnoDB engine.
- The destination database is an ApsaraDB RDS for MySQL database that uses X-Engine. For information about how to create an ApsaraDB RDS for MySQL instance, see Create an ApsaraDB RDS for MySQL instance.
- Both the source and destination instances are in Secure Collaboration mode.
- Cross-database query is enabled for both the source and destination instances. For
information about how to enable this feature, see Modify an instance.
Note In this example, the database link of the source instance is dblink_src_rds, and that of the destination instance is dblink_target_rds.
Background information

You can use the task orchestration feature of DMS to automatically and regularly migrate historical data to a database that uses X-Engine. This helps reduce labor costs.
In this example, a task flow that consists of four tasks is created by using the task orchestration feature in DMS. The first task in the task flow creates a destination table in the ApsaraDB RDS for MySQL database that uses X-Engine. The second task backs up historical data in a source table, namely, data that has been stored in the source table for more than a month, to the destination table on a daily basis. The third task deletes the historical data in the source table. Then, the last task executes an OPTIMIZE TABLE statement to optimize the source table. This task flow is run at a specified time point every day. The source database only stores data that is generated over the last month. Large amounts of historical data are migrated to the destination database that uses X-Engine, which is more cost-effective.
Create a task flow
Create tasks
- Create a destination table: This task creates a destination table in the destination database. This table will be used to store historical data of the source table.
- Back up historical data: This task uses cross-database query to back up historical data from a source table in the source database to the destination table.
- Delete the historical data in the source table: After the historical data in the source table is backed up to the destination table, this task deletes the historical data in the source table.
- Optimize the source table: After the historical data in the source table is deleted, this task executes an OPTIMIZE TABLE statement to optimize the source table and save storage space.