This topic describes how to use OceanBase Migration Service (OMS) Community Edition to migrate data from a MongoDB database to OceanBase Database Community Edition.
Limitations
Limitations on operations in the source database
Do not perform DDL operations that modify database or table schemas during full migration. Otherwise, the data migration task may be interrupted.
At present, data migration tasks from a MongoDB database to OceanBase Database Community Edition only support full migration.
Data source identifiers and user accounts must be globally unique in OMS.
OMS Community Edition only supports migrating databases, tables, and column objects with ASCII-compliant names that do not contain special characters (|"'`()=;/& or line breaks).
We recommend that you migrate no more than 1,000 tables at a time to avoid affecting the operation of the data migration task.
Data type mappings
| Data type in a MongoDB database | Data type in OceanBase Database Community Edition |
|---|---|
| double | double |
| string | string |
| object | text |
| array | text array |
| binary data | binary |
| objectId | varchar |
| boolean | tinyint |
| date | datetime |
| regular expression | varchar |
| JavaScript | text |
| timestamp | timestamp |
| integer | bigint |
| decimal | decimal |
Procedure
Create a data migration task.
Log in to the OMS Community Edition console.
In the left-side navigation pane, click Data Migration.
On the Migration Tasks page, click New Task in the upper-right corner.
On the Select Source and Target page, configure the parameters.
Parameter Description Migration Task Name We recommend that you use a combination of Chinese characters, numbers, and letters. The name cannot contain spaces and must be less than 64 characters in length. Tag Click the field and select the target tag from the drop-down list. You can also click Manage Tags to create, modify, or delete tags. For more information, see Manage data migration tasks by using tags. Source If you have created a MongoDB data source, select it from the drop-down list. If not, click New Data Source in the drop-down list and create a data source in the dialog box that appears. For more information, see Create a MongoDB data source. Target If you have created an OceanBase Database Community Edition data source, select it from the drop-down list. If not, click New Data Source in the drop-down list and create a data source in the dialog box that appears. For more information, see Create an OceanBase Database Community Edition data source. Click Next.
On the Select Migration Type page, select Full Migration.
After a full migration task is created, OMS Community Edition migrates the existing data in the source database tables to the corresponding tables in the target database.
Click Next. On the Select Migration Objects page, select the migration object and the migration scope.
You can select the migration object by using Specify Objects and Match Rules. This topic describes how to select the migration object by using Specify Objects. For more information about how to configure the matching rules, see Configure the matching rules for a migration object.
Notice
The name of a table to be migrated, as well as the names of columns in the table, must not contain Chinese characters.
If the name of a database or table contains the characters "$$", an error occurs when you create a data migration task.
In the Select Migration Objects section, select Specify Objects.
In the Specify Migration Scope section, select the migration object in the Source Object(s) list.
Click > to add the migration object to the Target Object(s) list.
When you migrate data from a MongoDB database to OceanBase Database Community Edition, OMS Community Edition allows you to import objects, rename objects, and remove one or more migration objects.
Operation Steps Import objects - In the Specify Migration Scope section, click Import Objects in the upper-right corner of the right-side list.
- In the dialog box that appears, click OK.
Notice:
Importing objects will overwrite the previous object selection. Proceed with caution. - In the Import Migration Object dialog box, import the objects to be migrated.
You can rename databases and tables by importing CSV files. For more information, see Download and import the settings of migration objects. - Click Validate.
- After the objects are validated, click OK.
Rename objects OMS Community Edition allows you to rename migration objects. For more information, see Rename databases and tables. Remove one or all objects OMS Community Edition allows you to remove a single object or all objects to be migrated to the target database during data mapping. - To remove a single migration object:
In the list on the right of the Specify Migration Scope section, move the pointer over the target object and click Remove. - To remove all migration objects:
In the list on the right of the Specify Migration Scope section, click Remove All in the upper-right corner. In the dialog box that appears, click OK.
Click Next. On the Migration Type page, configure the parameters.
If you want to view or modify the parameters of the full migration component, click Configuration Details in the upper-right corner of the Full Migration section. For more information about the parameters, see the documentation in the Component Parameters section.
Notice
The following parameters are displayed only if you select Full Migration on the Select Migration Type page.
Parameter Description Concurrency Speed Valid values: Stable, Normal, Fast, and Custom. The performance of a full migration task varies depending on the migration objects. The resources required for a full migration task vary depending on the migration objects. If you select Custom, you can set Read Concurrency, Write Concurrency, and JVM Memory. Processing Strategy When Records Exist in Target Object Valid values: Ignore and Stop Migration. - If you select Ignore, when the data to be inserted conflicts with the existing data of a target table, OMS Community Edition retains the existing data and records the conflict data.
Notice
If you select Ignore, data is pulled in IN mode for full verification. In this case, the scenario where the target contains more data than the source cannot be verified, and the verification efficiency will be decreased.
- If you select Stop Migration and a target table contains data, an error is returned during full migration, indicating that the migration is not allowed. In this case, you must clear the data in the target table before you can continue with the migration.
Notice
After an error is returned, if you click Resume in the dialog box, OMS Community Edition ignores this error and continues to migrate data. Proceed with caution.
Write Method Valid values: SQL (data is written to a table by using INSERTorREPLACE) and Direct Load (data is written to a table by using direct load). At present, direct load is not supported for vector data.- If you select Ignore, when the data to be inserted conflicts with the existing data of a target table, OMS Community Edition retains the existing data and records the conflict data.
Click Precheck to perform a precheck on the data migration task.
In the Precheck section, OMS Community Edition checks whether the network connection to the database meets the requirements. You can start the data migration task only after all checks are passed. If an error is returned during the precheck:
You can resolve the error and then run the precheck again until the precheck succeeds.
Click Skip in the Actions column of the failed precheck item. In the dialog box that prompts the consequences of the operation, click OK.
Click Start Task. If you do not need to start the task now, click Save to go to the details page of the data migration task. You can manually start the task as needed.
OMS Community Edition allows you to modify the migration objects in a data migration task during the migration. For more information, see View and modify migration objects. After the data migration task is started, it executes based on the migration type you selected. For more information, see the "View migration details" section in View details of a data migration task.