This topic uses full data migration between ApsaraDB RDS for MySQL instances as an example to describe how to configure a scheduling policy for regular full data migration.

Note All databases that support full data migration support the scheduling feature. For more information, see Database and migration types.

Prerequisites

The source and destination ApsaraDB RDS for MySQL instances reside in the China (Qingdao), China (Beijing), China (Zhangjiakou-Beijing Winter Olympics), China (Shenzhen), or China (Shanghai) region. The scheduling feature for regular full data migration is available only in these regions. For more information, see Create an ApsaraDB RDS for MySQL instance.

Background information

Scheduling is an advanced feature of data migration. You can configure a scheduling policy and scheduling cycle when you migrate schemas and historical data from the source database to the destination database on a regular basis. The scheduling feature allows you to flexibly build data warehouses. For more information, see Scheduling policies of regular data migration.

Precautions

The source database must have PRIMARY KEY or UNIQUE constraints and all fields must be unique. Otherwise, the destination database may contain duplicate data records.

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 the INVOKER 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.

Permissions required for database accounts

Database Schema migration Full data migration
Source RDS instance The read/write permissions The read/write permissions
Destination RDS instance The read/write permissions The read/write permissions
Note For more information about how to create and authorize a database account, see Create an account for an ApsaraDB RDS for MySQL instance.

Billing

Migration type Instance configuration 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.

Procedure

The procedure in this topic uses ApsaraDB RDS for MySQL instances that reside in the China (Qingdao) region as an example.

  1. Log on to the DTS console.
  2. In the left-side navigation pane, click Data Migration.
  3. At the top of the Migration Tasks page, select the China (Qingdao) region.
    Select the China (Qingdao) region
  4. In the upper-right corner of the page, click Create Migration Task.
  5. Configure the source and destination databases for the data migration task.
    Migrate data between ApsaraDB RDS for MySQL instances
    Section Parameter Description
    N/A Task Name DTS automatically generates a task name. We recommend that you specify an informative name for easy identification. You do not need to use a unique task name.
    Source Database Instance Type Select RDS Instance.
    Instance Region Select the region where the source RDS instance resides. In this example, select the China (Qingdao) region.
    Database Account Enter the database account of the source RDS instance. For more information about the permissions that are required for the account, see Permissions required for database accounts.
    Database Password Enter the password of the source database account.
    Note After you specify the source database parameters, click Test Connectivity next to Database Password to verify whether the parameters are valid. If the specified parameters are valid, the Passed message appears. If the Failed message appears, click Check next to Failed. Modify the source database parameters based on the check results.
    Encryption Select Non-encrypted or SSL-encrypted. If you want to select SSL-encrypted, you must enable SSL encryption for the RDS instance before you configure the data migration task. For more information, see Configure SSL encryption for an RDS MySQL instance.
    Note The Encryption parameter is available only for regions in mainland China and the Hong Kong (China) region.
    Destination Database Instance Type Select RDS Instance.
    Instance Region Select the region where the destination RDS instance resides. In this example, select the China (Qingdao) region.
    Database Account Enter the database account of the destination RDS instance. For more information about the permissions that are required for the account, see Permissions required for database accounts.
    Database Password Enter the password of the destination database account.
    Note After you specify the destination database parameters, click Test Connectivity next to Database Password to verify whether the specified parameters are valid. If the specified parameters are valid, the Passed message appears. If the Failed message appears, click Check next to Failed. Modify the destination database parameters based on the check results.
    Encryption Select Non-encrypted or SSL-encrypted. If you want to select SSL-encrypted, you must enable SSL encryption for the RDS instance before you configure the data migration task. For more information, see Configure SSL encryption for an RDS MySQL instance.
    Note The Encryption parameter is available only for regions in mainland China and the Hong Kong (China) region.
  6. In the lower-right corner of the page, click Set Whitelist and Next.
  7. Configure a scheduling policy and select the objects to be migrated.
    1. Configure a scheduling policy.
      Configure a scheduling policy
      Parameter Description
      Migration Types Select Schema Migration and Full Data Migration.
      Note Do not select Incremental Data Migration. Otherwise, the Enable Scheduling for Regular Full Data Migration switch is not displayed.
      Free experience of periodic full-scale scheduling function Turn on this switch to enable the scheduling feature.
      Scheduler strategy
      • Duplicate mode
      • Resynchronize mode
      • Based on the incremental mode of time stamp
      Note For more information about the scheduling policies, see Scheduling policies.
      Dispatch effective date Specify the start date and end date of the schedule. The maximum effective duration is 365 days.
      Scheduling cycle Select Hour, Day, or Week as the scheduling cycle and set the specific scheduled time.
      Note
      • During full data migration, DTS uses read and write resources of the source and destination databases. This may increase the database load. Before you start scheduling, evaluate the performance of the source and destination databases. We recommend that you set the scheduled time to off-peak hours.
      • After you complete the settings, click Task Failure Policy next to View Scheduled Scheduling Time to check whether the set scheduled time meets the expectation.
      Task Failure Policy Select one of the following policies based on your business requirements:
      • After a single task fails, subsequent scheduling tasks will note be executed
      • After a single task fails, igore the failure and execute the next scheduled task
    2. Select the objects to be migrated.
      Select the objects to be migrated
      Parameter Description
      Objects to be migrated

      Select objects from the Available section and click the Right arrow icon to move the objects to the Selected section.

      Note
      • You can select columns, tables, or databases as the objects to be migrated.
      • After an object is migrated to the destination instance, the name of the object remains unchanged. You can change the names of the objects that are migrated to the destination instance by using the object name mapping feature. For more information about how to use this feature, see Object name mapping.
      • If you use the object name mapping feature on an object, other objects that are dependent on the object may fail to be migrated.
    3. In the lower-right corner of the page, click Advanced Settings. On the page that appears, specify the timestamp field.
      Note This step is required only if you set Scheduling Policy to Timestamp-based Full Data Mode.
      Specify the timestamp field
  8. Click Precheck on the lower right of the page.
    Note
    • A precheck is performed for a data migration task. A data migration task can be started only if it passes the precheck.
    • If the precheck fails, click Note icon corresponding to each failed item to view the details. Fix the problems as instructed and run the precheck again.
  9. After the precheck is passed, click Next.
  10. On the Confirm Settings dialog box that appears, specify Channel Specification and select the Data Transmission Service (Pay-As-You-Go) Service Terms.
  11. Click Buy and Start. The migration task is started based on the specified scheduled time.
    Status of a scheduled migration task
    Note The migration task automatically stops at the end of the scheduled time. To stop the task before the end time of the schedule, click Stop Regular Full Data Migration.

Result

If a full data migration task is completed before the end of the current scheduled time, the task status changes to Completed. DTS waits for the next scheduled time and performs full data migration again.

Status of a scheduled migration task