OceanBase CDC with Auto Table Creation
Use FROM OCEANBASE ... TO DATABASE to replicate primary-key tables into a database in your VeloDB Cloud warehouse. The job reads the source through the OceanBase Binlog Service (OBBinlog), creates missing Unique Key tables, and applies changes with at-least-once delivery.
Note:
OceanBase CDC is an experimental SQL workflow available in the Core 26.1.2 implementation. Confirm that your warehouse has the OceanBase connector with VeloDB Cloud support.
Prerequisites
- Use an OceanBase tenant in MySQL compatibility mode. The connector checks
ob_compatibility_modewhen you create the job. - Configure OBBinlog on the source side. Connect to its MySQL protocol endpoint as the source account and run
SHOW MASTER STATUS. Verify that it returns a binlog file and position. The account needs access to the selected tables, their metadata, and the binlog. - Make the OBBinlog endpoint reachable from the warehouse cluster. Use a MySQL Connector/J driver location accessible to the warehouse. Confirm the supported driver location for your deployment if necessary.
- Create the target database and select it in your SQL session. Use a warehouse SQL user with cluster access,
LOADon the targets,CREATEfor missing tables, andALTERfor schema synchronization. Each selected source table needs a primary key.
Create the load job
This example reads the existing rows of users and orders, then follows new changes. Replace the endpoint, approved driver URL, source credentials, and database names with your own.
USE target_db;
CREATE JOB oceanbase_db_sync
ON STREAMING
FROM OCEANBASE (
"jdbc_url" = "jdbc:mysql://obbinlog.example.com:2883",
"driver_url" = "https://drivers.example.com/mysql-connector-j-8.4.0.jar",
"driver_class" = "com.mysql.cj.jdbc.Driver",
"user" = "<cdc_user>@<tenant>",
"password" = "<source_password>",
"database" = "source_db",
"include_tables" = "users,orders",
"offset" = "initial"
)
TO DATABASE target_db;
Set include_tables to one name for a single table or omit it to select every table except those named in exclude_tables. Job creation fails if any selected table lacks a primary key. The job can rename tables and exclude non-key columns. OceanBase uses automatic table creation and does not accept a cdc_stream() SQL projection.
Verify the load
SELECT Name, Status, CurrentOffset, ErrorMsg
FROM jobs("type" = "insert")
WHERE Name = 'oceanbase_db_sync';
Wait for the initial snapshot to finish. Make a known change to a selected source table and query the corresponding warehouse table to verify that the change arrived.
SELECT * FROM target_db.users ORDER BY id;
From Core 26.1.3, you can also inspect LagBytes when a binlog position is available. For task details and job controls, see Common operations.
Source properties
| Parameter | Required | Default | Description |
|---|---|---|---|
jdbc_url | Yes | - | JDBC connection string for the OBBinlog service. It must start with jdbc:mysql://. |
driver_url | Yes | - | Warehouse-accessible location of the MySQL Connector/J driver. |
driver_class | Yes | - | MySQL JDBC driver class, for example, com.mysql.cj.jdbc.Driver. |
user | Yes | - | OceanBase user name. Include tenant information using the user name format required by OceanBase. |
password | Yes | - | OceanBase user password. |
database | Yes | - | OceanBase database name. |
include_tables | No | - | Table names to sync, separated by commas. If omitted, all tables in the database are synced. |
exclude_tables | No | - | Table names not to sync, separated by commas. This parameter takes effect only when include_tables is not set. |
table.<table_name>.target_table | No | Source table name | Sets the warehouse target table name for a source table. |
table.<table_name>.exclude_columns | No | - | Excludes non-key columns from a source table, separated by commas. Each column must exist and cannot be a primary key column. |
offset | No | latest | Startup position. initial: full and incremental sync; snapshot: full sync only; earliest: start at the earliest available binlog position; latest: sync only changes after the job starts. An exact position such as {"file":"binlog.000001","pos":"154"} is also supported. |
snapshot_split_size | No | 40960 | Number of rows in each split during the full-sync phase. Must be a positive integer. |
snapshot_parallelism | No | Automatic in Core 26.1.4, otherwise 1 | Maximum number of concurrent splits per snapshot task. In Core 26.1.4 the job chooses parallelism from cluster capacity unless you specify a positive integer. |
skip_snapshot_backfill | No | true | Whether to skip binlog backfill during the snapshot phase. Auto Table Creation Sync provides at-least-once semantics. |
server_id | No | Automatically generated | Server ID of the CDC reader. Supports a single value such as 5400 or a closed range such as 5400-5408. The range must contain at least snapshot_parallelism IDs. |
ssl_mode | No | disable | SSL mode. Valid values are disable, require, and verify-ca. |
ssl_rootcert | Conditionally required | - | Required when ssl_mode is verify-ca. Use the format FILE:<file_name> and have an administrator register the file in the job database under the streaming_job file catalog with CREATE FILE. |
schema_change_behavior | No | evolve | In Core 26.1.4, use evolve to apply supported column changes or ignore to skip target DDL. |
The schema, slot_name, and publication_name parameters are not supported. Job creation fails if any of them is specified.
Target properties
| Property | Default | Meaning |
|---|---|---|
table.create.properties.* | Warehouse defaults | Passes supported table properties to newly created tables. An existing target keeps its definition. |
load.strict_mode | false | Enables strict load validation when set to true. |
load.max_filter_ratio | 0 | Maximum fraction of filtered rows allowed in the sampling window, from 0 to 1. Exceeding it pauses the job. |
Compare the primary key and column types of any existing target with the source before starting. To rename a destination table, set table.<table_name>.target_table on the source. To start with future changes only, use offset = "latest". Verify the first batch with a small table before expanding the selection.