Data Management (DMS) provides the empty database initialization feature. You can use this feature to synchronize the schemas of the source database to an empty database that contains no table. This way, schemas can be synchronized between databases with ease. You can use this feature to synchronize the schemas of databases that are deployed across multiple regions and units.
- Database instances are registered with DMS. For more information, see Register an ApsaraDB instance.
- One or more of the following databases are used:
- MySQL series: self-managed MySQL, ApsaraDB RDS for MySQL, PolarDB for MySQL, PolarDB-X, AnalyticDB for MySQL, and ApsaraDB OceanBase for MySQL
- SQL Server series: self-managed SQL Server and ApsaraDB RDS for SQL Server
- PostgreSQL series: self-managed PostgreSQL, ApsaraDB RDS for PostgreSQL, PolarDB for PostgreSQL, and AnalyticDB for PostgreSQL
- The security rule named Enable execution capability (if closed, other rules are invalid) is enabled for the destination database. For more information about this rule, see
Enable SQL-based synchronization.
Note If this rule is disabled, the schema synchronization feature can only compare the schemas of two different databases but cannot execute SQL statements to synchronize the schemas.
- The destination database is an empty database that contains no table.
Note If the destination database contains tables, you can use the schema synchronization feature. For more information, see Synchronize schemas.
- Log on to the DMS console.
- In the top navigation bar, move the pointer over the More icon and choose .
- On the Table/Database Synchronization Application tab, set the parameters that are described in the following table.
Parameter Description Source Database The name of the source database for empty database initialization. After you select the source database, specify the schema version number of the database. The version number is optional. By default, the latest schema is used. For more information about the schema version number, see Manage schema versions.Note You must have the read permissions on the source database. For more information, see View owned permissions. Target Database The name of the destination database for empty database initialization.Note You must have the write permissions on the destination database. For more information, see View owned permissions. Initialized Table The one or more tables that you want to use for empty database initialization. Valid values:
- Partial Tables
- All Tables
Whether to Ignore Error Specifies whether to skip errors when SQL statements are being executed. Valid values:
- Not Ignore: If an error occurs when SQL statements are being executed, DMS stops executing the current and subsequent SQL statements for initializing the empty database.
- Ignore: If an error occurs when SQL statements are being executed, DMS skips the error and continues to execute subsequent SQL statements until all remaining statements are executed.
Business Background(Remarks) The business background of the project, such as the purpose or objective of the project.
- Click Submit.DMS starts to analyze the schemas.Note If the schemas are changed during schema analysis, click Re-analyze in the Schema Analysis step.
- Click Submit for Approval and wait for approval.
- Click Submit and Synchronize to Target Database.
- Check the SQL statements to be executed and click Confirm Synchronization.After you click Confirm Synchronization, DMS starts to execute the SQL statements to synchronize schemas. You can click Details to view the operations logs that contain detailed information such as the SQL statements, execution duration, and scheduling details.