Skip to main content

OceanBase Oracle Migration Synchronization to Datahub

NineData data replication supports the efficient migration or real-time synchronization of OceanBase Oracle data to DataHub, ensuring seamless data integration and enabling data consolidation and analysis across multiple scenarios.

Prerequisites

  • The source and target data sources have been added to NineData. For instructions on how to add data sources, please refer to Adding Data Sources.
  • The source database type is OceanBase Oracle.
  • The target data source type is Datahub.

Usage Limitations

  • Before executing data synchronization, it is necessary to assess the performance of the source and target data sources, and it is recommended to perform data synchronization during off-peak business hours. Otherwise, the full data initialization will occupy a certain amount of read and write resources of the source and target data sources, leading to increased database load.
  • It is necessary to ensure that each table in the synchronization object has a primary key or unique constraint, and the column names are unique; otherwise, the same data may be synchronized repeatedly.

Operation Steps

Commercialization Notice

NineData’s data replication product has been commercialized. You can still use 10 replication tasks for free, with the following considerations:

  • Among the 10 replication tasks, you can include 1 task, with a specification of Micro.

  • Tasks with a status of do not count towards the 10-task limit. If you have already created 10 replication tasks and want to create more, you can terminate previous replication tasks and then create new ones.

  • When creating replication tasks, you can only select the you have purchased. Specifications that have not been purchased will be grayed out and cannot be selected. If you need to purchase additional specifications, please contact us through the customer service icon at the bottom right of the page.

  1. Log in to the NineData Console.

  2. Click on > in the left navigation bar.

  3. On the page, click on in the top right corner.

  4. On the tab, configure according to the table below and click .

    Parameter
    Description
    Enter the name of the data synchronization task. To facilitate subsequent search and management, please use meaningful names as much as possible. Up to 64 characters are supported.
    The data source where the synchronization object is located, select the data source where the data to be copied is located.
    The data source that receives the synchronization object, select the target Datahub data source.
    Datahub ProjectSelect the target Datahub Project, the data from the source data source will be written into the specified Project.
    Select the rule for converting object names from the source to the target after migration.
    • : Regardless of the naming rules on the source side, the naming rules on the target side are all lowercase.
    • : Follow the naming rules on the source side.
    • : Regardless of the naming rules on the source side, the naming rules on the target side are all uppercase.
    Select the content to be replicated to the target data source.
    • : Only synchronize the database table structure of the source data source, without synchronizing data.
    • : Synchronize all objects and data of the source data source, i.e., full data replication. The switch on the right is the switch for periodic full replication, for more information, please refer to Periodic Full Replication.
    • : After the full synchronization is completed, perform incremental synchronization based on the logs of the source data source.setting The icon is the configuration for incremental operation types, you can uncheck some operation types according to your needs, and these operations will be ignored in incremental synchronization after unchecking.
    (not selectable only when

    Optional only when the task contains or .

    The specifications of the replication task determine the replication speed: the larger the specification, the higher the replication rate. Hover over the detailsicon to view the replication rate and configuration details for each specification. Each specification displays the available quantity and the total number of specifications. If the available quantity is 0, it will be grayed out and cannot be selected.

    is only required when .
    • : Perform incremental replication based on the current replication task start time.
    • : Select the start time for incremental replication, you can choose the time zone according to your business region. If the time point is configured before the current replication task starts, the replication task will fail if there are DDL operations during that period.
    • : Stop the task if data is detected in the target table during the pre-inspection stage.
    • : Ignore the data in the target table if detected during the pre-inspection stage, and append other data.
  5. On the tab, configure the following parameters, and then click .

    Parameter
    Description
    Select the content to be replicated. You can choose to replicate all content from the source database, or you can choose , select the content to be replicated in the list, and click > to add to the right list.

    If you need to create multiple replication chains with the same replication object, you can create a configuration file and import it when creating a new task. Click on in the top right corner, then click Download Template to download the configuration file template to your local machine, edit it, and then click to upload the configuration file to achieve batch import. Configuration file description:

    Parameter
    Description
    source_table_nameThe source table name where the object to be synchronized is located.
    destination_table_nameThe target table name where the object to be synchronized is received.
    source_schema_nameThe source Schema name where the object to be synchronized is located.
    destination_schema_nameThe target Schema name where the object to be synchronized is received.
    source_database_nameThe source database name where the object to be synchronized is located.
    target_database_nameThe target database name where the object to be synchronized is received.
    column_listThe list of fields to be synchronized.
    extra_configurationAdditional configuration information can be set here:
    • column_rules: Used to define column mapping and value rules. Field descriptions:
      • column_name: Original column name.
      • destination_column_name: Target column name.
      • column_value: Value to assign, which can be an SQL function or a constant.
    • filter_condition: Used to specify row-level filtering conditions; only rows that meet the criteria will be copied.
    tip
    • An example of extra_configuration is as follows:

      {
      "extra_config": {
      "column_rules": [
      {
      "column_name": "created_time", // Original column name to map.
      "destination_column_name": "migrated_time", // Target column name mapped to "migrated_time".
      "column_value": "current_timestamp()" // Change the column value to the current timestamp.
      }
      ],
      "filter_condition": "id != 0" // Only rows where ID is not 0 will be synchronized.
      }
      }

      - For the overall example content of the configuration file, please refer to the downloaded template.
  6. On the tab, you can configure each table that needs to be replicated to Datahub individually. Click on the on the right side of the target table to configure each column individually. If there are updates in the source and target data sources during the configuration mapping stage, you can click the button in the top right corner of the page to refresh the information of the source and target data sources. After the configuration is completed, click .

    In , you can also configure . As a queue product, Datahub does not support random UPDATE/DELETE operations, so NineData needs to add the following metadata fields to the user's Datahub to identify the characteristics of each piece of data delivered to Datahub.

    Metadata Field NameMetadata Field Value
    _record_id_${nd_record_id}
    _operation_type_${nd_operation_type}
    _execution_time_${nd_exec_timestamp}
    _before_image_${nd_before_image}
    _after_image_${nd_after_image}

    You can also add or modify metadata field names or values as needed. For detailed information on each field value, please refer to the Appendix of this article.

  7. On the tab, wait for the system to complete the pre-inspection. After the pre-inspection is passed, click .

    tip

    You can check . After the synchronization task is completed, automatically start the data consistency comparison based on the source data source to ensure data consistency on both sides. Depending on the you choose, the timing for starting is as follows:

    • : Start after the structure replication is completed.
    • +, : Start after the full replication is completed.
    • ++, : Start when the incremental data is consistent with the source data source for the first time and is 0 seconds. You can click to view the synchronization delay on the page.

      sync_delay

    • If the pre-inspection does not pass, you need to click in the column on the right side of the target inspection item to investigate the cause of the failure, manually fix it, and then click to re-execute the pre-inspection until it passes.

    • If the is for the inspection item, it can be fixed or ignored according to the specific situation.

  8. On the page, it prompts , and the synchronization task starts running. At this time, you can perform the following operations:

    • Click to view the execution status of each stage of the synchronization task.
    • Click to return to the task list page.

Viewing Synchronization Results

  1. Log in to the NineData Console.

  2. Click on > in the left navigation bar.

  3. On the page, click on the of the target synchronization task, the page details are as follows.

    result

    Number
    Function
    Description
    1Sync DelayThe data synchronization delay between the source data source and the target data source. 0 seconds means there is no delay between the two ends, at which point you can choose to switch the business to the target data source for smooth migration.
    2Configure AlertsAfter configuring alerts, the system will notify you in the way you choose when the task fails. For more information, please refer to Operations Monitoring Introduction.
    3More
    • : Pause the task, only tasks with Running status are selectable.
    • : Create a new replication task with the same configuration as the current task.
    • : End tasks that are unfinished or listening (i.e., in incremental synchronization). Once the task is terminated, it cannot be restarted, so please proceed with caution. If the synchronization objects contain triggers, a trigger replication option will pop up, please select as needed.
    • : Delete the task. Once the task is deleted, it cannot be recovered, so please proceed with caution.
    4Structure Replication (displayed in scenarios involving structure replication)Displays the progress and detailed information of structure replication.
    • Click on on the right side of the page: View the execution logs of structure replication.
    • Click on refresh on the right side of the page: View the latest information.
    • Click on in the column on the right side of the target object in the list: View SQL playback.
    5Full Replication (displayed in scenarios involving full replication)Displays the progress and detailed information of full replication.
    • Click on on the right side of the page: View various monitoring indicators during full replication. During full replication, you can also click on on the right side of the monitoring indicator page to limit the rate of writing to the target data source per second. The unit is rows/second.
    • Click on on the right side of the page: View the execution logs of full replication.
    • Click on refresh on the right side of the page: View the latest information.
    6Incremental Replication (displayed in scenarios involving incremental replication)Displays various monitoring indicators of incremental replication.
    • Click on on the right side of the page: View the operations currently being executed by the current replication task, including:
      • : Replication tasks are executed in multiple threads, displaying the current thread number in progress.
      • : Details of the SQL statement currently being executed by the current thread.
      • : The response time of the current thread. If this value increases, it indicates that the current thread may be stuck for some reason.
      • : The timestamp when the current thread was started.
      • : The status of the current thread.
    • Click on on the right side of the page: Limit the rate of writing to the target data source per second. The unit is rows/second.
    • Click on on the right side of the page: View the execution logs of incremental replication.
    • Click on refresh on the right side of the page: View the latest information.
    7Modify ObjectDisplays the modification records of synchronization objects.
    • Click on on the right side of the page to configure the synchronization objects.
    • Click on refresh on the right side of the page: View the latest information.
    8Data ComparisonDisplays the comparison results between the source data source and the target data source. If you have not enabled data comparison, please click on on the page.
    • Click on on the right side of the page: Re-initiate the comparison between the current source and target data sources.
    • Click on on the right side of the page: After the comparison task starts, you can click this button to stop the comparison task immediately.
    • Click on on the right side of the page: View the execution logs of consistency comparison.
    • Click on (displayed only in data comparison): View the trend chart of RPS (records per second) comparison. Click on to view earlier records.
    • Click on details in the column on the right side of the comparison list (displayed under the tab only in the case of inconsistency): View details of the comparison between the source and target sides.
    • Click on sql in the column on the right side of the comparison list (displayed only in the case of inconsistency): Generate change SQL. You can directly copy this SQL to the target data source to execute and modify the inconsistent content.
    9ExpandDisplay detailed information of the current replication task. Common Options:
    • : Export the current task's database and table configuration, allowing for quick import when creating a new replication task. This helps rapidly establish multiple replication links with the same replication objects.
    • : Configure the alarm strategy for the current task.

Appendix 1: Data Type Mapping Table

CategoryOceanBase Oracle Data TypeStarRocks Data Type
Build-in Data TypesCHAR [(size [BYTE | CHAR])] STRING
NCHAR[(size)] STRING
VARCHAR2(size [BYTE | CHAR])STRING
NVARCHAR2(size) STRING
CLOB STRING
NUMBER [ (p [, s]) ] DECIMAL
FLOAT [(p)] FLOAT
DATE DATETIME
BINARY_FLOATFLOAT
BINARY_DOUBLE DOUBLE
TIMESTAMP [(fractional_seconds_precision)]TIMESTAMP
TIMESTAMP [(fractional_seconds_precision)] WITH TIME ZONETIMESTAMP
TIMESTAMP [(fractional_seconds_precision)] WITH LOCAL TIME ZONETIMESTAMP
INTERVAL YEAR [(year_precision)] TO MONTHSTRING
INTERVAL DAY [(day_precision)] TO SECOND [(fractional_seconds_precision)]STRING
RAW(size) STRING
BLOB STRING
Collection Data TypesREFSTRING
VARRAYSTRING
NESTED TABLE STRING
Oracle Supplied Data TypesAnyData STRING
Spatial Data TypesSDO_GEOMETRY STRING

Appendix 2: Pre-Check Item List

Check ItemCheck Content
Source Data Source Connection CheckCheck the gateway status of the source data source, whether the instance is reachable, and the accuracy of the username and password
Target Data Source Connection CheckCheck the gateway status of the target data source, whether the instance is reachable, and the accuracy of the username and password
Source Library Permission CheckCheck whether the account permissions of the source database meet the requirements
Target Library Data Existence CheckCheck whether there is data in the target database for the objects to be replicated

Appendix 3: System Parameter Description

To achieve the storage of incremental data in DataHub, NineData provides a set of default system parameters and metadata fields to identify data characteristics. Here are the specific meanings and usage scenarios of the system parameters.

Parameter NameMeaning and Usage
${nd_record_id}The unique ID of each data record (Record). In UPDATE operations, the record_id of the records before and after the update must be the same to achieve change association.
${nd_exec_timestamp}The runtime of the Record operation.
${nd_database_name}The name of the database to which the table belongs, facilitating the distinction of data sources.
${nd_table_name}The name of the table corresponding to the Record, used to accurately locate the change record.
${nd_operation_type}The type of Record change operation, with the following values:
  • I: Insert
  • U: Update
  • D: Delete
For full synchronization, all are I.
${nd_before_image}The pre-image identifier, indicating that the target Record status is before the change occurs, i.e., the current data has been changed. Values:
  • Y: Pre-image.
  • N: Non-pre-image.
For example: INSERT operation is N; DELETE operation is Y; UPDATE operation before is Y, after is N.
${nd_after_image}The post-image identifier, indicating that the target Record status is after the change occurs, i.e., the current data is the latest state. Values:
  • Y: Post-image.
  • N: Non-post-image.
For example: INSERT operation is Y; DELETE operation is N; UPDATE operation before is N, after is Y.
${nd_datasource}Data source information: The IP and port number of the data source, in the format ip:port.

Data Replication Introduction