Best Practices
|
This content was generated with the assistance of AI and should be verified against the official documentation before being relied on in production. |
This page collects the advice of the whole Database Migration section into one checklist. It follows the order in which a migration happens: preparing the plan, setting up the legacy source, loading the existing data, streaming changes, applying them in sinks and consumers, proving that the new database is right, cutting over, operating the pipeline, and finally taking it apart. Every item has a short rationale and links to the page that explains the details, so the checklist can be printed and used in reviews without repeating the reasoning.
A Debezium migration rarely fails because a property is missing. It fails because an assumption nobody wrote down turns out to be false at the worst moment: archive logs that were deleted during a long outage, a consumer that applied an old event twice, a replication slot that nobody dropped, a rollback that was never rehearsed. A checklist turns those assumptions into items that someone has to tick, and the phase structure says when they have to be ticked.
Checked on 2026-11-09 against Debezium 3.7.1.Final, Kafka 4.x in KRaft mode, Oracle AI Database 26ai Free (image
gvenzl/oracle-free:23.26.3, PDB FREEPDB1), PostgreSQL 18 and Spring Boot 4.1 with Spring for Apache Kafka 4.1. The checklist and the baseline configuration are
derived from the other pages of this section and from the official Debezium documentation; they were not run as a
separate test.
How to use the checklist
The phases are those of Migration Patterns with CDC: snapshot and streaming, parallel run and reconciliation, read cut-over, write cut-over with reverse replication, and decommission. This page groups its checklist into nine working stages instead (preparation, source setup, initial load, streaming, consumers and sinks, verification, cut-over, operations and decommissioning), because setting up the source or the consumers is different work from running them. Where an item names an exit criterion, it refers to the migration phase of that page (for example "the parallel run"), not to a checklist stage.
Two rules apply to the whole list:
-
Track the phase per table, not per database. The Bookshop catalogue (
BOOK,AUTHOR) can be in the write cut-over whileORDERSandORDER_LINEare still in the parallel run. Keep one document that lists every legacy table, its current phase, its source of truth and the connectors that touch it, and go through the checklist per capability. -
An unticked item blocks the next phase. If an item does not apply, write down why. "Not applicable" is a decision; an empty box is not.
The gates between the phases look like this:
Operations is not a phase that starts after the others. Monitoring and alerting must be in place before the first production snapshot, which is why the operations checklist is referenced from the source setup.
Preparation
| Item | Rationale |
|---|---|
|
Dual writes, batch ETL, triggers and timestamp polling each lose changes or load the legacy database in ways that are hard to see. Recording why CDC was chosen keeps the decision from being reopened mid-migration. See Migration Strategies. |
|
Two writers for the same rows produce loops and conflicting updates that no pipeline can resolve. The source of truth moves per table, with a short write freeze. See Migration Patterns with CDC. |
|
A strangler-fig migration moves one capability at a time. Exit criteria such as "reconciliation clean for a full business cycle" make the decision to move on measurable. See Migration Overview and Feature flags and cohort-based cut-over. |
|
Kafka Connect, Debezium Server or the embedded engine; a JDBC sink or a hand-written consumer; |
|
Change events copy personal data into Kafka topics, logs and dead-letter topics, often with a longer retention than the legacy database. Deciding per column before the first snapshot is much cheaper than deleting data from topics later. See Security & Data Protection. |
|
A topic has exactly one format, set by the source connector’s converters. The
JDBC Sink Connector needs the schema: with schemaless JSON it skips
every record as not being a Debezium record. Bookshop therefore uses JSON with schemas enabled, which the Spring
consumer of Listening to Events in Applications
also reads (it unwraps the |
|
|
|
Without a number, nobody can decide whether the pipeline is healthy or whether the read cut-over is safe. The objective also sizes the alerts. See Verification & Reconciliation. |
|
The snapshot duration, the redo volume, the consumer throughput and the cut-over itself have to be rehearsed on real volumes. A lab with a few hundred rows proves only that the configuration parses. See Testing CDC Pipelines. |
|
Archive log retention, Kafka disk, topic retention and sink throughput all depend on numbers that are only known after measuring the legacy workload. |
Source setup
The legacy database
| Item | Rationale |
|---|---|
|
LogMiner reads the redo and archive logs. If the logs for the stored offset SCN are gone, the connector cannot resume and the only safe recovery is a new snapshot. See Oracle Connector. |
|
Without all-column logging an update event lacks the columns that did not change, so the sink cannot rebuild the row.
A missing database-level setting shows up as |
|
The documented |
|
The record key decides the partition, and with it the ordering per row, the upsert in the sink and the compaction of
the topic. On Oracle, a table without a primary key needs |
|
With |
|
|
|
Incremental snapshots, ad hoc re-reads and pausing a snapshot all depend on it. Without the |
|
Every schema change on a captured table must be known before it runs, applied in an order that the connector and the consumers survive, and followed by a reconciliation that includes the new column. See Handling Schema Changes. |
The connector
| Item | Rationale |
|---|---|
|
Each Oracle connector runs one LogMiner session, and each PostgreSQL connector holds one slot. A second connector doubles the load on the legacy database and the operational state. Add tables to the existing connector, with an incremental snapshot, instead. See Incremental & Blocking Snapshots. |
|
The prefix is part of every topic name and of the offset key. Changing it creates a new connector that starts with a new snapshot, and the old topics stop receiving changes. See Debezium Architecture. |
|
In CDB mode a quiet |
|
|
|
Non-zero values let the connector abandon long-running transactions, and an abandoned transaction is data missing on the target. Use them only when data loss followed by reconciliation is an accepted trade-off. |
|
The connector rebuilds its schema model from this topic at every start. A compacted, multi-partition or truncated history makes the next restart fail or, worse, decode rows with the wrong structure. See The schema history topic. |
|
Without a default topic creation group, Kafka Connect does not create the topics, or the broker defaults apply. Compacted catalogue topics let a new consumer rebuild state without a new snapshot. See Installing Debezium. |
|
Connector configurations are stored in plain text in the config topic and returned by the REST API. See Keeping secrets out of connector configurations. |
|
The first snapshot is when the pipeline is most likely to fail, and its metrics are the evidence for the exit criterion of the snapshot-and-streaming phase. |
A baseline for the Bookshop Oracle source
The configuration below combines the connector of the Oracle Connector page with the settings that the JDBC mirror sink and the Spring Boot anti-corruption layer of Listening to Events in Applications depend on: JSON with embedded schemas, decimals as strings and transaction metadata. The password comes from the environment through a configuration provider, which must be enabled on the worker.
{
"name": "bookshop-oracle-source",
"config": {
"connector.class": "io.debezium.connector.oracle.OracleConnector",
"tasks.max": "1",
"database.hostname": "oracle",
"database.port": "1521",
"database.user": "c##dbzuser",
"database.password": "${env:BOOKSHOP_ORACLE_PASSWORD}",
"database.dbname": "FREE",
"database.pdb.name": "FREEPDB1",
"topic.prefix": "legacy",
"database.connection.adapter": "logminer",
"log.mining.strategy": "hybrid",
"log.mining.query.filter.mode": "in",
"lob.enabled": "false",
"table.include.list": "BOOKSHOP.BOOK,BOOKSHOP.AUTHOR,BOOKSHOP.CUSTOMER,BOOKSHOP.ORDERS,BOOKSHOP.ORDER_LINE,BOOKSHOP.SUPPLIER_CATALOGUE,BOOKSHOP.DEBEZIUM_HEARTBEAT",
"snapshot.mode": "initial",
"snapshot.locking.mode": "shared",
"include.schema.changes": "true",
"schema.history.internal.kafka.bootstrap.servers": "kafka:9092",
"schema.history.internal.kafka.topic": "legacy.schema-history",
"schema.history.internal.store.only.captured.tables.ddl": "false",
"key.converter": "org.apache.kafka.connect.json.JsonConverter",
"key.converter.schemas.enable": "true",
"value.converter": "org.apache.kafka.connect.json.JsonConverter",
"value.converter.schemas.enable": "true",
"decimal.handling.mode": "string",
"provide.transaction.metadata": "true",
"tombstones.on.delete": "true",
"signal.enabled.channels": "source,kafka",
"signal.data.collection": "FREEPDB1.BOOKSHOP.DEBEZIUM_SIGNAL",
"signal.kafka.topic": "legacy.signals",
"signal.kafka.bootstrap.servers": "kafka:9092",
"notification.enabled.channels": "sink,log",
"notification.sink.topic.name": "legacy.notifications",
"heartbeat.interval.ms": "10000",
"heartbeat.action.query": "UPDATE BOOKSHOP.DEBEZIUM_HEARTBEAT SET LAST_BEAT = SYSTIMESTAMP WHERE ID = 1",
"topic.creation.default.replication.factor": "3",
"topic.creation.default.partitions": "1",
"topic.creation.default.cleanup.policy": "delete",
"topic.creation.default.retention.ms": "1209600000"
}
}
Reference: Debezium — Oracle connector properties
Why these values:
-
Connection and mining are those of the Oracle page: the CDB
FREEasdatabase.dbname, the PDBFREEPDB1, the defaultlogmineradapter with thehybridstrategy, and LOB capture off (Bookshop has no LOB columns, andhybridrequireslob.enabled=false). -
schema.history.internal.store.only.captured.tables.ddl=falseis the default. It is written down because the cut-over relies on it: the history keeps trackingBOOKandAUTHORafter they are removed from the include list, so a rollback can add them back without a recovery snapshot. -
JSON with schemas enabled is what the JDBC mirror sink needs: with schemas disabled it skips every record because it does not recognise a Debezium record. The anti-corruption layer unwraps the
payload. The messages are larger; Avro with Apicurio Registry is the alternative when volume matters, as described in Serialization & Schema Registries. Whatever you choose, every consumer of a topic must read the same format. -
decimal.handling.mode=stringturns every OracleNUMBERinto a string, including integer keys such as"BOOK_ID":"7". The consumer converts prices toBigDecimalwithout loss, and the mirror sink needs?stringtype=unspecifiedat the end of its JDBC URL so that PostgreSQL casts the strings tobigintandnumeric. -
provide.transaction.metadata=trueandtombstones.on.delete=truegive the consumer its idempotency key (the transaction id and the position in the transaction) and give compaction its delete markers. See Transaction metadata. -
Signals, notifications and heartbeats are needed by incremental snapshots, runbooks that wait for the snapshot, and the "no events" alert.
signal.data.collectionuses the PDB form, and the signal table does not have to be intable.include.list. -
Topic creation gives every table topic one partition, as the official topic recommendations suggest, three replicas and two weeks of retention. Add a compacted group for the catalogue topics if new consumers should be able to rebuild the catalogue from Kafka (see Installing Debezium).
Not in the baseline, but added at a defined moment:
-
log.mining.username.exclude.list=BOOKSHOP_SYNCbefore the reverse sink starts writing to Oracle (cut-over phase). -
exactly.once.support=required, once every Connect worker hasexactly.once.source.support=enabled(operations phase). See Offsets, Restarts & Exactly-Once. -
custom.metric.tags, together with a matching JMX exporter rule (see Monitoring, Logging & Tracing).
Validate the configuration before registering it. Kafka Connect checks property names and values without starting the connector:
jq '.config' bookshop-oracle-source.json \
| curl -s -X PUT -H "Content-Type: application/json" --data @- \
http://localhost:8083/connector-plugins/OracleConnector/config/validate \
| jq '.error_count, [.configs[] | select(.value.errors | length > 0) | .value | {name, errors}]'
An error_count of 0 means the configuration is valid. Database problems (missing grants, a closed PDB, NOARCHIVELOG)
appear only when the task starts.
Initial load
| Item | Rationale |
|---|---|
|
The reverse connector must not snapshot rows that came from Oracle in the first place, or every row is written back to
Oracle a second time. |
|
|
|
The snapshot reads each table with a flashback query at one SCN. A snapshot that outlives the undo fails with
|
|
An initial snapshot is not resumable: a failure at 90 % starts again from zero, and streaming cannot begin until it ends. Incremental snapshots run in chunks, interleave with streaming, and can be paused around the legacy batch window. See Incremental & Blocking Snapshots. |
|
A connector in the snapshot phase and one in the streaming phase both report |
|
The whole table arrives as |
|
The Oracle connector does not support schema changes during an incremental snapshot. |
|
The exit criterion of the snapshot-and-streaming phase. Compare |
Streaming
| Item | Rationale |
|---|---|
|
A legacy transaction that stays open pins the offset SCN. Its changes cannot be emitted before the commit, and the archive logs from its start must be kept. See Monitoring, Logging & Tracing. |
|
Both mean that changes did not reach Kafka. For a migration, any non-zero value is missing data on the target. |
|
|
|
Adding a nullable column first, then using it, then removing the old one keeps the connector, the sink and the consumers working at every step. See Handling Schema Changes and Evolving the Database Model: best practices. |
|
The registry is the only point in the pipeline that can reject a breaking schema change automatically. See Serialization & Schema Registries. |
|
A legacy |
|
A slot that does not advance keeps WAL until the disk fills. Heartbeats fix the common causes. See PostgreSQL Connector. |
Consumers and sinks
| Item | Rationale |
|---|---|
|
Debezium delivers at least once. After a connector restart, changes since the last committed offset are re-emitted at new Kafka offsets. See Features & Delivery Guarantees. |
|
Writing the same row twice gives the same result, and the key comes from the event key, so |
|
Without it the driver sends the string values as |
|
Upserts alone let an old replayed event overwrite newer values for a moment, and some writes are not naturally idempotent. The source position (not the Kafka offset) identifies a change across restarts. See Listening to Events in Applications. |
|
Without it, rows deleted in the legacy database stay in the target and appear as drift in every reconciliation. A
tombstone carries no |
|
Kafka orders events only within a partition. A retry topic or a re-keying transformation lets a newer change of the same row overtake an older one. |
|
A record in a dead-letter topic is a change the new database does not have. The JDBC sink sends failed writes to the
DLQ only with |
|
SMTs are stateless per record. They cannot join |
|
A new Debezium release adds fields to |
|
The placeholder appears for LOB and TOAST columns that the log did not carry. See Data Types & Precision. |
|
Kafka Connect exactly-once covers only the hop from the database to Kafka. The write to PostgreSQL and the Kafka offset commit of the consumer are still two steps. See Offsets, Restarts & Exactly-Once. |
Verification
| Item | Rationale |
|---|---|
|
Counts miss wrong values. A canonical row format hashed on both sides finds them, and comparing at the SCN that the pipeline has reached avoids false alarms from changes still in flight. See Verification & Reconciliation. |
|
Month-end, batch runs and seasonal peaks exercise code paths and data that a quiet week does not. This is the exit criterion of the parallel run. |
|
A clean data comparison does not prove that the new application answers the same questions the same way. See Feature flags and cohort-based cut-over. |
|
The connector metric covers only the source. The sink and the application add their own lag, and the cut-over decision needs the sum. |
|
Re-reading a key range through the signal table repairs the target without stopping streaming or reloading the whole table. See Incremental & Blocking Snapshots. |
|
A pipeline that is green again is not proof that the data is right, for example after a lost log position or a reset. See Troubleshooting & Failure Recovery. |
Cut-over
| Item | Rationale |
|---|---|
|
A read cut-over is rolled back instantly by routing reads back. It also proves the new application under production load while the legacy database is still the source of truth. See Cut-over & Reverse Replication. |
|
Reverse replication that has never run fails when it is needed. The rehearsal also measures the length of the write freeze, which is mostly the final reconciliation. |
|
Registration problems are found before the freeze, not during it. |
|
Draining before reconciling makes the comparison exact; reconfiguring forward capture before reverse starts keeps loops out of the pipeline. |
|
A table captured in both directions echoes every change between the databases. Excluding the reverse writer is the second, independent cut. |
|
Every write after slot creation is retained, even if the connector starts minutes later. With |
|
The smoke test must show that no change written by the reverse writer was captured again on either side. |
|
The first book with two authors, or a new order status, cannot be written back into the legacy model. After that moment a rollback loses data, so it must be chosen, not discovered. |
|
A forgotten slot keeps WAL on the new production database until its disk is full. |
Operations
| Item | Rationale |
|---|---|
|
These are the failures that break a migration silently. Alert on the absence of task metrics too, because a stopped or deleted connector has none. See Monitoring, Logging & Tracing. |
|
The connector cannot see that the DBA’s backup job is about to delete the log it needs next. |
|
Recovery under pressure goes wrong when the steps are improvised. See Troubleshooting & Failure Recovery. |
|
The saved file is the only way back. Resetting a running or paused connector has unpredictable results. See Offsets, Restarts & Exactly-Once. |
|
|
|
On Kubernetes, |
|
The provider resolves the value when the task starts. |
|
Anyone who can call it can read configurations, reset offsets or register a connector that reads any file the worker can see. See Security & Data Protection. |
|
Logged values end up in log storage with its own retention and access rules. |
Decommissioning
| Item | Rationale |
|---|---|
|
Decommissioning is the only phase that is not reversible, except from an archive. See Migration Path: From a Legacy Stack to a Modern One. |
|
A connector re-registered by accident months later under the same name resumes from an old position if its offsets are still stored. See Cut-over & Reverse Replication. |
|
An inactive slot keeps WAL forever. |
|
Leftover users are an attack surface, and supplemental logging increases redo volume for no benefit. |
|
The change topics are the audit trail of what moved and when. Archive |
|
Unused translators and |
Capacity planning
Measure first, on the production clone, then size. The questions below cover the resources that a migration exhausts.
| Resource | Question | Where it is explained |
|---|---|---|
Oracle archive logs |
How much redo does the legacy workload produce per hour, and how many hours of outage must the retention cover? |
|
Oracle undo |
Does |
|
PostgreSQL WAL |
How much WAL can a stopped or lagging slot retain before the disk is full, and what does |
|
Kafka disk |
Snapshot size (rows times event size, which is larger than the row) plus the streaming backlog for the retention period, times the replication factor? |
|
Connector throughput |
Does one task per Oracle connector keep up at peak? Watch |
|
Sink and consumer throughput |
Does the slowest of the mirror sink and the |
|
Partitions |
One partition per table topic keeps the global order of the table; more partitions add parallelism but keep the order only per key. Do the consumers need more than one? |
Common anti-patterns
| Anti-pattern | Why it hurts | Do this instead |
|---|---|---|
Writing to both databases "just during the cut-over" |
Loops and conflicting updates that no pipeline can resolve |
One source of truth per table, a short write freeze, reverse CDC |
A shared "debezium" user with DBA rights |
No audit trail per pipeline, no loop prevention by user, one revocation stops everything |
One least-privilege user per connector |
Changing |
A new connector with a new snapshot; the old topics go silent |
Choose the prefix once; a new prefix is a new pipeline |
No heartbeats on a quiet database |
Offsets stop advancing, WAL or archive logs pile up, alerts on "no events" are useless |
|
Trusting |
Sinks and reconciliation start against half-loaded topics |
Wait for the snapshot-completed notification |
Using tombstones as delete signals |
Tombstones can be disabled and carry no |
Act on the |
Upserts without a replay guard in hand-written consumers |
Old values come back for a moment after a connector restart |
|
Translating the model in SMTs |
Untestable logic in connector JSON, no joins, no reference data |
An anti-corruption layer in the application |
Non-zero |
Long transactions are abandoned and their changes never reach the target |
Leave it at |
|
Changes disappear without a trace |
|
Reconciling with row counts only |
Wrong values go unnoticed until users find them |
Per-chunk checksums at a known SCN |
Cutting over writes without a rehearsed rollback |
The reverse pipeline fails the first time it is needed |
Rehearse cut-over and rollback on staging |
Forgetting a stopped connector’s slot or log position |
A pipeline outage becomes a full disk on a production database |
Alerts on retained WAL and archive logs; drop slots when a connector is retired |
Crossing the point of no return by accident |
A rollback silently loses data the legacy model cannot hold |
Hold back such features until a recorded decision |
References
The checklist is derived from the pages of this section, which link the official documentation for each item, and from these official sources: