Compute
Elastic Cloud Server
Huawei Cloud Flexus
Bare Metal Server
Auto Scaling
Image Management Service
Dedicated Host
FunctionGraph
Cloud Phone Host
Huawei Cloud EulerOS
Networking
Virtual Private Cloud
Elastic IP
Elastic Load Balance
NAT Gateway
Direct Connect
Virtual Private Network
VPC Endpoint
Cloud Connect
Enterprise Router
Enterprise Switch
Global Accelerator
Management & Governance
Cloud Eye
Identity and Access Management
Cloud Trace Service
Resource Formation Service
Tag Management Service
Log Tank Service
Config
OneAccess
Resource Access Manager
Simple Message Notification
Application Performance Management
Application Operations Management
Organizations
Optimization Advisor
IAM Identity Center
Cloud Operations Center
Resource Governance Center
Migration
Server Migration Service
Object Storage Migration Service
Cloud Data Migration
Migration Center
Cloud Ecosystem
KooGallery
Partner Center
User Support
My Account
Billing Center
Cost Center
Resource Center
Enterprise Management
Service Tickets
HUAWEI CLOUD (International) FAQs
ICP Filing
Support Plans
My Credentials
Customer Operation Capabilities
Partner Support Plans
Professional Services
Analytics
MapReduce Service
Data Lake Insight
CloudTable Service
Cloud Search Service
Data Lake Visualization
Data Ingestion Service
GaussDB(DWS)
DataArts Studio
Data Lake Factory
DataArts Lake Formation
IoT
IoT Device Access
Others
Product Pricing Details
System Permissions
Console Quick Start
Common FAQs
Instructions for Associating with a HUAWEI CLOUD Partner
Message Center
Security & Compliance
Security Technologies and Applications
Web Application Firewall
Host Security Service
Cloud Firewall
SecMaster
Anti-DDoS Service
Data Encryption Workshop
Database Security Service
Cloud Bastion Host
Data Security Center
Cloud Certificate Manager
Edge Security
Situation Awareness
Managed Threat Detection
Blockchain
Blockchain Service
Web3 Node Engine Service
Media Services
Media Processing Center
Video On Demand
Live
SparkRTC
MetaStudio
Storage
Object Storage Service
Elastic Volume Service
Cloud Backup and Recovery
Storage Disaster Recovery Service
Scalable File Service Turbo
Scalable File Service
Volume Backup Service
Cloud Server Backup Service
Data Express Service
Dedicated Distributed Storage Service
Containers
Cloud Container Engine
SoftWare Repository for Container
Application Service Mesh
Ubiquitous Cloud Native Service
Cloud Container Instance
Databases
Relational Database Service
Document Database Service
Data Admin Service
Data Replication Service
GeminiDB
GaussDB
Distributed Database Middleware
Database and Application Migration UGO
TaurusDB
Middleware
Distributed Cache Service
API Gateway
Distributed Message Service for Kafka
Distributed Message Service for RabbitMQ
Distributed Message Service for RocketMQ
Cloud Service Engine
Multi-Site High Availability Service
EventGrid
Dedicated Cloud
Dedicated Computing Cluster
Business Applications
Workspace
ROMA Connect
Message & SMS
Domain Name Service
Edge Data Center Management
Meeting
AI
Face Recognition Service
Graph Engine Service
Content Moderation
Image Recognition
Optical Character Recognition
ModelArts
ImageSearch
Conversational Bot Service
Speech Interaction Service
Huawei HiLens
Video Intelligent Analysis Service
Developer Tools
SDK Developer Guide
API Request Signing Guide
Terraform
Koo Command Line Interface
Content Delivery & Edge Computing
Content Delivery Network
Intelligent EdgeFabric
CloudPond
Intelligent EdgeCloud
Solutions
SAP Cloud
High Performance Computing
Developer Services
ServiceStage
CodeArts
CodeArts PerfTest
CodeArts Req
CodeArts Pipeline
CodeArts Build
CodeArts Deploy
CodeArts Artifact
CodeArts TestPlan
CodeArts Check
CodeArts Repo
Cloud Application Engine
MacroVerse aPaaS
KooMessage
KooPhone
KooDrive

Data Comparison (Comparing DR Items)

Updated on 2025-02-14 GMT+08:00

Comparison Scenarios

DR item comparison: You can compare DR items to check data consistency between the service database and DR database. Currently, you can compare the following items during DR:

  • Object-level comparison: compares databases, events, indexes, tables, views, stored procedures, functions, and triggers.
  • Data-level comparison is classified into row comparison and value comparison.
    • Row comparison: It helps you compare the number of rows in the tables to be synchronized. This comparison method is recommended because it is fast.
    • Value comparison: It helps you check whether data in the synchronized table is consistent. The comparison process is relatively slow.

    To ensure that the comparison results are valid, compare data during off-peak hours by select Start at a specified time or compare cold data that is infrequently modified.

  • Account comparison: It compares usernames and permissions of the source and destination databases.

When you check data consistency, compare the number of rows first. If the number of rows are inconsistent, you can then compare the data in the table to determine the inconsistent data.

Table 1 Supported comparison methods

DR Direction

Data Flow

Object-level Comparison

Row Comparison

Value Comparison

Dynamic Comparison

Account-level Comparison

Current cloud as standby

MySQL->MySQL

Supported

Supported

Supported

Supported

Supported

Current cloud as active

MySQL->MySQL

Supported

Supported

Supported

Supported

Supported

Current cloud as standby

MySQL->TaurusDB

Supported

Supported

Supported

Supported

Supported

Current cloud as standby

DDM -> DDM

Supported

Supported

Not supported

Not supported

Not supported

Current cloud as active

DDM -> DDM

Supported

Supported

Not supported

Not supported

Not supported

Current cloud as standby

TaurusDB->TaurusDB

Supported

Supported

Supported

Supported

Supported

Current cloud as active

TaurusDB->TaurusDB

Supported

Supported

Supported

Supported

Supported

Dual-Active DR

MySQL->MySQL

Supported

Supported

Supported

Not supported

Supported

Dual-Active DR

TaurusDB->TaurusDB

Supported

Supported

Supported

Not supported

Supported

Constraints

  • During a comparison, the comparison items are case sensitive. If one of the service or DR database is case insensitive and the other one is case sensitive, the comparison result may be inconsistent.
  • If DDL operations were performed on the service database, you need to compare the objects again to ensure the accuracy of the comparison results.
  • If data in the DR database is modified separately, the comparison results may be inconsistent.
  • If the encoding of the service database character type is abnormal, the database driver will convert the character type to an abnormal code point during DRS disaster recovery or comparison. As a result, the values may be consistent but the bytes may be inconsistent.
  • Currently, only tables with primary keys support value comparison. For tables that do not support value comparison, you can compare rows. Therefore, you can compare data by row or value based on scenarios.
  • The DRS task cannot be suspended during value comparison. Otherwise, the comparison task may fail.
  • Some data types do not support value comparison. For details, see Which of the Following Data Types Are Not Supported By Value 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 service database is a relational database, the row comparison duration is limited within 60 minutes. If the service database is a non-relational database, the row comparison duration is limited within 30 minutes.
  • To avoid occupying resources, the comparison results of DRS tasks can be retained for a maximum of 60 days. After 60 days, the comparison results are automatically cleared.
  • If you want to compare values and the DRS task you create supports value comparison, select a large specification for your DRS instance when creating the DRS task.
  • For a DR task from MySQL or TaurusDB, virtual columns in the source database do not support value comparison. During the comparison, virtual columns are filtered out.

Impact on Databases

  • Object comparison: System tables of the source and destination databases are queried, occupying about 10 sessions. The database is not affected. However, if there are a large number of objects (for example, hundreds of thousands of tables), the database may be overloaded.
  • Row comparison: The number of rows in the source and destination databases is queried, which occupies about 10 sessions. The SELECT COUNT statement does not affect the database. However, if a table contains a large amount of data (hundreds of millions of records), the database will be overloaded and the query results will be returned slowly.
  • Value comparison: All data in the source and destination databases is queried, and each field is compared. The query pressure on the database leads to high I/O. The query speed is limited by the I/O and network bandwidth of the source and destination databases. Value comparison occupies one or two CPUs, and about 10 sessions.
  • Account comparison: The accounts and permissions of the source and destination databases are queried, which does not affect the database.

Estimated Comparison Duration

  • Object comparison: Generally, the comparison results are returned within several minutes based on the query performance of the source database. If the amount of data is large, the comparison may take dozens of minutes.
  • Row comparison: The SELECT COUNT method is used. The query speed depends on the database performance.
  • Value comparison: If the database workload is not heavy and the network is normal, the comparison speed is about 5 MB/s.
  • Account comparison: The results are returned with the object-level comparison results. If the number of objects is small, the results are returned in several minutes.

Prerequisites

  • You have logged in to the DRS console.
  • A DR task has been started.

Procedure

  1. On the Disaster Recovery Management page, click the target DR task in the Task Name/ID column.
  2. On the Disaster Recovery Comparison tab, compare the service and DR databases.

    1. 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 1 Comparing objects

      Locate a comparison item you want to view and click View Details in the Operation column.

    2. After the check is complete, compare the number of rows and values.

      On the Data-Level Comparison tab, click Create Comparison Task. In the displayed dialog box, specify Comparison Method, Comparison Type, Comparison Time, and Object. Then, click OK.

      Figure 2 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.
        NOTE:
        • Currently, only MySQL and TaurusDB support the comparison mode.
        • New tables cannot be created in the service database during dynamic comparison. If you want to create a table in the service database, cancel the dynamic comparison first. After the new table is created and real-time DR is performed, restart the dynamic comparison.
      • 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.
      • Filter Data: After this function is enabled, objects can be compared based on the configured filtering criteria.
        NOTE:

        Only MySQL-to-MySQL DR tasks support data filtering and comparison.

        After enabling Filter Data, add filtering criteria for the table objects to be compared.

        In the Filtering Criteria area, enter the filtering criteria, and click Verify.
        NOTE:
        • Standard SQL statements can be used to filter records. Each expression cannot contain packages, functions, variables, or constants specific to a database engine.
        • Enter the part following WHERE in the SQL statement (excluding WHERE and semicolons), for example, sid > 3 and sname like "G %".
        • Implicit conversion rules are not supported. Enter filtering criteria of a valid data type. For example, if column c of an Oracle database uses characters of the varchar2 type, the filtering criteria must be set to c > '10' instead of c > 10.
        • Filter criteria cannot be configured for large objects, such as CLOB, BLOB, and BYTEA.
        • You are not advised to set filter criteria for fields of approximate numeric types, such as FLOAT, DECIMAL, and DOUBLE.
        • Do not use fields containing special characters as a filter condition.
        • Objects whose database names, schema names, or table names are case insensitive cannot be filtered and compared.
        • Currently, condition-based filtering is not supported when there are more than 50,000 tables in a database.

        After the verification is successful, click Generate Processing Rule. The rule is displayed.

        Click OK.

      • Object: You can select objects to be compared based on the scenarios.
      NOTE:
      • Data-level comparison cannot be performed for tasks in initialization.
    3. 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 3 Viewing the data-level comparison result
    4. 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 service and DR databases, and click View Details in the Operation column to view detailed comparison results.
      Figure 4 Row comparison details
      Figure 5 Value comparison details
      NOTE:
      • You can also view comparison details of canceled comparison tasks.
      • You can sort the row comparison results displayed on the current page in ascending or descending order based on the number of rows in the source database table or the destination database table.
      • If a negative number is displayed in the differences column, the number of rows in the destination database table is greater than that in the source database table. If a positive number is displayed in the differences column, the number of rows in the source database table is greater than that in the destination database table.
    5. Check the 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
      NOTE:
      • Account comparison cannot be performed for tasks in the initialization phase.

Data Repair (in OBT)

If there is inconsistent data in the static value comparison result, you can select the inconsistent tables on the comparison details page to repair the data. The data repair result includes repair SQL statements that can be executed in the destination database. After the repair, you can view the repair SQL details of the inconsistent rows on the repair progress details page. You can also export and download all the inconsistent SQL statements generated in this comparison, and manually execute the SQL statements in the destination database based on the site requirements. There are the following restrictions on data repair:

  1. This function is available only for whitelisted users. Currently, only data disaster recovery from MySQL to MySQL is supported.
  2. If a SQL statement to be repaired is an INSERT or UPDATE statement, all columns of the inconsistent row are displayed in the repair SQL details page. The column values are the current values of the corresponding columns in the source database.
  3. Historical comparison tasks may fail to be repaired due to lack of repair information. You need to perform comparison again and then repair the inconsistent data.
  4. For each task, only the repair progress details about the latest data repair are displayed.
  5. The maximum size of a single inconsistent row is 4 MB. If the size exceeds 4 MB, the corresponding repair SQL statements fail to be generated.
  6. In the repair SQL statements generated by DRS, the time type field is based on the UTC time. If there are time fields in a table, set the session time zone to UTC+0 time zone before executing the repair SQL statements in the destination database. The following table lists the SQL statements for setting the session time zone for each database type.
  7. Exercise caution when running DELETE statements in repair SQL statements.
Table 2 SQL statements for setting the session time zone to UTC+0 time zone for each database type

Database Type

Time Zone SQL

MYSQL

SET session time_zone='+00:00';

We use cookies to improve our site and your experience. By continuing to browse our site you accept our cookie policy. Find out more

Feedback

Feedback

Feedback

0/500

Selected Content

Submit selected content with the feedback