Skip to main content

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_mode when 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, LOAD on the targets, CREATE for missing tables, and ALTER for 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​

ParameterRequiredDefaultDescription
jdbc_urlYes-JDBC connection string for the OBBinlog service. It must start with jdbc:mysql://.
driver_urlYes-Warehouse-accessible location of the MySQL Connector/J driver.
driver_classYes-MySQL JDBC driver class, for example, com.mysql.cj.jdbc.Driver.
userYes-OceanBase user name. Include tenant information using the user name format required by OceanBase.
passwordYes-OceanBase user password.
databaseYes-OceanBase database name.
include_tablesNo-Table names to sync, separated by commas. If omitted, all tables in the database are synced.
exclude_tablesNo-Table names not to sync, separated by commas. This parameter takes effect only when include_tables is not set.
table.<table_name>.target_tableNoSource table nameSets the warehouse target table name for a source table.
table.<table_name>.exclude_columnsNo-Excludes non-key columns from a source table, separated by commas. Each column must exist and cannot be a primary key column.
offsetNolatestStartup 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_sizeNo40960Number of rows in each split during the full-sync phase. Must be a positive integer.
snapshot_parallelismNoAutomatic in Core 26.1.4, otherwise 1Maximum 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_backfillNotrueWhether to skip binlog backfill during the snapshot phase. Auto Table Creation Sync provides at-least-once semantics.
server_idNoAutomatically generatedServer 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_modeNodisableSSL mode. Valid values are disable, require, and verify-ca.
ssl_rootcertConditionally 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_behaviorNoevolveIn 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​

PropertyDefaultMeaning
table.create.properties.*Warehouse defaultsPasses supported table properties to newly created tables. An existing target keeps its definition.
load.strict_modefalseEnables strict load validation when set to true.
load.max_filter_ratio0Maximum 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.

See also​