Comparing Migration Items
This section describes how to compare migration items to check if there are any differences between source and destination databases. By comparing migration objects, you can determine the proper time for service migration to minimize the service downtime.
DRS supports object-level, account-level, and data-level comparisons.
- Object-level comparison: compares objects such as databases, indexes, tables, views, stored procedures, functions, and table sorting rules.
- Data-level comparison: compares rows and values of tables or collections.
- Full migration tasks do not support data-level comparisons.
- If DDL operations were performed on the source database, you need to compare the objects again to ensure the accuracy of the comparison results.
- Some data types do not support value comparison. For details, see Which Data Types Does Not Support Content Comparison?
- To prevent resources from being occupied for a long time, DRS limits the row comparison duration. If the row comparison duration exceeds the threshold, the row comparison task stops automatically. If the source database is a relational database, the row comparison duration is 60 minutes. If the source database is a non-relational database, for example, MongoDB, the row comparison duration is 30 minutes.
- Account comparison: compares the account names and permissions of the source and destination databases.
Table 1 Supported comparison mode Migration Direction
Data Flow
Object-level Comparison
Row Comparison
Value Comparison
Account-level Comparison
To the cloud
MySQL->MySQL
Yes
Yes
Yes
Yes
To the cloud
MySQL -> GaussDB(for MySQL) primary/standby
Yes
Yes
Yes
No
To the cloud
MySQL->DDM
Yes
Yes
No
No
To the cloud
MongoDB->DDS
Yes
Yes
Yes
Yes
To the cloud
MongoDB->GaussDB(for Mongo)
Yes
Yes
Yes
No
To the cloud
MySQL schema and logic table -> DDM
Yes
Yes
No
No
From the cloud
MySQL->MySQL
Yes
Yes
Yes
Yes
From the cloud
DDS->MongoDB
Yes
Yes
Yes
No
Prerequisites
- You have logged in to the DRS console.
- A migration task has been started.
Creating a comparison task
You can follow the comparison process or select a comparison method based on your service scenario. The following operations describe how to compare migration items by following the recommended migration process.
- On the Online Migration Management page, click the target migration task name in the Task Name/ID column.
- On the Migration Comparison tab, compare objects of the source and destination databases.
You can also select the migration task on the Online Migration Management page and click View to go to the Migration Comparison page.
- Check the integrity of the database object.
Click Validate Objects. On the Object-Level Comparison tab, click Compare. Wait for a while and click , and view the comparison result of each comparison item.Figure 2 Comparing objects
Locate a comparison item you want to view and click View Details in the Operation column.
- After the check is complete, compare the number of rows and values.
If you only need to compare the number of rows of all migration objects, you can select a specified migration task on the Online Migration Management page and click Compare in the Operation column to create a comparison task.
- In the Before You Start pane, click Validate All Rows/Values.
- In the displayed Create Comparison Task dialog box, specify Comparison Type, Comparison Method, Comparison Time, and Object. Then, click OK.
Figure 3 Creating a comparison task
- Comparison Type: compares rows and values.
- Comparison Method: DRS provides static and dynamic comparison methods.
- Static: All data in the source and destination databases is compared. The comparison task ends as the comparison is completed. Static comparison can only be performed when there are no ongoing services.
- Dynamic: All data in the source database is compared with that in the destination database. After the comparison task is complete, incremental data in the source and destination databases is compared in real time. A dynamic comparison can be performed when data is changing.
The comparison mode can only be changed for MySQL.
- Comparison Time: You can select Start upon task creation or Start at a specified time. There is a slight difference in time between the source and destination databases during synchronization. Data inconsistency may occur. You are advised to compare migration items during off-peak hours for more accurate results.
- Object: You can select objects to be compared based on the scenarios.
- Before the value comparison, the system will help you evaluate the time required for value comparison.
- When you select an object, the spaces before and after the object name are not displayed. If there are multiple spaces in the middle of the object name, only one space is displayed.
After the comparison creation task is submitted, the Data-Level Comparison tab is displayed. Click to refresh the list and view the comparison result of the specified comparison type.
Figure 4 Viewing the data-level comparison result
To view the comparison details, locate the target comparison type and click View Results in the Operation column. On the displayed page, locate a pair of source and destination databases, and click View Details in the Operation column to view detailed comparison results.
Figure 5 Viewing comparison details
You can cancel a running task at any time and view the comparison report of a canceled comparison task.
- Compare database accounts and permissions. Click the Account-Level Comparison tab to view the comparison results of database accounts and permissions.
Figure 6 Account-level comparison
- Full migration tasks do not support account-level comparisons.
- Perform a double check before the cutover.
In the Before You Start pane, click Double Check During Cutover. In the displayed Create Comparison Task dialog box, specify Comparison Type, Comparison Time, and Object. Then, click OK.
For details about how to view comparison details, see 2.b.
- Stop the migration task.
After the service system is successfully migrated to the destination database, stop the migration task to prevent operations in the source database from being synchronized to the destination database to overwrite the data. This operation only deletes the replication instance, and the migration task is still in the task list. You can view or delete the task. DRS will not charge for this task after you stop it.
Generally, stopping a task can ensure the integrity of special objects because triggers and events are migrated when a task is being stopped. Only in some cases, such as network disconnections, a task may fail to be stopped. If a task fails to be stopped multiple times, you can select Forcibly stop task to reduce the waiting time. If you forcibly stop a task, triggers and events may not be completely migrated and you need to manually migrate them.
- Check the integrity of the database object.
Quick Comparison
To accelerate and simplify the migration process, DRS provides the quick comparison function. You can directly perform a comparison on the migration task list. This function can be used to compare all migration objects only when incremental migration tasks are in progress.
- On the Online Migration Management page, locate the target migration task and click Compare in the Operation column.
- On the Create Comparison Task page, select Start upon task creation or Start at a specified time and click Yes to start the comparison task.
Viewing a Comparison Task
- On the Online Migration Management page, locate the target migration task and click View in the Operation column.
- On the Migration Comparison tab, view the data comparison result.
Feedback
Was this page helpful?
Provide feedbackThank you very much for your feedback. We will continue working to improve the documentation.