Schema comparison

更新时间:
复制 MD 格式

Background information

The schema comparison feature in ODC enables you to analyze and compare the schemas of database objects. The objects must belong to the same project and be from the same type of data source. Based on the comparison, ODC can generate a change script.

This document describes how to submit a schema comparison ticket in ODC to compare the schemas of two database objects.

Notes

  • Supported links:

    • OceanBase MySQL to OceanBase MySQL.

    • OceanBase Oracle to OceanBase Oracle.

    • MySQL to MySQL.

  • You can only compare tables. The comparison covers columns, primary keys, constraints, indexes, partitions, and table properties.

    • For column properties, the comparison supports data types, character sets, collations, comments, and default values.

    • For partitions, only primary partitions are compared. Subpartitions are not compared.

    • For table properties, the comparison supports character sets, collations, and comments.

  • OceanBase MySQL does not support comparing CHECK constraints.

  • For OceanBase MySQL versions earlier than V1.4.79, you cannot compare partition properties without query permissions on the sys tenant.

  • If the generated SQL change script is larger than 1 MB, its content is not displayed in the SQL Preview tab. Instead, a message appears stating that the file exceeds the size limit. You can only view the full script by clicking Download SQL.

Procedure

image

  1. A user submits a schema comparison ticket.

  2. Approval task flow

  3. The schema comparison task runs, and the results are displayed.

  4. A database change task is created to synchronize the schemas.

New Structure Comparison

Example: Compare the schema of the employee table from two OceanBase MySQL data sources. Both data sources are in the odc_4.2.0 project.

Item

Example value

Project

odc_4.2.0

Source data source

mysql420

Target data source

mysql424

Source database name

odc_test

Target database name

testdb

Source table name

employee

  1. On the Tickets tab, click Schema Comparison > New Schema Comparison.

    image

  2. On the New Schema Comparison page, enter the following information.

    image

    Item

    Description

    Source database

    Select the source database.

    Target database

    Select the database to compare against.

    Comparison scope

    Select Partial Tables or All Tables.

    • Partial Tables: In the Comparison Objects section, select the tables to compare in the Select Source Tables window.

    • All Tables: Compares all table objects in the source and target databases.

    Task settings

    Automate Jobs.

    Description

    In the Task Description text box, enter a description of up to 200 characters. This field is optional.

  3. Click New to create a database change.

  4. After the task is created, you can find the task in the list under Tickets > Schema Comparison.

  5. In the Actions column, click View to view the task details.

  6. Click Initiate Schema Sync to create a database change task.

    image

View a schema comparison task

Task information

  1. In the schema comparison list on the Tickets tab, click View in the Actions column.

    image

  2. In the task details panel, click the Task Information tab to view basic information and settings for the task.

    image

  3. At the bottom right of the panel, click Initiate Schema Sync to create a database change task, Run Again to rerun the comparison, or Download SQL to download the SQL change script.

Task flow

In the task details panel, click the Task Flow tab. You can view the status of the task submission, approval, and execution, and view the final result.

image

Task logs

In the task details panel, click the Task Logs tab to view all logs and alert logs.

Item

Description

All Logs

The All Logs tab displays all information for the task, such as INFO, ERROR, and WARN logs.

Click Find, Download, or Copy to search, download, or copy the logs.

Alert Logs

The Alert Logs tab shows only ERROR and WARN logs. If a task fails, you can check the alert logs for error messages.

Click Find, Download, or Copy to search, download, or copy the alert logs.

image

References