All Products
Search
Document Center

Data Management:Database migration

Last Updated:Jan 03, 2024

Data Management (DMS) provides the database migration feature that allows you to encapsulate service solutions to migrate databases, perform checks, and delete the migrated source databases. This topic describes how to create a ticket to migrate a database.

Prerequisites

  • The following databases are used: ApsaraDB RDS for MySQL databases, PolarDB for MySQL, or self-managed MySQL databases on Elastic Compute Service (ECS) instances.

    Note

    The source and destination databases must be of the same type.

  • The source and destination databases are managed in Security Collaboration mode. For more information, see View the control mode of an instance.

  • The data writing process of the source database is stopped.

Background information

As your business grows, you may need to upgrade or downgrade your database configurations or migrate an entire database. To this end, DMS provides the database migration feature that allows homogeneous migration of schemas and data in various databases. You can use this feature to change the name of the destination database, precheck whether database migration requirements are met before migration, check whether the data in the source and destination databases is consistent after migration, and delete the migrated source database. This feature covers the whole process of database migration and facilitates multi-tenant management by SaaS vendors.

Benefits

A lot of data migration tools are available. However, most of these tools are used for O&M and you have no permission to manage processes. Compared with these data migration tools, the database migration feature of DMS provides the following benefits:

  • Integrates the security management capabilities of DMS, such as permission and process management.

  • Integrates the data migration feature of Data Transmission Service (DTS) to provide services with high performance and concurrency. For more information, see High performance.

  • Allows you to encapsulate service solutions to migrate databases, perform checks, and delete the migrated source databases. Then, you can update tenant routing configurations and collaborate linked services to enable seamless migration throughout the whole SaaS chain for applications.

Limits

  • Allows you to migrate all tables, but not specific tables, in a database.

  • Allows you to migrate full data, but not incremental data.

  • Allows you to migrate only tables.

Billing

You can use the database migration feature for free now.

Procedure

  1. Log on to the DMS console V5.0.
  2. In the top navigation bar, click Solution. In the left-side navigation pane, click Migrate Database.

    Note

    If you use the DMS console in simple mode, move the pointer over the 2022-10-21_15-25-22.png icon in the upper-left corner of the DMS console and choose All functions > Solution > Migrate Database.

  3. On the Create Database Migration Ticket page, set the parameters that are described in the following table.

    Parameter

    Description

    Task Name

    The name of the database migration task. We recommend that you specify an informative name that helps reduce unnecessary communication.

    Business Background

    The business background of the task.

    Stakeholder

    The stakeholder involved in the ticket approval process. You can specify multiple stakeholders.

    Source Instance

    The database instance in which the database that you want to migrate resides.

    Destination Instance

    The database instance to which you want to migrate the database.

    Note

    The source and destination database instances must be of the same type.

    Source Database

    The database that you want to migrate.

    Note
    • If you select multiple source databases, the owners of these source databases must be the same.

    • You must have the export and change permissions on the source database. For more information about how to apply for permissions, see Manage permissions.

    Destination Database

    By default, the name of the destination database is the same as that of the source database. You can click Edit to the right of the destination database to change its name.

    Migration Object

    The objects that you want to migrate. You can select multiple options. Valid values:

    • Schema Migration: migrates the schemas of the source database.

    • Full Data Migration: migrates the table data of the source database.

    Validate Consistency

    Specifies whether to check the data consistency in the source and destination databases after migration. Valid values:

    • Do Not Validate: DMS does not check the data consistency in the source and destination databases after migration.

    • Automatically Validate After Migration: DMS automatically starts to check the data consistency in the source and destination databases after migration.

      If you select Automatically Validate After Migration, the Parameter Configuration dialog box appears. In the dialog box, set the Maximum differences of a table and Upper limit of data validation in non-primary key tables parameters, and click OK.

    • Manually Trigger Operation: After the database is migrated, you can skip or immediately start the data consistency check.

    Deletion and Release

    Specifies whether to delete the migrated source database from the source database instance after migration.

    • Do Not Delete: does not delete the migrated source database from the source database instance after migration.

    • Manually Trigger Operation: After the data consistency check is complete, you can delete the migrated source database from the source database instance immediately or at a later point in time.

    • Automatically Delete After Migration: DMS automatically deletes the migrated source database from the source database instance after migration. This is highly risky and is not supported now.

  4. Click Submit application. DMS automatically performs a precheck.

    You can view the precheck results in the Precheck step. If the precheck fails, perform operations as prompted.

    • Source Database Permissions: You must have the export and change permissions on the source database. Otherwise, an error message is returned to prompt you to apply for the required permissions.

    • Destination Database Permissions:

      • If the destination database exists, you must have the change permissions on the destination database. Otherwise, an error message is returned to prompt you to apply for the required permissions.

      • If the destination database does not exist, you must submit the ticket as a DMS administrator, database administrator (DBA), or database instance owner. Otherwise, an error message is returned.

    • Access Permissions: DMS determines whether the AliyunDMSDefaultRole role is attached to your Alibaba Cloud account for subsequent migration. If this role is not attached to your Alibaba Cloud account, an error message is returned to prompt you to apply for the role.

    • Remaining Space of Destination Database Instance:

      • If the destination database instance is an ApsaraDB RDS for MySQL or a PolarDB for MySQL, DMS checks whether the available storage capacity of the destination database instance is sufficient for database migration.

      • If the destination database instance is a self-managed database on an ECS instance, an error message is returned to prompt you to check the available storage capacity of the destination database instance.

    • Objects with Same Name:

      • If you select Schema Migration, the destination database instance cannot contain databases with the same names as those in the source database.

      • If you select only Full Data Migration, the source and destination databases must have tables with the same names and the DDL statements for these tables must be the same. If the DDL statements for these tables are different, an error message is returned. If the tables with the same names contain historical data, a warning is returned.

    • Whitelists:

      • If the destination database instance is an ApsaraDB RDS for MySQL instance or a PolarDB for MySQL, DMS checks whether the IP address whitelists of the source and destination database instances contain a complete IP address whitelist for DTS. If the IP address whitelist for DTS is incomplete, the missing IP addresses are returned. You need to perform configurations as prompted.

      • If the destination database instance is a self-managed database on an ECS instance, all required IP addresses in the whitelist for DTS are returned.

  5. After the precheck is passed, click Submit for Approval.

  6. After the ticket is approved, click Start Now or Schedule.

    • Start Now: DMS immediately runs the database migration task.

    • Schedule: In the Setting dialog box, specify the date and point in time to run the database migration task.

    When the task is running, you can view the migration progress and migration logs in the Migrate Database step of the Execute wizard on the Ticket Details page.

  7. Optional:After the database is migrated, click Next Step to check data consistency.

    • Skip Validation: skips the data consistency check.

    • Start Now: In the Parameter Configuration dialog box, set the Maximum differences of a table and Upper limit of data validation in non-primary key tables parameters, and click OK.

    • Schedule: In the Setting dialog box, set the Maximum differences of a table and Upper limit of data validation in non-primary key tables parameters, specify the date and point in time for data consistency check, and then click OK.

    Note

    If inconsistent data exists, click View Details. In the Overview dialog box, click Details to view the inconsistent data.

    • If a small amount of data is inconsistent, modify the data.

    • If a large amount of data is inconsistent, make cause analysis, delete the destination database, and then migrate the database again.

  8. Optional:After the data consistency check is complete, click Next Step to delete the source database.

    • Complete: The database migration ticket is complete.

    • Delete Now: If you click Delete Now, the migrated tables are immediately deleted. Proceed with caution.

    • Delay Deletion: In the Delay Deletion dialog box, specify a time interval for data deletion. You can set the time interval to 1 to 30 days. If you need to restore data within the specified time interval, you can use the rollback feature to restore data in the source database.