OceanBase Oracle to Kafka Replication
Use this page to replicate OceanBase Oracle data to Kafka in NineData. NineData writes full and incremental data as JSON messages for downstream consumption.
Before you begin
Add the source and target data sources to NineData. For details, see Create Data Source.
The source database type is OceanBase Oracle.
The target database type is Kafka 0.10 or later.
Configure the OceanBase Oracle source as follows:
The OceanBase Oracle log mode has been set to
ARCHIVELOGmode (default isNOARCHIVELOG).To verify the current log mode: SELECT log_mode FROM v$database;
If the log mode is NOARCHIVELOG, perform these steps:
1. Shut down the database: SHUTDOWN IMMEDIATE;
2. Start and mount the database: STARTUP MOUNT;
3. Execute the archive command: ALTER DATABASE ARCHIVELOG;
4. Start the database: ALTER DATABASE OPEN;Supplemental Log has been enabled, i.e., additional logs (not enabled by default).
To verify if the supplemental log is enabled: SELECT supplemental_log_data_all allc FROM v$database;
If it returns NO, execute the command to enable the supplemental log:
- ALTER DATABASE ADD SUPPLEMENTAL LOG DATA (ALL) COLUMNS;
//Enable supplemental logs at the database level, which will affect all tables and all columns, consuming more resources.
- ALTER TABLE <database_name>.<table_name> ADD SUPPLEMENTAL LOG DATA (ALL) COLUMNS;
- ALTER DATABASE ADD SUPPLEMENTAL LOG DATA;
//Enable supplemental logs on a specific table, which will affect all columns in that table.
Limitations
- Check the performance of both data sources before you start. Run replication during off-peak hours so full initialization does not overload the source or target.
- Make sure each synchronized table has a primary key or unique constraint, and keep column names unique to avoid duplicate rows.
Procedure
Sign in to the NineData Console.
In the left navigation pane, click Replication > Data Replication.
On the Replication page, click Create Replication.
On the Source & Target tab, configure the fields in the table, and click Next.
Parameter Description Name Enter a name for the data synchronization task. To make the task easier to find and manage later, use a meaningful name. Up to 64 characters are supported. Source The data source that contains the objects to synchronize. Datahub Project Select the target Datahub Project. Data from the source data source will be written to the specified Project. Kafka Topic Select the target Kafka Topic. Data from the source data source will be written to the specified Topic. Delivery Partition When delivering data to a Topic, you can specify the partition to which the data is delivered. - Deliver All to Partition 0: Deliver all data to the default partition 0.
- Deliver to different partition by the Hash value of [databaseName + tableName]: Hash data across different partitions. The system uses the hash value of the database name and table name to calculate the target partition, ensuring that data from the same table is delivered to the same partition during hash delivery.
Type Select the replication type. - Full: Synchronize all objects and data from the source data source, namely full data replication. The switch on the right enables periodic full replication. For more information, see Periodic Full Replication.
- Incremental: After full synchronization is complete, perform incremental synchronization based on the logs of the source data source.
Incremental Started Required only when Type is Incremental. - From Started: Use the current replication task start time as the baseline for incremental replication.
- Customized Time: Select the point in time from which incremental replication starts. You can select a time zone based on the region of your business. If the configured time point is earlier than the current replication task start time and DDL operations occurred during that period, the replication task will fail.
Target Table Exists Data (Required when Full is selected) - Pre-Check Error and Stop Task: Stop the task when data is detected in the target table during the precheck stage.
- Ignore existing target data and append to it.: When data is detected in the target table during the precheck stage, ignore that data and append other data.
- Clear target existing data before write: When data is detected in the target table during the precheck stage, delete that data and write it again.
Incremental data conflict handling strategy for target table (Required when Incremental is selected) - Runtime error: During incremental replication, report an error when target data already exists and wait for manual intervention.
- Do not update target data: During incremental replication, do not write data when target data already exists, and continue subsequent tasks.
- Update target data: During incremental replication, overwrite the target data when target data already exists.
On the Objects tab, configure the parameters in the table, and click Next.
Parameter Description To create multiple replication tasks with the same replication objects, import a configuration file. Click Import Config, click Download Template to download the template, edit the file, and then click Upload to upload it and import the objects in bulk. The configuration file uses these fields:
Parameter Description source_table_nameThe source table name of the object to synchronize. destination_table_nameThe target table name that receives the synchronized object. source_schema_nameThe source schema name of the object to synchronize. destination_schema_nameThe target schema name that receives the synchronized object. source_database_nameThe source database name of the object to synchronize. target_database_nameThe target database name that receives the synchronized object. column_listThe list of columns to synchronize. extra_configurationAdditional configuration information. This field supports: column_rules: Defines column mappings and value rules. Field descriptions:column_name: Original column name.destination_column_name: Specifies the target column name.column_value: Specifies the column value, which can be an SQL function or a constant value.
filter_condition: Specifies row-level data filtering conditions. Only rows that meet the conditions are replicated.
tipExample of
extra_configuration:{
"extra_config":{
"column_rules":[
{
"column_name": "created_time",
"destination_column_name": "migrated_time",
"column_value": "current_timestamp()"
}
],
"filter_condition": "id != 0"
}
}In this example,
created_timeis mapped tomigrated_time, the target column value is changed tocurrent_timestamp(), and only rows whoseidvalue is not0are synchronized.For a complete example of the configuration file, see the downloaded template.
On the "Mapping" tab, you can separately configure each column to replicate to Kafka. By default, all columns of the selected table are replicated. If source or target metadata changes while you configure mappings, click Refresh Metadata to refresh the metadata. After completing the configuration, click Save and Pre-Check.
On the Pre-check tab, wait for the system to complete the precheck. After the precheck passes, click Launch.
Select Enable data consistency comparison to start a data consistency comparison task based on the source data source after synchronization completes. Based on the selected Type, Enable data consistency comparison starts at these times:
- Full: Starts after full replication is complete.
- Full+Incremental, Incremental: Starts when incremental data is consistent with the source data source for the first time and Delay is 0 seconds. Click View Details to view synchronization delay on the Details page.

If the precheck fails, click Details in the Actions column for the failed check item, review the cause, fix the issue, and then click Check Again to run the precheck again until it passes.
Items with Warning in Result can be fixed or ignored as needed.
On the Launch page, the Launch Successfully message appears, indicating that the synchronization task has started. You can then perform these actions:
- Click View Details to view the execution status of each stage of the synchronization task.
- Click Back to list to return to the Replication task list page.
Results
Sign in to the NineData Console.
In the navigation menu, click Replication > Data Replication.
On the Replication page, click the ID of the target synchronization task to open the Details page. The task details page shows the following information.

No. Feature Description 1 Synchronization Delay The synchronization delay between the source and target data sources. 0seconds means Kafka has caught up with the source data source.2 Configure Alerts When the task fails, the system notifies the selected channel through the configured alert. For more information, see Operational Monitoring Overview. 3 More - Pause: Pause the task, only tasks with the status Running are selectable.
- Terminate: End tasks that are incomplete or listening (i.e., in incremental synchronization), after terminating the task, it cannot be restarted, proceed with caution.
- Delete: Delete the task, the task cannot be recovered after deletion, proceed with caution.
4 Full Replication (Displayed in scenarios including full replication) Displays the progress and detailed information of full replication. - Click Monitor to view various monitoring metrics during the full replication process. During the full replication process, you can also click Flow Control Settings on the monitoring page to limit the rate of writing to the target data source per second. The unit is MB/S.
- Click Log to view the execution logs of full replication.
- Click the
icon to view the latest information.
5 Incremental Replication (Displayed in scenarios including incremental replication) Displays various monitoring metrics for incremental replication. - Click Flow Control Settings to limit the rate of writing to the target data source per second. The unit is rows/second.
- Click Log to view the execution logs of incremental replication.
- Click the
icon to view the latest information.
6 Modify Object Displays the modification records of the synchronization object. - Click Modify Objects to configure the synchronization object.
- Click the
icon to view the latest information.
7 Expand Displays detailed information of the current replication task, including Type, Replication Objects, Started, etc.
Appendix: Data format
Data replicated from OceanBase Oracle to Kafka is stored in JSON. NineData splits rows into JSON objects, and each JSON object represents one message.
- Full replication phase: The number of Oracle data rows stored in a single message is determined by the message.max.bytesmessage.max.bytes is the maximum message size allowed in the Kafka cluster. The default value is
1000000bytes, or 1 MB. Adjust this value in the Kafka configuration file to store more Oracle data rows in each message. If the value is too large, Kafka may need more memory per message and cluster performance can drop. parameter. - Incremental replication phase: A single message stores one row of Oracle data.
| Field | Field Type | Field Description | Field Example |
|---|---|---|---|
| serverId | STRING | The data source information to which the message belongs, in the format: <connection address:port>. | "serverId":"47.98.224.21:3307" |
| id | LONG | The Record id of the message. This field is globally incremented and is used as the basis for determining message duplicate consumption. | "Id":156 |
| es | INT | Represented by Unix timestamp, it has different meanings in different task stages:
| "es":1668650385 |
| ts | INT | The time when more data is delivered to Kafka, represented by Unix timestamp. | "ts":1668651053 |
| isDdl | BOOLEAN | Whether the data is DDL, the values are:
| "is_ddl":true |
| type | STRING | The type of data, the values are:
| "type":"INIT" |
| database | STRING | The database to which the data belongs. | "database":"database_name" |
| table | STRING | The table to which the data belongs. If the DDL statement corresponds to a non-table object, this field is set to null. | "table":"table_name" |
| mysqlType | JSON | Reserved field. Ignore this field. | "mysqlType": null |
| sqlType | JSON | The data types of each field in the source Oracle. | "sqlType": {"id": "NUMBER","shipping_type":"varchar2(50)"} |
| pkNames | ARRAY | The names of the primary keys (Primary Key) corresponding to the records (Record) in the Binlog. Values:
| "pkNames": ["id", "uid"] |
| data | ARRAY[JSON] | The data that Oracle delivers to Kafka, stored in a JSON-formatted array.
| "data": [{ "name": "jl", "phone": "(737)1234787", "email": "caicai@yahoo.edu", "address": "zhejiang", "country": "china" }] |
| old | ARRAY[JSON] | Records the details of the incremental replication from Oracle to Kafka.
For other operations, the value of this field is null. | "old": [{ "name": "someone", "phone": "(737)1234787", "email": "someone@example.com", "address": "somewhere", "country": "china" }] |
| sql | STRING | If the current data is an incremental DDL operation, the corresponding SQL statement is recorded. For other operations, the value of this field is null. | "sql":"create table sbtest1(id int primary key,name varchar(20))" |
Appendix: Pre-check items
| Check Item | Check Content |
|---|---|
| Source Data Source Connection Check | Checks the source data source gateway status, instance reachability, and username/password validity. |
| Target Data Source Connection Check | Checks the target data source gateway status, instance reachability, and username/password validity. |
| Source Database Permission Check | Checks whether the source database account permissions meet the requirements. |
| Target Database Permission Check | Checks whether the Kafka account has permission to access the Topic. |
| Target Database Data Existence Check | Checks whether data already exists in the Topic. |
| Source Database Log Archive Mode Check | Checks whether the source database log archive mode is ARCHIVELOG. |
| Source Database Supplemental Log Check | Checks whether supplemental logging is enabled and set to ALL. |