All Products
Search
Document Center

Schema synchronization

Last Updated: Jun 28, 2020

The schema synchronization feature is provided by Data Management Service (DMS). It allows you to compare schemas of two databases, generate scripts for synchronizing data from the source database to the destination database, and run these scripts against the destination database. This topic describes how to use the schema synchronization feature.

Prerequisites

The schema synchronization feature only supports three database types: MySQL, ApsaraDB for OceanBase V0.5, and ApsaraDB for OceanBase V1.0.

Precautions

The schema synchronization feature allows you to synchronize some or all of the tables from a database, regardless of whether the database is a physical or logical database.

Scenarios

The schema synchronization feature is used for schema comparison and database synchronization across multiple environments, for example:

  • Databases respectively deployed in the production and test environments.
  • Databases deployed in the test environment.
  • Databases deployed in the production environment.

Procedure

  1. Log on to the DMS console.

  2. In the top navigation bar, choose Schemas > Table Sync > Schema Synchronization.Schema Synchronization1

  3. On the Table/Database Synchronization Application page, set relevant parameters.

    Parameter Description
    Source Database The name of the source database. You must have the read permission on the source database.
    Target Database The name of the destination database. You must have the write permission on the destination database.
    Synchronized Table The tables that you want to synchronize. Valid values:
    • Partial Tables: You can specify the source and destination tables that you want to synchronize. If you do not specify the names of destination tables, the system will assume that the destination table names are the same as the corresponding source table names.
    • All Tables
    Whether to Ignore Error
    • Not Ignore: If an error occurs when data is synchronized in the serial mode, the system will immediately stop running the current SQL script and the remaining SQL scripts.
    • Ignore: If an error occur when the system is running an SQL script, the system will stop running the current SQL script and continue to run the next script until all remaining SQL scripts are run.

    1. Click Submit. The system begins to conduct schema analysis.

    2. Check the results of schema analysis.

      If the schema of a table is changed, click Re-analyze in the ticket.

    3. Check the scripts for synchronizing data from the source database to the destination database. If the scripts are correct, click Submit. Data will be synchronized to the destination database immediately.