# Oracle CDC — Quickstart & Runbook

Page title: Oracle CDC Quickstart

> Oracle CDC quickstart: prerequisites (ARCHIVELOG, supplemental logging), health checks, connector notes, verification, and rollback.

Canonical page: <https://sandgraal.github.io/letstalkcdc/quickstarts/quickstart-oracle/>

> **Known errata for this page (1)**
>
> - **Corrected: an Oracle SCN alone is not a safe guard** (updated 2026-10-12)
>
>   The first-aid list said to guard the sink on the source log position (SCN), and the latest-wins check took `MAX(source_scn)` per key. The partitioning and materialization pages already say that an Oracle `scn` can repeat across changes in one transaction, so a single SCN can tie. The guard and the check now use a (position, tie-break) pair, where the tie-break is `rs_id` and `ssn` or your own within-transaction ordinal (verify the ordering semantics for your Debezium version). The SCN and commit timestamp the page asks you to expose are for lag metrics only, never for ordering. The tie-break is a single orderable column: if you use both `rs_id` and `ssn`, compare them as separate columns (`rs_id` is a string) and do not concatenate them as text. The Oracle quickstart's acceptance line said latest-wins by SCN alone and now says (SCN, tie-break). The Oracle SQL on the page is now labelled as not run against an Oracle database.
>
> [See all corrections and caveats](https://sandgraal.github.io/letstalkcdc/errata/)

Confirm prerequisites, collect health signals, register a connector, verify changes, and roll back safely.

For deeper Oracle-specific CDC nuances — LogMiner vs. replication readers, performance knobs, and a troubleshooting playbook — see [Vendor Nuances — Oracle CDC](https://sandgraal.github.io/letstalkcdc/oracle-notes/).

## Prerequisites (DB)

- **ARCHIVELOG** mode recommended.
- **Supplemental logging** enabled (DB-level minimal; table-level for key columns or ALL for keyless tables).
- Redo/archive retention window ≥ snapshot + catch-up time.
- Stable primary keys (or table log groups capturing merge keys).

- ARCHIVELOG mode keeps redo history available so CDC readers can recover. Supplemental logging ensures redo contains key columns to reconstruct before/after images, which is critical when applying updates downstream.

```
-- archivelog and redo
SELECT log_mode FROM v$database;
SELECT sequence#, archived, status
FROM v$log
ORDER BY first_time DESC FETCH FIRST 5 ROWS ONLY;

-- supplemental logging
SELECT supplemental_log_data_min, supplemental_log_data_all FROM v$database;
SELECT owner, table_name, log_group_name, always, log_group_type
FROM dba_log_groups ORDER BY owner, table_name;
```

## DB Setup (examples)

```
-- table-level log group for keyless merge
ALTER TABLE APP.CUSTOMER ADD LOG GROUP lg_customer_pk (ID) ALWAYS;

-- throttle snapshot scope to avoid redo storms (choose limited tables)
-- and plan off-hours if tables are huge
```

## Connector Notes

- Prefer narrow includes/filters to reduce LogMiner workload.
- Measure redo switch rate before and after snapshot.
- Have a plan for LOBs (exclude or route separately if large).

```
{
  "name": "oracle-cdc",
  "config": {
    "connector.class": "io.debezium.connector.oracle.OracleConnector",
    "database.hostname": "oracle",
    "database.port": "1521",
    "database.user": "CDC",
    "database.password": "CDC",
    "database.dbname": "ORCLCDB",
    "database.pdb.name": "ORCLPDB1",
    "topic.prefix": "server1",
    "schema.include.list": "APP",
    "table.include.list": "APP.CUSTOMER",
    "tombstones.on.delete": "false",
    "include.schema.changes": "false",
    "snapshot.mode": "initial",
    "errors.tolerance": "all",
    "errors.deadletterqueue.topic.name": "dlq.oracle"
  }
}
```

## Verify

```
-- generate a change
UPDATE APP.CUSTOMER SET EMAIL = EMAIL || '.X' WHERE ROWNUM = 1;

-- redo activity sample
SELECT TO_CHAR(first_time, 'YYYY-MM-DD HH24:MI') AS t, COUNT(*) AS switches
FROM v$log_history
WHERE first_time > SYSDATE - 1/24
GROUP BY TO_CHAR(first_time, 'YYYY-MM-DD HH24:MI');
```

```
kafka-console-consumer --bootstrap-server localhost:9092 \
  --topic server1.APP.CUSTOMER --from-beginning --max-messages 5
```

## Acceptance (target/sink)

- No duplicate PKs after connector restart.
- Latest-wins per key by (SCN, tie-break) (log position plus its tie-break; see [Oracle notes](https://sandgraal.github.io/letstalkcdc/oracle-notes/)), not a commit timestamp.
- DLQ empty or only expected test errors.

```
SELECT COUNT(*) AS rows, COUNT(DISTINCT ID) AS distinct_keys
FROM TARGET_CUSTOMERS;
```

## Safe Rollback

Pause the connector and retain archived logs until downstream systems are consistent. If schema or log-group changes are needed, plan a clean re-snapshot of affected tables.

## Next steps

- Understand the initial load behind `snapshot.mode=initial` in [Snapshotting (Initial Load)](https://sandgraal.github.io/letstalkcdc/snapshotting/).
- Route and fix poison messages with the [DLQ Triage Assistant](https://sandgraal.github.io/letstalkcdc/dlq-triage/), and keep the [first-15-minutes playbook](https://sandgraal.github.io/letstalkcdc/troubleshooting/) handy.
- For a commercial, log-based alternative see the [Oracle GoldenGate lab](https://sandgraal.github.io/letstalkcdc/cloud-labs/goldengate/).
- Other databases: [Postgres quickstart](https://sandgraal.github.io/letstalkcdc/quickstarts/quickstart-postgres/), [MySQL quickstart](https://sandgraal.github.io/letstalkcdc/quickstarts/quickstart-mysql/), [SQL Server quickstart](https://sandgraal.github.io/letstalkcdc/quickstarts/quickstart-mssql/).

---

CDC: The Missing Manual by Christopher Ennis (Let's Talk CDC), licensed under CC BY 4.0 (https://creativecommons.org/licenses/by/4.0/). Attribution is required.
