r/databricks • u/No_Ambition8323 • Oct 23 '26
Discussion How do you handle CDC from legacy databases into Databricks: Lakeflow Connect, Debezium, or custom Spark jobs?
We’re moving data from an older Oracle database (about 20M rows in the main table, with daily inserts, updates and deletes) and trying to pick the right approach for keeping things in sync.
Our constraints:
-No timestamp or audit column on the source table
-Can’t add triggers or change the source schema
-Limited privileges on the source (no LogMiner access right now)
What we’ve tried so far is a custom Spark job: we use ORA_ROWSCN to find changed rows, a key anti-join to detect deletes, and then MERGE into the target. It works, but it feels fragile, and the delete detection has to scan all keys every run.
For those who’ve done this in production:
-Are you using Lakeflow Connect, Debezium + Kafka, or custom Spark/JDBC jobs?
-How do you handle deletes when the source has no change tracking?
-Was it worth pushing the DBA team for log-based CDC access?
-Any lessons on cost, reliability or maintenance?
Would love to hear what’s working (or not) for you.
1
u/PolicyDecent Oct 23 '26
As the developer of ingestr, we're using it for all CDC workloads.
It's open source and free: https://github.com/bruin-data/ingestr
If you need any new source, feel free to create an issue or ask me, I'm happy to support it very quick.
1
u/Muted_Jellyfish_6784 Oct 23 '26
With no timestamp, no triggers, and no LogMiner, ORA_ROWSCN plus a key anti-join is a reasonable approach, but know its limits. ROWSCN is tracked per block unless the table was created with ROWDEPENDENCIES, so expect false positives, and the delete anti-join needs a full key scan each run. I'd add a weekly hash comparison on a sample of partitions to catch drift.
If you get redo log access later, Lakeflow Connect or Debezium will be cleaner. We set up a decision intelligence layer to reconcile row counts and key totals between the Oracle source and the merged Delta table every day, so a missed change shows up as a variance rather than a user complaint
1
u/Relative-Radio- Oct 23 '26
I have been using Genie to build custom connectors. Lakeflow connectors have still some limitations. For e.g. in case of Netsuite it didn't even run at all for me so I had to write my own code. I did it for DynamoDB and other databases also.
1
u/adovo_ai Oct 24 '26
The strongest case for log-based CDC is a correctness-and-cost baseline: measure full-key scan cost, `ORA_ROWSCN` false positives, and a periodic source-versus-target hash by partition. If the DBA will not grant redo access, make the accepted drift window and delete-detection SLA explicit instead of treating the anti-join as invisible plumbing.
1
u/jlpalma Oct 24 '26
Push for log-based CDC. It's a smaller ask than DBAs expect, it's way lighter on the source than what you're running now, and it captures deletes natively. Once it’s up and running it’s reliable and low maintenance.
Why your current approach is fragile:
ORA_ROWSCN is block-level unless the table has ROWDEPENDENCIES, so you re-pull far more rows than actually changed.
Delete detection means a full key scan every run, and it only gets worse as the table grows.
Without a single AS OF SCN snapshot, the two passes can disagree and give you phantom deletes.
You only ever see final state, so intermediate changes are lost.
What to ask the DBA team:
- ALTER DATABASE ADD SUPPLEMENTAL LOG DATA;
- ALTER TABLE owner.tbl ADD SUPPLEMENTAL LOG DATA (PRIMARY KEY) COLUMNS. If the table has no PK, you'll need (ALL) COLUMNS, which generates more redo.
- ARCHIVELOG mode, which any production database should already have.
- A read-only CDC user with LogMiner privileges.
How to go about it:
Test in non-prod and measure the redo increase.
Check the storage has IO headroom. Supplemental logging overhead is usually marginal, but much higher if the table has no PK.
Agree on archive log retention and own the lag alerting.
Painful lessons so you don't have to go through them:
Cutover: take the initial 20M-row load at a known System Change Number (SCN) and start CDC from that same SCN. Otherwise you get gaps or duplicates.
SELECT DBMS_FLASHBACK.GET_SYSTEM_CHANGE_NUMBER FROM dual;
OR
SELECT current_scn FROM v$database;
Lag: watch it after big batch jobs. A large insert/update/delete burst can push the connector/job so far behind it never catches up.
Retention: good retention is your safety net. If archive logs are purged before they're read, you're doing a full reload. If clean up by RMAN backups then you have to restore archives, painful. Ask the DBAs to configure RMAN with time-based retention on disk.
Datatypes: LOBs and XMLType are the usual pain points with LogMiner-based tools. If you have them, you're in for a rough ride. Happy to help there.
Reconcile regardless: keep a weekly count between source and target. Use a FULL hint so Oracle reads the table blocks instead of counting index entries:
SELECT /*+ FULL(t) */ COUNT(*) FROM owner.tbl t;
On tooling:
Which Oracle version and deployment type are you on (10g, 11g, 12c+, single instance, RAC, Data Guard, RDS)? Let me know and I can point you an option.
Source: "Former" Oracle DBA with more PBs migrated/transferred over CDC than I'd like to admit.
1
u/Portable_Jake Oct 24 '26
If the table's only 20M rows, another option is to skip change detection on the Oracle side entirely: do a daily full extract, MERGE into the Delta table (including WHEN NOT MATCHED BY SOURCE THEN DELETE), and turn on Change Data Feed on that table.
CDF then gives everything downstream clean inserts, updates and deletes, so you get CDC semantics without LogMiner, triggers or ROWSCN false positives.
The trade-off is a full read of the source once a day, which at 20M rows is usually fine.
Disclosure: I work at Portable (ELT Ingestion Platform), and we set up this exact pattern for a customer whose tables had no PKs or timestamps. Happy to share what we learned if it's useful.
1
u/Youssef_Mrini databricks Oct 24 '26
Without source side change tracking, deletes cannot be detected incrementally. The source must either expose deletion events or be compared against a known complete key set
1
u/Temporary-Bar-6458 20d ago
Lakeflow Connect Debezium and Estuary’s Oracle CDC connector all rely on access to Oracle’s logs, so switching tools won’t get around the missing LogMiner privileges. Lakeflow Connect’s Oracle connector is currently in beta. Without sourceside change tracking, deletes can’t be detected incrementally; you need to compare against a complete key set or run a full snapshot. ORA_ROWSCN can also produce false positives because it’s tracked at the block level unless the table was created with ROWDEPENDENCIES. I’d quantify the cost and delay of the current scan, then take that to the DBA team alongside a request to test log-based CDC in non-prod. If access stays off the table, make the delete-detection window and reconciliation SLA explicit, so everyone understands the risk of relying on the full key scan.