Oracle real-time synchronization

This article provides implementation ideas, configuration examples, and verification methods for Oracle real-time synchronization scenarios, which can be used as a reference for actual project configuration.

Real-time synchronization of data from the result table to the target table in Oracle

Case

Synchronize data in cdc_source to cdc_target in real time in Oracle

Premise

  • Enable Oracle's logminer

solution

Create a Flink SQL job type and add the following dependencies

20250113160944

CREATE TABLE from_table (
    USERNAME STRING,
    AGE INT,
    PRIMARY KEY(USERNAME) NOT ENFORCED
) WITH (
     'connector' = 'oracle-cdc',
     'hostname' = 'localhost',
     'port' = '15201',
     'username' = 'root',
     'password' = 'root123',
     'database-name' = 'helowin',
     'schema-name' = 'root',
     'table-name' = 'CDC_SOURCE',
     'scan.startup.mode' = 'latest-offset');

CREATE TABLE target_table(
    USERNAME STRING,
    AGE INT,
    PRIMARY KEY(USERNAME) NOT ENFORCED
) WITH (
    'connector'='jdbc',
    'url'='jdbc:oracle:thin:@localhost:15201:helowin',
    'driver'='oracle.jdbc.driver.OracleDriver',
    'table-name'='CDC_SINK',
    'username'='root',
    'password'='root123',
    'sink.buffer-flush.max-rows' = '0'); 

INSERT INTO target_table select * from from_table;
Configuration itemsillustrate
connectorConnection method
uriDatabase connection url
table-nametable name
database-name库名****