This topic describes how to use OceanBase Migration Service (OMS) to migrate data from an OceanBase database in Oracle compatible mode (including physical data sources, public cloud data sources, and standalone data sources) to an Oracle database.
Background information
You can create a data migration task in the OMS console to seamlessly migrate existing business data and incremental data from an OceanBase database in Oracle compatible mode to an Oracle database through schema migration, full migration, and incremental synchronization.
OMS supports aggregating table data from multiple OceanBase databases in Oracle compatible mode into a single table in an Oracle database. This aggregation does not require schema migration; only full migration and incremental synchronization are needed. The usage limitations for this aggregation and synchronization feature are as follows:
For full migration and incremental synchronization, the target must have all columns that the source has. If this requirement is not met, OMS will report an error.
Primary key columns must exist in the source table.
The target table can have columns that do not exist in the source table.
Prerequisites
You have created the corresponding schema in the target Oracle database.
You have created dedicated database users for the data migration task in both the source OceanBase database in Oracle compatible mode and the target Oracle database, and granted them the necessary privileges. For details, see Create a database user.
If you need to migrate tables without primary keys, create the
__OCEANBASE_INNER_DRC_USERuser in the corresponding tenant and grant it the required privileges before running the data migration task. For details, see Create the __OCEANBASE_INNER_DRC_USER user.
Limitations
Limitations on 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.
Currently, Oracle Database 10G, 11G, 12C, 18C, and 19C are supported. Versions 12C and later include Container Database (CDB) and Pluggable Database (PDB).
Incremental data migration is not supported for tables where all columns are of LOB type (BLOB/CLOB/NCLOB) or GIS type.
Migrating non-template secondary partitioned tables from OceanBase Database in Oracle compatible mode to an Oracle database is not supported.
Only multi-table aggregation for tables with primary keys is supported.
OMS currently does not support expression-based indexes.
OMS does not support triggers in the target database. If triggers exist, data migration may fail.
OMS does not support primary keys containing the FLOAT or DOUBLE data types.
Data source identifiers and user accounts must be globally unique within the OMS system.
Oracle Database 11G and earlier versions do not support creating database objects exceeding 30 bytes. Note that when migrating data from OceanBase Database in Oracle compatible mode to an Oracle database, you cannot create database objects larger than this limit at the source.
OMS only supports migrating objects whose database, table, and column names are ASCII-compliant and do not contain special characters (including line breaks, spaces, and
.|"'`()=;/&\).OMS does not support using an OceanBase standby database as the source.
Considerations
For the reverse incremental scenario from OceanBase Database in Oracle compatible mode to an Oracle database, note the following issues:
When the target Oracle database is in single-standby or primary-standby mode, if the number of running instances on the primary and standby Oracle databases differs, it may result in missing incremental logs for some instances. You need to manually set parameters for the Store component to specify which instances' incremental logs should be fetched when pulling from the standby database. The procedure is as follows:
Stop the Store component immediately after starting it.
On the Update Configuration page of the Store component, add the parameter
deliver2store.logminer.instance_threadsto specify which instances' logs to fetch.Separate multiple threads with |. For example, 1|2|3. For details on updating the component, see Loss of archive logs during incremental synchronization from an Oracle standby database using OMS.
After setting the parameters, restart the Store component.
Five minutes later, run
grep 'log entries from' connector/connector.logto view which instances' logs were fetched (the thread field indicates which instance's logs were fetched).
When performing incremental synchronization from an Oracle database, it is recommended that the size of a single Oracle database archive file be less than 2 GB. A single archive file that is too large poses the following risks:
The larger a single archive file, the more non-linear the increase in fetching time.
When the target Oracle database is in single-standby or primary-standby mode, incremental data is pulled from the standby database, which can only fetch archive files. Archive files can only be fetched after they are generated. A larger archive file means a longer delay before processing and also takes longer to process.
The larger a single archive file, the more memory the Store component requires when pulling with the same concurrency.
Oracle database archive files must be retained for more than 2 days. Otherwise, if the amount of archiving suddenly increases during a period or if the Oracle Store encounters an exception, there will be no archive files available for recovery, making recovery impossible.
Oracle database incremental log parsing supports up to 5 TB/day.
For the reverse incremental steps from OceanBase Database in Oracle compatible mode to Oracle Database 12c or later, OMS does not support migrating database objects exceeding 30 bytes (including schemas, tables, and columns). If you need to migrate database objects larger than 30 bytes, see How to migrate Oracle database objects larger than 30 bytes.
OMS does not support certain
UPDATEcommands executed in Oracle databases. The following example shows an unsupportedUPDATEcommand.UPDATE TABLE_NAME SET KEY=KEY+1;In the example above,
TABLE_NAMEis the table name, andKEYis the NUMERIC type column defined as the primary key.For tables without a primary key and containing LOB-type fields, data quality issues may occur during reverse incremental synchronization.
For OceanBase Database V4.x, it is strongly recommended to enable archive logging. After enabling archive logging, if clogs are recycled, OMS can still achieve incremental synchronization by consuming archive logs. For details on enabling archive logging, see Archive logging documentation.
If the source character set is UTF-8, it is recommended to use a character set compatible with the source at the target (for example, UTF-8, UTF-16, etc.) to avoid issues such as garbled characters at the target due to character set incompatibility.
Clock desynchronization between nodes, or between the client terminal and the server, can lead to inaccurate latency measurements (during incremental synchronization/reverse incremental synchronization).
For example, if a clock is earlier than standard time, the latency may be negative. If a clock is later than standard time, there may be a delay.
For different scenarios supporting Oracle character sets and OceanBase Database in Oracle compatible mode, field length strategies are selected based on the specific details of the data migration task.
When migrating tables without a primary key, hidden columns are added at the target for migration. However, if the target is a version earlier than Oracle 12c, non-hidden columns are added at the target for migration.
If you are using an OceanBase Database version earlier than V2.2.30, OMS does not support migrating tables without primary keys.
A table with a primary key is a table that has a
pkand anot null uk, and does not contain afunction-based uk.If the source database version is earlier than 2.2.77 (excluding 2.2.77), or if the source table contains a
function-based ukon a virtual column, OMS may misidentify whether the table has afunction-based uk. This can lead to inaccurate determination of tables with primary keys, resulting in slower full migration and full verification speeds, and a risk of data inconsistency during incremental synchronization.If the source table contains a field named
OMS_PK_INCRMT, the jdbc-connector will exit during DML operations on this table during incremental synchronization, causing the incremental synchronization task to interrupt and become unrecoverable.In a data migration task from OceanBase Database in Oracle compatible mode to an Oracle database, if the OceanBase Database in Oracle compatible mode is a version earlier than V3.2.x and the table is a multi-partitioned table with a globally unique index, updating the value of the table's partitioning key may cause data loss during migration.
If DDL synchronization is not enabled, you need to restart the incremental synchronization component if you modify a unique index at the target side. Otherwise, data inconsistency may occur.
If forward switchover is not enabled for the data migration task, delete the corresponding unique indexes and pseudo columns in the target database. Failing to delete them will prevent data writing and, when importing data downstream, will cause the pseudo columns to be regenerated, potentially conflicting with those in the source database.
If forward switchover is enabled for the data migration task, OMS will automatically delete hidden columns and unique indexes based on the type of data migration task. For details, see Data migration service hidden column mechanism description.
In database and table consolidation scenarios:
It is recommended that you use matching rules to map the relationship between the source and target.
It is recommended that you create the table structure at the target manually. If you use OMS to create it, skip partially failed objects in the schema migration step.
Check the objects in the OceanBase Database in Oracle compatible mode recycle bin. When the number of objects exceeds 100, internal table queries may time out. Please clean up objects in the recycle bin.
Check if the recycle bin is enabled.
SELECT Value FROM V$parameter WHERE Name = 'recyclebin';Check the number of objects in the recycle bin.
SELECT count(*) FROM RECYCLEBIN;
If you skip the "Source-Primary Database-Database ROW_MOVEMENT Check" pre-check item during migration and synchronize tables with
ROW_MOVEMENTset toenable, data inconsistency may occur.In a data migration task where the source is an OceanBase database and DDL synchronization is enabled, if a rename (RENAME) operation occurs on a table at the source, it is recommended that you restart the task to avoid data loss during incremental synchronization.
If you configure only Incremental Synchronization when creating the data migration task, OMS requires the source database's archive logs to be retained for more than 48 hours.
If you configure Full Migration + Incremental Synchronization when creating the data migration task, OMS requires the source database's archive logs to be retained for at least 7 days. Otherwise, the data migration task may fail due to inability to obtain incremental logs, potentially leading to data inconsistency between the source and target.
If table objects differing only in case exist at the source or target, the data migration result may not meet expectations due to case-insensitivity at the source or target.
If you perform incremental synchronization with an OceanBase database as the source, or reverse incremental synchronization with an OceanBase database as the target, and the database table objects contain UDT columns, the incremental synchronization task may fail due to unsupported UDT columns.
Data type mappings
Oracle compatible mode of OceanBase Database |
Oracle Database |
|---|---|
| CHAR(n CHAR) | CHAR(n CHAR) |
| CHAR(n BYTE) | CHAR(n BYTE) |
| NCHAR(n) | NCHAR(n) |
| NCHAR(n BYTE) | NCHAR(n) |
| VARCHAR2(n) | VARCHAR2(n) |
| NVARCHAR2(n) | NVARCHAR2(n) |
| NVARCHAR2(n BYTE) | NVARCHAR2(n) |
| NUMBER(n) | NUMBER(n) |
| NUMBER(p, s) | NUMBER(p,s) |
| RAW | RAW |
| CLOB | CLOB |
| BLOB | BLOB |
| FLOAT(n) | FLOAT (n) |
| BINARY_FLOAT | BINARY_FLOAT |
| BINARY_DOUBLE | BINARY_DOUBLE |
| DATE | DATE |
| TIMESTAMP | TIMESTAMP |
| TIMESTAMP WITH TIME ZONE | TIMESTAMP WITH TIME ZONE |
| TIMESTAMP WITH LOCAL TIME ZONE | TIMESTAMP WITH LOCAL TIME ZONE |
| INTERVAL YEAR(p) TO MONTH | INTERVAL YEAR(p) TO MONTH |
| INTERVAL DAY(p) TO SECOND | INTERVAL DAY(p) TO SECOND |
| ROWID | ROWID
NoticeOnly OceanBase Database in Oracle compatible mode 2.2.70 and later versions are supported. |
| UROWID | UROWID
NoticeOnly OceanBase Database in Oracle compatible mode 2.2.70 and later versions are supported. |
| SDO_GEOMETRY | SDO_GEOMETRY |
| XML | XML |
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.
Note
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 an OceanBase database data source in Oracle compatible mode (including physical, public cloud, or standalone data sources), select one from the drop-down list. If not, click New Data Source in the list to create one. For details, see Create a physical OceanBase data source, Create a public cloud OceanBase data source, or Create a standalone OceanBase data source. Target If you have created an Oracle data source, select one from the drop-down list. If not, click New Data Source in the list to create one. For details, see Create an Oracle data source.
You can select an Oracle data source of the primary database only or the primary/standby database type. A single standby database Oracle data source cannot be used as the target for data migration. This topic uses the primary/standby database type as an example.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, set One-Way Synchronization for Synchronization Topology.
OMS supports One-Way Synchronization and Two-Way Synchronization. This topic describes how to perform one-way synchronization. For more information about two-way synchronization, see Configure a two-way synchronization task.
In the Migration Options section, select the migration type for the current data migration task.
Migration Type includes Schema Migration, Full Migration, Incremental Synchronization, and Reverse Increment.
Migration TypeDescriptionSchema Migration After a schema migration task starts, OMS migrates data object definitions (tables, indexes, constraints, comments, views, etc.) from the source database to the target database and automatically filters out temporary tables. Full Migration After a full migration task starts, OMS migrates the existing data of tables from the source database to the corresponding tables in the target database. If you select Full Migration, we recommend that you collect statistics from the OceanBase database in Oracle compatible mode before migrating data. For more information, see Manually collect statistics. Incremental Synchronization After an incremental synchronization task starts, OMS synchronizes changed data (inserts, modifications, or deletions) from the source database to the corresponding tables in the target database.
Incremental Synchronization includes DML synchronization and DDL synchronization. You can configure them according to your needs. For more information, see Configure DDL/DML synchronization. The usage limitations for Incremental Synchronization are as follows:- When the character set encoding of the source and target databases is inconsistent, OMS does not support changes to table structure columns.
- If you select DDL synchronization, there is a risk of data migration interruption if a DDL operation occurs at the source database that is not supported by OMS for synchronization. If the DDL operation is to add a column, it is recommended that you set the column's attribute to Null, as this also carries the risk of data migration interruption.
Reverse Increment After a reverse increment task starts, it can continuously flow back the changed data generated in the target database after a business switchover to the source database in real time.
Typically, reverse increment reuses the configuration of incremental synchronization, but you can also customize it based on actual requirements. The following situations do not support selecting Reverse Increment:- Multiple tables are involved in data aggregation.
- There is a one-to-many mapping of schemas.
(Optional) Click Next.
If you select Schema Migration or Incremental Synchronization, but the corresponding parameters are not configured for the source OceanBase Database data source in Oracle compatible mode, the Add Data Source Information dialog box appears, prompting you to configure the parameters. For parameter details, see Create an OceanBase physical data source, Create an OceanBase public cloud data source, or Create an OceanBase standalone data source.
After completing the supplementary configuration, click Test connectivity. After the connection test succeeds, click Save.
Click Next. In the Select Migration Objects step, select the objects that need to be migrated for the current data migration task.
You can select migration objects through two options: Specify Objects and Match by Rule. This topic describes how to select migration objects by specifying them. For details on configuring matching rules, see Configure matching rules.
Note
If a database or table name contains the character "$$", it will affect the creation of the data migration task.
If you have selected DDL Synchronization in the Select Migration Type step, it is recommended to use matching rules to select migration objects to ensure all newly added objects that meet the migration object rules are synchronized. If you select objects by specifying them, newly added or renamed objects will not be synchronized.
OMS automatically filters out unsupported objects. For SQL statements used to query objects, see Query database objects.
In the Select Migration Objects step, select Specify Objects.
In the Source Object(s) list, select the objects that need to be migrated. You can select tables or views from one or more databases as migration objects.
Click > to add them to the Target Object list.
OMS supports importing objects via text and allows operations such as renaming target objects, setting row filters, selecting partitions and columns, and removing individual or all migration objects.
Note
When selecting migration objects using the Matching Rules method, the renaming capability is overridden by the matching rule syntax, and only filtering conditions can be set at the operation site. For details, see Configure matching rules.
OperationStepImport Objects - In the Target Object list, click Import Objects in the upper-right corner.
- In the dialog box, click OK.
Note: The import overwrites previous operation selections. Proceed with caution. - In the Import Migration Objects dialog box, import the objects that need to be migrated.
You can rename databases and tables, set row filter conditions, and perform other operations by importing CSV files. For details, see Download and import migration object configurations. - Click Validate.
- After passing the legality validation, click OK.
Rename OMS supports renaming migration objects. For details, see Rename a database or table. Settings OMS supports configuring row filters, selecting partitions, and specifying columns to migrate. - In the right-side list of the selection area, 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 standard SQL WHERE clause to configure row filtering. For details, see Filter data with SQL conditions.
- In the drop-down list of the Partition section, select the specified partition data you need to obtain during the full migration phase. After selection, click OK.
- In the Select Columns section, select the columns to migrate. For details, see Column filtering.
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 Target Object list, hover the mouse over the target object and click the displayed Remove to remove that migration object. - Remove all migration objects
In the Target Object list, click Remove All in the upper-right corner. In the dialog box, click OK to remove all migration objects.
Change Schema OMS supports changing the schema of target database tables during data migration. Select the objects whose schemas need to be changed in the selected area, click Change Schema below, enter the target schema name in the pop-up window, and click OK. After configuration, you can view the actual migration effect in the selected area. Click Next. In the Migration Options step, configure the parameters.
Schema migration
The following parameters are displayed only if you have selected One-way Synchronization > Schema Migration in the Select Migration Type step.
ParameterDescriptionAutomatically Proceed to Next Stage Upon Completion When you select schema migration along with any other migration type, you can set 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 Specifies how non-unique key indexes associated with a table object are migrated after the table object is migrated. 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 One-way Synchronization > 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 subject to factors such as the source, target, and instance specifications.
Full Migration Resource Configuration You can choose the default read concurrency, write concurrency, and memory for Small, Medium, or Large. You can also customize the resource configuration for full migration. By configuring resources for the Full-Import component, you can limit the resource consumption of a task during the full migration phase. Notice
For custom configurations, the minimum value is 1, and only integers are supported.
Handling Strategy When Target Table Has Records The handling strategies include Ignore and Stop Migration: - If you select Ignore, when the target table has data and the original data conflicts with the data to be written, OMS logs the conflicting data and retains the original data unchanged.
- If you select Stop Migration, when the target table has data, full migration will report an error indicating that migration is not allowed. You must handle the data in the target table before continuing 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 One-way Synchronization > 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 subject to factors such as the source, target, and instance specifications.
Incremental Log Pull Resource Configuration You can choose the default memory for Small, Medium, or Large. You can also customize the resource configuration for incremental log pull. By configuring resources for the Store component, you can limit the resource consumption for log pulling during the incremental synchronization phase of a task. Notice
For custom configurations, the minimum value is 1, and only integers are supported.
Incremental Data Write Resource Configuration You can choose the default write concurrency and memory for Small, Medium, or Large. You can also customize the resource configuration for incremental data write. By configuring resources for the Incr-Sync component, you can limit the resource consumption for data writing during the incremental synchronization phase of a task. Notice
For custom configurations, 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. 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, specify a point in time after which data should be migrated. The default is the current system time. For details, see Set an incremental synchronization timestamp.
Reverse Increment
In the Select Migration Type step, this section of parameters is displayed only when you select One-way Synchronization > Reverse Increment. The configuration parameters for reverse incremental migration are the same as those for incremental synchronization. You can select Reuse Incremental Synchronization Configuration in the upper-right corner.
If the Oracle data source is configured with Obtain incremental data via Kafka:
The parameters Incremental Log Pull Resource Configuration and Incremental Record Retention Duration are not supported.
The Incremental Data Write Resource Configuration parameter Read Concurrency specifies the concurrency for reading incremental logs from Kafka during synchronization. The default value is 4, the minimum value is 1, and the maximum value is 512. It is recommended to set the maximum value to the number of partitions of the corresponding Kafka topic.
Advanced options
ParameterDescriptionCharacter encoding and length definition options This parameter is displayed only if you select Schema Migration on the Select Migration Type page and the character sets at the source and target are different. It defines the conversion behavior for schema migration and incremental DDL operations when the source field types are CHAR, VARCHAR, or VARCHAR2 and the length unit is BYTE. You can customize the effective scope (CHAR, VARCHAR, or VARCHAR2) and implementation effect. - If the field length unit is ignored during migration, it depends on the target's NLS_LENGTH_SEMANTICS configuration, i.e., N BYTE -> N
- Forces the conversion of the field length unit from BYTE to CHAR, i.e., N BYTE -> N CHAR
- Automatically increases the length of the target field, i.e., N BYTE -> X*N BYTE
- No conversion is performed, i.e., N BYTE -> N BYTE
Add Hidden Columns for Tables Without Non-null Unique Keys When migrating data from OceanBase Database in Oracle compatible mode to an Oracle database, you need to configure whether to add hidden columns for tables without a primary key or a non-null unique key. For details, see Hidden column mechanism description in Data Migration Service.
If you select No, data duplication may occur if a task restarts or an exception occurs for tables without a primary key or a non-null unique key. It is recommended to configure a non-null unique key for all tables.Source table object storage type This parameter is displayed only if the source OceanBase Database in Oracle compatible mode is V4.3.0 or later, and you select Reverse Increment > DDL synchronization in the Select Migration Type step.
The source table object storage types include Default, Row Storage, Column Storage, and Hybrid Row-Column Storage. This configuration determines the storage type of the source table object during reverse incremental synchronization. For details, see default_table_store_format.Note
The Default option adapts other options based on the target parameters. During reverse incremental migration, incremental DDL adds new table objects according to the set storage type.
The following parameters are displayed only if you do not select One-way Synchronization > Schema Migration or One-way Synchronization > Reverse Increment in the Select Migration Type step.
Synchronize Data is disabled by default. After enabling it, you can write specified data (such as source schemas or values of other custom fields) to specified fields in the target.
ParameterDescriptionSynchronize Schema Name If you choose to synchronize the schema name, specify the field name and ensure all tables to be synchronized at the target have this field. Synchronize custom data After enabling this option, enter the Specify Field Name and Field Value. You can synchronize custom values as strings to specified fields in the target tables to be synchronized.
If the page's configuration parameters do not meet your needs, you can click Parameter Configuration at the bottom of the page for more specific configuration. If you have configured a task template or component template, you can also reference it here.
Click Precheck to perform a precheck on the data migration task.
During the Precheck step, OMS checks whether the database user's read/write permissions, network connectivity, and other requirements are met. The data migration task can only be started after all check items pass. If the precheck reports an error:
You can troubleshoot and resolve the issue, then re-execute the precheck until it succeeds.
You can also click Skip in the Actions column for the failed precheck item. A dialog box will pop up explaining the specific impact of skipping this operation. After confirming you can skip it, 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 the data differences between the source and target databases. 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 in sequence according to the selected migration type. For more information, see the content in the "View migration details" section of View the details of a data migration task.