This topic describes how to use OceanBase Migration Service (OMS) to migrate data from a DM database to an OceanBase database in MySQL-compatible mode (including physical data sources, public cloud data sources, and standalone data sources).
Background information
Dameng Database is a domestic relational database. You can create a data migration task in the OMS console to seamlessly migrate the existing business data and incremental data from a source Dameng database to an OceanBase Database in MySQL-compatible mode through schema migration, full migration, incremental synchronization, and reverse incremental migration.
In the OMS console, the data source type of Dameng Database is displayed as Dameng.
Schema migration: Migrates data object definitions such as table structures from a Dameng database to an OceanBase Database in MySQL-compatible mode. Supports migrating the
ON UPDATEattribute of columns (includingON UPDATEimplemented by triggers).Full migration: Migrates the existing data from a Dameng database to an OceanBase Database in MySQL-compatible mode.
Incremental synchronization: Synchronizes incremental change data from a Dameng database to an OceanBase Database in MySQL-compatible mode in real time.
Reverse incremental migration: After business switchover, flows back the change data generated in the target OceanBase Database in MySQL-compatible mode to the source Dameng database in real time.
Prerequisites
You have created the corresponding schema in the target OceanBase Database in MySQL-compatible mode.
You have created dedicated database users for the data migration task in both the source Dameng database and the target OceanBase Database in MySQL-compatible mode and granted them the relevant privileges. For more information, see Create a database user. For the privilege requirements of Dameng Database users in each migration scenario, see User privileges.
If the migration task involves reverse incremental migration, do not use the system users of Dameng Database (such as
SYSandSYSDBA) as the migration account. Otherwise, reverse incremental synchronization may fail.You have created a data source for Dameng Database and a data source for OceanBase Database in MySQL-compatible mode in OMS.
Archiving mode has been enabled for Dameng Database, and logical logs have been correctly configured.
If you need to perform incremental synchronization, ensure that the source has been configured as follows. If only schema migration or full migration is performed, you can skip the following configuration changes and restart operations.
Check the existing archiving configuration of the instance to confirm whether archiving is enabled and if there is an available archive destination.
SELECT ARCH_MODE FROM V$DATABASE; SELECT GROUP_NAME, ARCH_NAME, ARCH_DEST, ARCH_SPACE_LIMIT FROM V$DM_ARCH_INI ORDER BY GROUP_NAME;If
ARCH_MODEisYand the archive destination is writable, start from step 4 to verify the values of the following parameters; there is no need to re-enable archiving.Log in to Dameng Database as SYSDBA.
disql SYSDBA/<password>@<host>:<port>Configure a writable archive destination based on the deployment mode of the instance.
The archive destination configuration methods differ for standalone, DW (primary/standby clusters), and DSC (shared storage clusters). Specify the archive destination for the instance in
dmarch.iniand confirm that the target directory exists and is writable by the Dameng instance user. Complete this step before enablingARCH_INI; otherwise, archived data cannot be written out after archiving mode is enabled.Set the archive switch parameter
ARCH_INIto 1.SP_SET_PARA_VALUE(1, 'ARCH_INI', 1);Set the logical log parameter
RLOG_APPEND_LOGICto 2.SP_SET_PARA_VALUE(1, 'RLOG_APPEND_LOGIC', 2);Set the log recording scope parameter
RLOG_IGNORE_TABLE_SETto 1 to globally record logical logs.SP_SET_PARA_VALUE(1, 'RLOG_IGNORE_TABLE_SET', 1);Confirm that both the current architecture scope parameters
DPC_MODEandMPP_INIare set to 0. If the values do not match, this link is not supported.Restart the DM database instance to apply the
ARCH_INIparameter.Log in to the database again and switch it to the Mount state.
ALTER DATABASE MOUNT;Enable archive mode.
ALTER DATABASE ARCHIVELOG;Open the database.
ALTER DATABASE OPEN;Confirm that archive mode and log parameters are correctly configured.
SELECT ARCH_MODE FROM V$DATABASE; SELECT PARA_NAME, PARA_VALUE FROM V$DM_INI WHERE PARA_NAME IN ('ARCH_INI', 'RLOG_APPEND_LOGIC', 'RLOG_IGNORE_TABLE_SET', 'DPC_MODE', 'MPP_INI');If
ARCH_MODEisY,ARCH_INIis1,RLOG_APPEND_LOGICis2,RLOG_IGNORE_TABLE_SETis1, andDPC_MODEandMPP_INIare0, the configuration is correct.Confirm that archiving is actually writing and continuously generating archive files.
After performing a small number of changes at the source or switching log files, check if new archive files have been added to the archive destination directory and confirm that archiving continues to generate over time. Having
ARCH_MODEset toYandARCH_INIset to1alone does not indicate incremental collection is available; if archiving cannot write, incremental synchronization will still fail.The archive retention period must cover the time required for the incremental start point, task backlog, and failure recovery. For archive destination and retention requirements, see "Archive and log configuration for incremental synchronization" in User permissions.
Note
After configuring parameters, you must confirm that the required logs have actually been generated. Configuration changes cannot retrospectively record previously unlogged logical logs.
Clock synchronization (for example, by configuring the NTP service) is required between the machine hosting the DM database and the OMS machine. Otherwise, data risks may exist.
Limitations
The supported source database version is DM8.
Supported deployment modes for DM databases include standalone, DSC (Shared Storage Cluster), and DW (Primary-Secondary Cluster).
Incremental synchronization from a DM database to the MySQL-compatible mode of OceanBase Database supports only DML synchronization, not DDL synchronization. DDL changes occurring at the source during the incremental synchronization phase will not be synchronized to the target and must be manually handled by you.
The following table objects are not supported for incremental synchronization. Verify the table structure before selecting migration objects:
Tables with floating-point primary key columns (
FLOAT,DOUBLE, etc.). Precision is lost when the primary key is a floating-point data type after migration.Updates the partitioning key column in a partitioned table without a primary key at the source.
Updates the value of a non-unique cluster index at the source.
Reverse incremental migration does not support partitioned tables with the partitioning key excluded from column selection. When you need to reflow such tables, retain the partitioning key column in Select Columns on the Settings tab.
Data verification supports Row Count Verification and Full Verification, but does not support Incremental Validation.
Data verification supports the following table object types: regular tables, heap tables, partitioned tables, and columnstore tables. Tables without a non-null unique key are also supported for verification. Among these, heap tables without a unique or non-null constraint do not support Full Verification because the
rowidof such tables may change, making the verification results inaccurate. When selecting such a table as the verification object for Full Verification, a prompt is displayed on the page.Migration is not supported for
TEXTandLONGVARCHARfields larger than 512 MB.Limitations on operations in the source database
Do not perform DDL operations that modify database or table schemas during schema migration or full migration. Otherwise, the data migration task may be interrupted.
OMS does not support triggers (Triggers) at the target. If triggers exist, data migration may fail.
Data source identifiers and user accounts must be globally unique within the OMS system.
OMS only supports migrating objects whose database, table, and column names are in ASCII and do not contain special characters (including line breaks, spaces, and
.|"'`()=;/&\).If OceanBase Database is used as the source for incremental synchronization or as the destination for reverse incremental migration, and the database table objects contain UDT columns, the incremental synchronization task may fail due to unsupported UDT columns.
Considerations
If the source character set is UTF-8, it is recommended to use a character set compatible with the source at the destination (for example, UTF-8 or UTF-16) to avoid issues such as garbled text at the destination caused by character set incompatibility.
Verify whether the migration precision of column types such as DECIMAL, FLOAT, or DOUBLE in OMS meets your expectations. If the precision of the target field type is less than that of the source field type, truncation may occur, leading to data inconsistency between the source and destination.
If you modify a unique index at the destination, you need to restart the incremental synchronization component; otherwise, data inconsistency may occur.
Clock desynchronization between nodes, or between the client and the server, can cause inaccurate latency measurements (for incremental synchronization/reverse incremental migration).
For example, if a clock is ahead of standard time, the latency may appear negative. If a clock is behind standard time, it may cause a positive latency.
If forward switchover is not enabled for the data migration task, delete the unique indexes and pseudo-columns corresponding to the target database. Failing to delete these will prevent data writing and cause the re-generation of pseudo-columns during downstream data import, potentially conflicting with those in the source database.
If forward switchover is enabled for the data migration task, OMS automatically deletes hidden columns and unique indexes based on the task type. For details, see Hidden column mechanism description in data migration service.
In database/table consolidation scenarios:
It is recommended to use matching rules to map the relationship between the source and destination.
It is recommended to manually create the table structure at the destination. If you use OMS to create it, skip partially failed objects in the schema migration step.
If the table structures at the source and destination are not identical, data inconsistency may occur. Known scenarios include:
When manually creating a table structure, implicit conversion issues may arise outside OMS's support scope, leading to inconsistent column types between the source and destination.
If the data length at the destination is shorter than at the source, data truncation may occur, causing inconsistency between the source and destination data.
If table objects differing only in case exist at the source or destination, the data migration result may not meet expectations due to case-insensitivity at the source or destination.
If you configure only Incremental Synchronization when creating the data migration task, OMS requires that the source database's archived logs be retained for more than 48 hours.
If you configure both Full Migration and Incremental Synchronization when creating the data migration task, OMS requires that the source database's archived logs be retained for at least 7 days. Otherwise, the data migration task may fail or cause data inconsistency between the source and target databases due to the inability to obtain incremental logs.
Data type mappings
DM Database Type |
OceanBase Database MySQL Compatibility Mode Types |
|---|---|
| CHAR / CHARACTER | CHAR |
| VARCHAR / VARCHAR2 | VARCHAR |
| NVARCHAR / NVARCHAR2 | VARCHAR |
| TEXT / LONG / LONGVARCHAR | LONGTEXT |
| CLOB | LONGTEXT |
| BIT | TINYINT(1) |
| TINYINT | TINYINT |
| SMALLINT | SMALLINT |
| INT / INTEGER | INT |
| BIGINT | BIGINT |
| BYTE | TINYINT |
| NUMERIC / DECIMAL / DEC / NUMBER | DECIMAL (Not supported when the precision p is greater than 65, the scale s is greater than 30, or s is less than 0. For details, see the description after the table below.) |
| MONEY | DECIMAL |
| FLOAT / REAL | FLOAT |
| DOUBLE / DOUBLE PRECISION | DOUBLE |
| BINARY | BINARY |
| VARBINARY | VARBINARY |
| RAW | VARBINARY |
| IMAGE / LONGVARBINARY | LONGBLOB |
| BLOB | LONGBLOB |
| DATE | DATE |
| TIME | TIME (not supported when the decimal second precision is greater than 6) |
| DATETIME | DATETIME (not supported when the fractional second precision is greater than 6) |
| TIMESTAMP(p) | DATETIME(p) (not supported when the fractional second precision is greater than 6) |
| TIMESTAMP WITH TIME ZONE | Not supported |
Note
The data type mappings above refer to the official documentation of DM Database and the data type definitions in the MySQL-compatible mode of OceanBase Database. The actual mapping behavior is subject to OMS.
Notice
The following definition boundaries exist for the above mappings. Once exceeded, the structure conversion for the entire table will be marked as unsupported. OMS will not truncate that column and proceed with creating the table for the remaining columns:
DM
DECIMAL(p,s): Not supported whenpis greater than 65,sis greater than 30, orsis less than 0.DM
TIME,DATETIME,TIMESTAMP: Not supported when the fractional second precision is greater than 6.DM
TIMESTAMP WITH TIME ZONE: No available target type mapping, not supported.
Before selecting migration objects, verify the column definitions. Adjust incompatible definitions first, or exclude this table from the task.
Procedure
Create a data migration task.
Log in to the OMS console.
In the left-side navigation pane, click Data Migration.
On the Data Migration page, click Create Task in the upper-right corner.
On the Create Task page, customize the name of the migration task.
We recommend that you use a combination of Chinese characters, numbers, and letters. The name must not contain spaces and must not exceed 64 characters in length.
Notice
The task name is a unique identifier within the OMS system. Please choose a suitable name.
In the Select Source and Target step, configure the parameters.
ParameterDescriptionSource If you have created a DM database data source, select it from the Dameng group in the drop-down list. If not, click New Data Source in the drop-down list to create one in the dialog box on the right. Target If you have created an OceanBase Database data source in MySQL-compatible mode (including physical, public cloud, or standalone data sources), select it from the OceanBase MySQL Mode group in the drop-down list. If not, click New Data Source in the drop-down list to create one in the dialog box on the right. For details, see Create a physical data source, Create a public cloud data source, or Create a standalone data source. Tag (Optional) Click the text box and select a target tag from the drop-down list. You can also click Manage Tags to create, modify, or delete tags. For details, see Manage data migration tasks by using tags. Click Next. In the Select Migration Type step, select the migration type for the current data migration task.
The Migration Type includes Schema Migration, Full Migration, Incremental Synchronization, and Reverse Increment.
Migration TypeDescriptionSchema Migration After a schema migration task starts, OMS migrates the data object definitions from the source database to the target database and automatically filters temporary tables. The current link supports migrating object types of Tables (including definitions such as indexes, constraints, and comments on tables). OMS supports migrating the ON UPDATEattribute of columns in a DM database. IfON UPDATEis implemented via triggers at the source, OMS converts it into the column'sON UPDATEattribute in the converted target SQL.Full Migration After a full migration task starts, OMS migrates the existing data from the source database tables to the corresponding tables in the target database. Incremental Synchronization After an incremental synchronization task starts, OMS synchronizes the changed data (inserts, updates, or deletes) from the source database to the corresponding tables in the target database.
Incremental Synchronization supports DML synchronization by default, synchronizinginsert,update, anddelete. You can click Customize Synchronization Scope to select the DML types to synchronize. For details, see Configure custom DDL/DML synchronization. The current link does not support configuring DDL synchronization. When DDL changes occurring at the source during incremental synchronization need to be synchronized to the target, you must handle them manually.Reverse Increment After a reverse increment task starts, it can real-time flow back the changed data generated in the target database after the business switch to the source database. The DML synchronization configuration method for reverse increment is consistent with incremental synchronization.
Typically, reverse increment reuses the incremental synchronization configuration, but you can also customize it based on actual needs. The following situations do not support selecting Reverse Increment:- Multiple tables are involved in aggregation.
- There is a one-to-many schema mapping.
- When selecting a partitioned table, the partitioning key column was excluded from the column selection.
Click Next. In the Select Migration Objects step, select the objects to migrate for the current data migration task.
You can select migration objects through two approaches: Specify Objects and Match by Rule. This topic describes the specific operation for selecting migration objects using the Specify Objects method. For details on configuring matching rules, see Configure matching rules for migration or synchronization objects.
Notice
If a database name or table name contains the character "$$", it will affect the creation of the data migration task.
OMS automatically filters out unsupported objects. For the SQL statement to query objects, see Query database objects.
In the Select Migration Objects step, select Specify Objects.
Expand the source schema in the left list and select the objects you want to migrate. You can search for objects in the format
schema.tablein the search box.The current link structure migration only supports table objects. Therefore, only the Table category is displayed after expanding a schema.
Click > to add it to the selected objects list on the right.
OMS supports importing objects via text. You can also hover over a target object in the list on the right to perform operations such as renaming databases or tables, setting filter conditions, changing the database, and removing one or all migration objects.
Note
When you select migration objects by using the matching rule method, the renaming capability is overridden by the matching rule syntax, and only filter conditions can be set in the operation section. For more information, see Configure matching rules for migration or synchronization objects.
Note
The names of the operation buttons in the following table are based on the documentation in Oracle → OceanBase MySQL Mode. The actual button names for the DM link will be confirmed in the console.
OperationStepImport Objects - In the right-side list, click Import Objects in the upper-right corner.
- In the dialog box, click OK.
Note: The import will overwrite previous operation selections. Proceed with caution. - In the Import Migration Objects dialog box, import the objects to be migrated.
You can rename databases and tables, set row filter conditions, and perform other operations by importing a CSV file. For more information, see Download and import migration object configurations. - Click Validate.
- After passing the legality validation, click OK.
Rename OMS supports renaming migration objects. For more information, see Rename a database or table. Settings OMS supports configuring row filters and selecting columns to migrate. - In the right-side list, hover the mouse over the target object.
- Click the displayed Settings.
- In the Settings dialog box, you can perform the following operations.
- In the text box of the Row Filters section, enter a WHERE clause from a standard SQL statement to configure row filtering. For more information, see Filter data with SQL conditions.
- In the Select Columns section, select the columns to migrate. For more information, see Column filtering and column mapping.
Remove/Remove All OMS supports removing one or more temporarily selected objects to the target during data mapping. - Remove a single migration object
In the right-side list, hover the mouse over the target object and click the displayed Remove to remove that migration object. - Remove all migration objects
In the right-side list, click Remove All in the upper-right corner. In the dialog box, click OK to remove all migration objects.
Click Next. In the Migration Options step, configure the parameters.
Schema Migration
The following parameters are displayed only if you have selected Schema Migration in the Select Migration Type step.
ParameterDescriptionAutomatically proceed to the next stage upon completion When you select schema migration or any other migration type, you can configure whether to automatically proceed to the next stage after schema migration is completed. The default value is Yes. You can also view and modify this setting on the Schema Migration tab of the data migration task details page. Normal Index Migration Method Refers to the migration method for non-unique key indexes associated with table objects after migration. Valid values: Do Not Migrate, Migrate with Schema, and Post-Full-Migration (this option is displayed only when Full Migration is selected). Full Migration
The following parameters are displayed only if you have selected Full Migration in the Select Migration Type step.
ParameterDescriptionFull migration rate limit You can decide whether to enable the full migration rate limit based on your actual needs. If enabled, set the RPS (the maximum number of data rows that can be migrated to the target per second during the full migration phase) and BPS (the maximum amount of data that can be migrated to the target per second during the full migration phase). Note
The RPS and BPS set here are only for rate limiting. The actual achievable performance during full migration is limited by factors such as the source, target, and instance specifications.
Full migration resource configuration You can select the default read concurrency, write concurrency, and memory for Small, Medium, or Large. You can also choose Custom to configure the resources for full migration. By configuring the resources for the Full-Import component, you can limit the resource consumption of a task during the full migration phase. Notice
For custom configuration, the minimum value is 1, and only integers are supported.
Processing strategy when target table has records The processing strategies include Ignore and Stop Migration. The default is Stop Migration: - If Ignore is selected, when the target table contains data, if the original data conflicts with the data to be written, OMS logs the conflicting data and retains the original data unchanged.
- If Stop Migration is selected, when the target table contains data, an error is reported during full migration, indicating that migration is not allowed. You must handle the data in the target table before continuing the migration.
Notice
If you click Resume after an error occurs, OMS will ignore this configuration option and continue migrating table data. Proceed with caution.
Incremental Synchronization
The following parameters are displayed only if you have selected Incremental Synchronization in the Select Migration Type step.
ParameterDescriptionIncremental synchronization rate limit You can decide whether to enable the incremental synchronization rate limit based on your actual needs. If enabled, set the RPS (the maximum number of data rows that can be synchronized to the target per second during incremental synchronization) and BPS (the maximum amount of data that can be synchronized to the target per second during incremental synchronization). Note
The RPS and BPS set here are only for rate limiting. The actual achievable performance during incremental synchronization is limited by factors such as the source, target, and instance specifications.
Incremental log pull resource configuration You can select the default memory for Small, Medium, or Large. You can also choose Custom to configure the resources for incremental log pull. By configuring the resources for the Store component, you can limit the resource consumption for log pulling during the incremental synchronization phase. Notice
Only memory is supported for incremental log pull. Read concurrency and write concurrency are displayed as Not Supported. For custom configuration, the minimum value is 1, and only integers are supported.
Incremental data write resource configuration You can select the default write concurrency and memory for Small, Medium, or Large. You can also choose Custom to configure the resources for incremental data write. By configuring the resources for the Incr-Sync component, you can limit the resource consumption for data writing during the incremental synchronization phase. Notice
For custom configuration, the minimum value is 1, and only integers are supported.
Incremental record retention time The duration for which incremental parsed files are cached in OMS. The default is 120 hours. A longer configured retention time requires more disk space for the Store component. Incremental synchronization start timestamp - If Full Migration was selected as the migration type, this parameter is not displayed.
- If Full Migration was not selected but Incremental Synchronization was selected, please select a time or enter a second-level Timestamp here to specify to migrate data after a certain point in time. The default is the current system time. For details, see Set an incremental synchronization timestamp.
Reverse Incremental
The parameters in this section are displayed only if you have selected Reverse Increment in the Select Migration Type step. The configuration parameters for reverse incremental are the same as those for incremental synchronization. By default, the Reuse Incremental Synchronization Configuration option is selected in the upper-right corner. The incremental synchronization start timestamp for reverse incremental follows the forward switch and does not need to be configured.
Advanced Options
ParameterDescriptionAdd hidden columns for non-null unique key tables When migrating data from a DM database to an OceanBase database in MySQL-compatible mode, you need to configure whether to add hidden columns for non-null unique key tables. The default is Yes. For more information, see Data migration service hidden column mechanism description.
If you select No, for tables without a primary key or a non-null unique key, data duplication may occur due to task restarts or other exceptions. It is recommended to configure a non-null unique key for all tables.Target table object storage type This parameter is displayed only when the target OceanBase database in MySQL-compatible mode is V4.3.0 or later, and Schema Migration is selected in the Select Migration Type step.
The target table object storage types include Default, Row Storage, Column Storage, and Hybrid Row-Column Storage. This configuration determines the storage type for target table objects during schema migration. For more information, see default_table_store_format.Note
The Default option adapts to other options based on the target parameters, writing the corresponding schema for the migrated table objects according to the set storage type. The current link does not support incremental DDL; tables created at the source will not be automatically created by incremental DDL and require manual handling.
If the configuration parameters on the page do not meet your needs, you can click Parameter Configuration at the bottom of the page for more specific configuration. If you have configured task templates or component templates, you can also reference them here.
Click Precheck to have the system perform a precheck on the data migration task.
During the Precheck step, OMS checks whether the database user's read/write permissions, database network connectivity, and other requirements are met. The data migration task can only be started after all check items pass.
You can troubleshoot and resolve issues, then re-execute the precheck until it succeeds.
You can also click Skip in the Actions column for failed precheck items. A dialog box appears, explaining the specific impact of skipping this operation. After confirming you can skip, click OK in the dialog box.
Click Start Task. If you do not need to start the task immediately, click Save to go to the data migration task details page, where you can start it manually as needed.
You can click Configure Validation Task in the upper-right corner of the data migration details page to compare data differences between the source and target databases. This link supports Row Count Verification and Full Verification: Row count verification compares the record counts of the two tables, while full verification compares the content of the selected data. This link does not support Incremental Validation. Even if incremental synchronization is enabled for the migration task, only the first two verification types can be selected. For the scope of supported verification objects, see the "Limitations" section above. For more information, see Create a data verification task.
OMS supports modifying migration objects during the execution of a data migration task. For more information, see View and modify migration objects. After a data migration task is started, it is executed sequentially based on the selected migration type. For more information, see the "View migration details" section in View the details of a data migration task.