Migration Strategies: Big Bang, Dual Writes, Batch ETL and CDC
|
This content was generated with the assistance of AI and should be verified against the official documentation before being relied on in production. |
A legacy database rarely gets migrated in one go. The Bookshop example used throughout this section keeps its legacy
Java EE/Struts application writing to the BOOKSHOP schema in Oracle while the new Spring Boot bookshop application
grows on PostgreSQL. For months both databases hold overlapping data, and something has to move every committed change
from one to the other. This page compares the six techniques teams use to do that, judges each one by the same criteria,
and explains why this section builds on log-based change data capture (CDC) with Debezium.
Migration Overview already argues against the big-bang rewrite in general, and Migration Path: From a Legacy Stack to a Modern One already names dual writes and CDC as the two ways to keep the databases in sync during the overlap. This page goes one level deeper. It looks at the data side only, adds the four strategies those pages do not cover (big-bang dump and restore, batch ETL, triggers and polling), and shows with concrete Bookshop timelines where each strategy loses data. The next page, Migration Patterns with CDC, takes the chosen strategy and turns it into a sequence of migration phases.
Checked on 2026-11-09 against Debezium 3.7.1.Final, Oracle AI Database 26ai Free (image gvenzl/oracle-free:23.26.3,
PDB FREEPDB1) and PostgreSQL 18. The SQL and Java on this page are derived from the official documentation listed
under References and were not run. The connector configuration is a copy of the canonical
bookshop-oracle-source configuration that the
worked example registered and ran; it was not run
again on this page.
The criteria every strategy is judged by
A data-migration strategy is the mechanism that answers one question for the whole overlap period: when a row changes in the legacy database, how and when does the new database learn about it? Six criteria decide whether an answer is good enough for a production migration.
| Criterion | What it asks |
|---|---|
Consistency |
Does the new database end up with exactly the committed state of the legacy one, with no lost changes, no changes from rolled-back transactions, and changes to the same row applied in commit order? |
Deletes |
When a row is deleted in the legacy database, does the deletion reach the new database, or does the row live on there forever? |
Latency |
How long after the legacy commit does the change become visible in the new database? Seconds decide whether the strangler proxy can route reads to the new system while writes still go to the legacy one. |
Load on the legacy database |
How much extra CPU, I/O, locking and storage does the strategy add to a database that is often already the most fragile part of the legacy estate? |
Code changes in the legacy application |
Does the legacy application (the Struts WAR, its stored procedures, its batch jobs) have to change? Every change there is tested and deployed on a platform that is on its way out, which Migration Overview advises to minimise. |
Reversibility |
Can the strategy run in the other direction after the write cut-over, so that the legacy system can take over again if the new one fails? |
The rest of the page applies these six criteria to each strategy in turn, then collects the verdicts in one decision table.
Strategy 1: big-bang dump and restore
How it works
The application is stopped (or switched to read-only), the whole legacy schema is exported, transformed, loaded into
the new database, checked, and then the new application is started against it. There is no overlap period at all:
before the cut-over only the legacy database exists, and after it only the new one does. Tools vary (Oracle Data Pump to
a staging Oracle, a migration tool that reads Oracle and writes PostgreSQL, a set of COPY scripts fed from flat-file
exports), but the shape is always the same: freeze, copy, verify, switch.
Where it fits and where it breaks
Big-bang copy is simple and its consistency is perfect: with writes frozen, the copy is a single consistent image. It
has no deletes problem, needs no change in the legacy code and adds load only during the copy. Its cost is the
downtime window, which grows with the data volume and with every transformation and check that has to run inside
it. For Bookshop, the ORDERS and ORDER_LINE tables hold years of history, and the reconciliation queries alone would
take longer than the business accepts for a shop that sells around the clock.
It also breaks the strangler fig. With a single switch moment, the new application has to take over every capability at once, which is exactly the big-bang rewrite the architecture pages argue against. If something goes wrong a day later, there is no cheap way back: the legacy database stopped receiving writes at the switch, so rolling back means either losing a day of orders or writing a second, reverse big-bang migration under pressure.
Big-bang copy still has a place inside an incremental migration:
-
For small, rarely changing reference tables (currency codes, country lists), a one-off copy during a deployment is cheaper than running a pipeline for them.
-
For archive data that nobody writes any more (orders closed ten years ago), a one-off bulk copy avoids pushing millions of historic rows through the change stream.
-
The initial snapshot that a CDC connector takes before it starts streaming is itself a bulk copy, but one that does not need a write freeze, as Initial Snapshots explains.
Strategy 2: application dual writes
How it works
The legacy application is changed so that every write goes to both databases: the existing Oracle UPDATE and a new
PostgreSQL UPDATE, in the same request. For the price change of a book it looks like this.
public void changePrice(long bookId, BigDecimal newPrice) {
// 1. Legacy write: Oracle, local JTA transaction of the WAR
oracleJdbc.update(
"UPDATE BOOKSHOP.BOOK SET PRICE = ?, LAST_UPD = SYSDATE WHERE BOOK_ID = ?",
newPrice, bookId);
// 2. New write: PostgreSQL, a second, independent connection
postgresJdbc.update(
"UPDATE book SET price = ?, updated_at = now() WHERE id = ?",
newPrice, bookId);
// No transaction spans both databases: a crash, a timeout or a rollback
// between or after these two statements leaves them disagreeing.
}
What goes wrong
Transactional Outbox already states the dual-write problem precisely for a database and a broker: commit then crash before the second write, or write the second system and then roll back the first. Both failures apply unchanged when the second system is a database. A migration adds three more problems that the outbox page does not need to discuss:
-
Concurrent writers apply changes in different orders. Two requests change the price of book 42 at almost the same time. Request A writes Oracle first, request B writes Oracle second, so Oracle ends with B’s price. The PostgreSQL writes race independently, and if A’s PostgreSQL write arrives last, PostgreSQL ends with A’s price. Both writes "succeeded", both databases are healthy, and they disagree forever. Nothing records which one is right.
-
Every write path has to be found. The legacy Bookshop writes to
BOOKfrom Struts actions, from thePRICING_PKGstored procedures, from the nightly supplier feed and from ad hoc SQL that operators run by hand. A dual write covers only the paths that were found and changed. The ones that were missed fail silently. -
The legacy code changes most where it is least safe to change. Dual writes put new connection pools, configuration and failure handling inside the legacy WAR, on WebLogic, in the code base the migration is trying to retire.
The sequence below shows the most common failure. The legacy transaction commits, the second write times out, and the two databases now differ with no record of the gap.
With log-based CDC the legacy application performs only its own write. The change reaches PostgreSQL because it is in the Oracle redo log, and a failure on the way only delays it.
Verdict
Dual writes are acceptable only where the legacy migration path already allows them: low-stakes data where a divergence is cheap to detect and fix. For anything that has to be correct, they are the strategy this section is written to avoid.
Strategy 3: batch ETL
How it works
A scheduled job (nightly, hourly) extracts rows from the legacy database, transforms them into the new model and loads them into the new database. Most teams already run something like this for reporting, so it is a familiar first answer. The load step is usually an upsert from a staging table.
-- staging_book was filled by the extract step with a full copy of BOOKSHOP.BOOK
INSERT INTO book (id, isbn, title, price, currency, published_on, active, supplier_id, updated_at)
SELECT s.book_id,
s.isbn,
s.title,
s.price,
s.currency,
s.published::date,
s.active_flg = 'Y',
s.supplier_id,
s.last_upd AT TIME ZONE 'Europe/Madrid'
FROM staging_book s
ON CONFLICT (id) DO UPDATE
SET isbn = EXCLUDED.isbn,
title = EXCLUDED.title,
price = EXCLUDED.price,
currency = EXCLUDED.currency,
published_on = EXCLUDED.published_on,
active = EXCLUDED.active,
supplier_id = EXCLUDED.supplier_id,
updated_at = EXCLUDED.updated_at;
-- Deletes need a separate anti-join, which only works with a FULL extract
DELETE FROM book b
WHERE NOT EXISTS (SELECT 1 FROM staging_book s WHERE s.book_id = b.id);
Reference: PostgreSQL — INSERT … ON CONFLICT
What goes wrong
-
Latency is the batch interval. With a nightly job, the new database is up to a day behind. The strangler proxy cannot send any read to the new application for data that the legacy one still writes, because users would see yesterday’s prices.
-
Deletes need a full extract. An incremental extract (only rows changed since the last run) cannot see rows that no longer exist. Detecting deletes means extracting all keys every time and anti-joining, as in the example above, which costs a full table scan per run on the legacy side.
-
The extract is not a consistent image unless it runs in one read-consistent transaction (an Oracle flashback query at one SCN, for example). A job that extracts
ORDERSand thenORDER_LINEa minute later can load order lines for orders it has not seen. -
Load on the legacy database is concentrated. A full scan of
ORDER_LINEcompetes with the night-time batch jobs that the legacy system already runs, and ETL windows tend to grow until they collide.
Strategy 4: trigger-based capture
How it works
Database triggers on each legacy table write every change into a change table inside the same transaction. A relay process reads the change table, publishes or applies each row, and then deletes it. Because the trigger runs inside the legacy transaction, a rolled-back write leaves no change row, and a delete fires the trigger like any other write.
CREATE TABLE BOOKSHOP.BOOK_CHANGES (
CHANGE_ID NUMBER GENERATED ALWAYS AS IDENTITY PRIMARY KEY,
OP CHAR(1) NOT NULL, -- 'I', 'U' or 'D'
BOOK_ID NUMBER(10) NOT NULL,
PRICE NUMBER(10,2),
ACTIVE_FLG CHAR(1),
CHANGED_AT TIMESTAMP DEFAULT SYSTIMESTAMP NOT NULL
);
CREATE OR REPLACE TRIGGER BOOKSHOP.BOOK_CDC_TRG
AFTER INSERT OR UPDATE OR DELETE ON BOOKSHOP.BOOK
FOR EACH ROW
BEGIN
IF DELETING THEN
INSERT INTO BOOKSHOP.BOOK_CHANGES (OP, BOOK_ID, PRICE, ACTIVE_FLG)
VALUES ('D', :OLD.BOOK_ID, :OLD.PRICE, :OLD.ACTIVE_FLG);
ELSIF UPDATING THEN
INSERT INTO BOOKSHOP.BOOK_CHANGES (OP, BOOK_ID, PRICE, ACTIVE_FLG)
VALUES ('U', :NEW.BOOK_ID, :NEW.PRICE, :NEW.ACTIVE_FLG);
ELSE
INSERT INTO BOOKSHOP.BOOK_CHANGES (OP, BOOK_ID, PRICE, ACTIVE_FLG)
VALUES ('I', :NEW.BOOK_ID, :NEW.PRICE, :NEW.ACTIVE_FLG);
END IF;
END;
/
What goes wrong
Triggers fix the consistency and delete problems of dual writes and batch ETL, and they do it without touching the application code. The price is paid elsewhere:
-
Every legacy write gets slower. Each
UPDATEofBOOKnow performs a second insert, generates more redo and undo, and holds its locks longer. On hot tables such asORDERSthis is measurable, and it lands on the production database of the system that the business still depends on. -
The legacy schema changes. New tables, new triggers and new grants have to be reviewed, deployed and maintained in the legacy schema, often by a DBA team that owns that schema and has its own change process. When a column is added to
BOOK, someone has to remember to change the trigger, or the new column is never captured. -
The relay is still a polling publisher. Something has to read
BOOK_CHANGES, apply each row and delete it, with all the batching, ordering and at-least-once concerns that Transactional Outbox describes for the polling publisher. Ordering byCHANGE_IDis not commit order when two transactions interleave: the identity value is assigned at insert time, not at commit time. -
Bulk operations and some paths bypass row triggers. Direct-path loads,
TRUNCATE, and partition exchanges do not fire row-level triggers. Neither does an operator who disables triggers to speed up a data fix.
Verdict
Trigger-based capture was the standard answer before log-based tools existed, and it is still the fallback on a database for which no log-based connector exists. On Oracle, PostgreSQL, MySQL, SQL Server, Db2 and MongoDB, a log-based connector gives the same guarantees without the write overhead and without the schema changes.
Strategy 5: query-based capture (polling an update timestamp)
How it works
A poller runs the same query every few seconds: give me every row whose last-update column is newer than the last one I
saw. The Confluent JDBC source connector implements exactly this pattern with its timestamp, incrementing and
timestamp+incrementing modes. The legacy BOOK table has a LAST_UPD DATE column, so the query looks like
this.
-- :last_seen_upd and :last_seen_id are the high-water mark stored by the poller
SELECT BOOK_ID, ISBN, TITLE, AUTHOR_ID, PRICE, CURRENCY, PUBLISHED,
ACTIVE_FLG, SUPPLIER_ID, LAST_UPD
FROM BOOKSHOP.BOOK
WHERE LAST_UPD > :last_seen_upd
OR (LAST_UPD = :last_seen_upd AND BOOK_ID > :last_seen_id)
ORDER BY LAST_UPD, BOOK_ID
FETCH FIRST 1000 ROWS ONLY;
What goes wrong
Polling is attractive because it needs only a SELECT grant. It is also the strategy that loses data most quietly.
-
Deletes are invisible. A deleted row no longer matches any query. The Confluent documentation says it directly about the
incrementingmode: it "will not detect modifications or deletions of existing rows". Thetimestampmodes detect modifications, but no mode detects deletes. The usual workaround is a soft delete (ACTIVE_FLG = 'N'), which is a change to the legacy application. -
Intermediate states are lost. If book 42 changes three times between two polls, the poller sees only the last state. For a price that may be acceptable. For an order whose
STATUS_CDwentNW→PD→CN(new, paid, cancelled) between polls, the new system never learns that a payment happened and has to be refunded. -
The timestamp must be right on every write path.
LAST_UPDis set by the Struts code, but not by thePRICING_PKGprocedure that the supplier feed calls, nor by operators' manual fixes. Every path that forgets to set it produces a change the poller never sees. -
Long transactions commit "in the past".
LAST_UPD = SYSDATEis evaluated when the statement runs, not when the transaction commits. A batch job that updates book 42 at 10:00:00 and commits at 10:00:20 is invisible to a poll at 10:00:10 (not committed yet), and the poll at 10:00:30 has already moved its high-water mark past 10:00:00. The change is skipped permanently. Pollers work around this with a delay (timestamp.delay.interval.msin the Confluent connector), which trades latency for a smaller, but non-zero, risk. -
Oracle
DATEhas one-second precision. Many rows share the sameLAST_UPD, which is why the query above needs theBOOK_IDtie-breaker, and why it still fails when a row with a lowerBOOK_IDcommits later in the same second. -
Load grows with the polling frequency. Every poll is a range query on
LAST_UPD, which needs an index that the legacy schema may not have. Polling more often lowers latency and raises load. Polling less often does the opposite and widens every window above.
Strategy 6: log-based change data capture
How it works
Every relational database already writes each committed change to a log before it acknowledges the commit: the redo log in Oracle, the write-ahead log (WAL) in PostgreSQL, the binary log in MySQL and MariaDB, the transaction log in SQL Server (read through its CDC tables), and the oplog behind MongoDB change streams. The database uses this log for crash recovery and replication. A log-based CDC tool reads the same log, in commit order, and turns each committed row change into an event. microservices.io calls this pattern transaction log tailing.
Debezium is a set of such readers, packaged as Kafka Connect source connectors (and as Debezium Server and the Debezium
Engine, compared on Debezium Architecture). For the legacy Bookshop
database, the Oracle connector mines the redo log through LogMiner and publishes one Kafka topic per captured table,
named <topic.prefix>.<schema>.<table>.
{
"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": "dbz",
"database.dbname": "FREE",
"database.pdb.name": "FREEPDB1",
"topic.prefix": "legacy",
"table.include.list": "BOOKSHOP.AUTHOR,BOOKSHOP.BOOK,BOOKSHOP.CUSTOMER,BOOKSHOP.ORDERS,BOOKSHOP.ORDER_LINE,BOOKSHOP.SUPPLIER_CATALOGUE",
"snapshot.mode": "initial",
"decimal.handling.mode": "string",
"log.mining.strategy": "hybrid",
"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",
"provide.transaction.metadata": "true",
"heartbeat.interval.ms": "10000",
"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",
"notification.sink.topic.name": "legacy.notifications"
}
}
Reference: Debezium — Oracle connector configuration example and Debezium — Oracle connector properties
A few details of this configuration matter for the comparison:
-
table.include.listuses the<schema_name>.<table_name>format, anddatabase.pdb.namepoints the connector at the pluggable database, because Oracle AI Database 26ai Free runs as a container database (FREE) withFREEPDB1inside it. -
snapshot.mode=initial(the default) makes the connector copy the current content of each table once, and then stream changes from the log position at which the snapshot was taken. The bulk copy and the change stream join without a gap and without freezing writes. -
log.mining.strategy=hybridresolves table and column names from the live data dictionary and the connector’s own schema model, so that DDL on the legacy tables is tracked without writing the dictionary to the redo logs. The default,online_catalog, cannot track DDL.redo_log_catalogis deprecated. -
decimal.handling.mode=stringsends every OracleNUMBER(prices and keys alike) as an exact string, andprovide.transaction.metadata=truetags each event with its legacy transaction. The signal settings let an operator re-snapshot one table later through theBOOKSHOP.DEBEZIUM_SIGNALtable or thelegacy.signalstopic, a heartbeat record every 10 seconds shows that the connector is alive, and progress notifications go tolegacy.notifications. No converter is set: the Kafka Connect worker’s defaultJsonConverterembeds the schema in every key and value. Oracle Connector explains each property. -
kafka:9092is the broker address inside the Docker or Kubernetes network where Kafka Connect runs. Clients on the host uselocalhost:9092.
The full set of prerequisites (archive log mode, supplemental logging, the C##DBZUSER common user and its LogMiner
grants) is on Oracle Connector.
What it gives the migration
The Debezium documentation lists five properties that set log-based CDC apart from polling and dual writes. Each one answers a failure described above.
| Property of log-based CDC | Failure it removes |
|---|---|
All committed changes are captured, in commit order |
Lost intermediate states (polling), concurrent writers applied in different orders (dual writes), long transactions that commit "in the past" (polling) |
Changes arrive with a very low delay (milliseconds to seconds) without polling queries |
Batch latency (ETL), the latency/load trade-off of polling |
No change to the data model, such as a last-update column |
Forgotten |
Deletes are captured |
Rows that live on forever in the new database (polling, incremental ETL) |
Old row state and metadata (transaction ID, source position, and on some databases the user) are available |
No way to tell which change came from where, which matters for loop prevention in reverse replication |
What it costs
Log-based CDC is not free, and the rest of this section is largely about paying these costs well:
-
Database prerequisites. Oracle needs
ARCHIVELOGmode and supplemental logging, which increases redo volume. PostgreSQL needswal_level=logicaland a replication slot, which retains WAL until the connector confirms it. MySQL needs a row-based binary log. Each source connector page lists them. -
Some load on the source is unavoidable. The Debezium FAQ is explicit that running a connector "may place additional load on the source database". For Oracle, LogMiner sessions use CPU and PGA on the database server. The load is much lower than frequent polling or triggers on every write, but it has to be measured, as Monitoring, Logging & Tracing describes.
-
New infrastructure to operate. Kafka, Kafka Connect, connector offsets and the schema history topic all need monitoring, backups and upgrades. Choosing a Deployment compares lighter options such as Debezium Server.
-
At-least-once delivery. After a crash, the connector restarts from its last stored offset and may emit some events again. Consumers must be idempotent, which the
processed_changetable and the upsert mode of the JDBC sink provide. Features & Delivery Guarantees explains the redelivery window. -
Row changes are not domain events. The events describe what happened to
BOOKSHOP.BOOK, in the legacy model’s shape, withACTIVE_FLGandSTATUS_CDcodes. Something on the new side has to translate them, which is the anti-corruption layer described on Migration Patterns with CDC.
Why log-based CDC sees what polling misses
The difference is easiest to see on one row. The timeline below shows book 42 in the legacy BOOK table between two
polls of a query-based poller that runs every 60 seconds, and what each strategy delivers to PostgreSQL.
| Time | Legacy action (committed) | Poller sees (poll at 10:01:00) | Log-based CDC emits |
|---|---|---|---|
10:00:05 |
|
— |
|
10:00:20 |
|
— |
|
10:00:40 |
|
— |
|
10:00:55 |
|
— |
|
10:01:00 |
— |
Nothing: the row no longer exists |
— |
The poller never learns that book 42 existed. Had the delete happened a minute later, the poller would have copied book
42 with price 9.99, and the row would then have stayed in PostgreSQL forever after the delete. Log-based CDC delivers all
four committed changes, in order, with the before and after image of each, because all four are in the redo log
whether or not the application maintained LAST_UPD.
Two more effects follow from reading the log instead of the tables:
-
Rolled-back work never appears. The connector emits only committed transactions. A Struts request that updates
ORDERSand then rolls back on a validation error produces no event, unlike a dual write that may have already reached the second database. -
Downtime does not lose history. When the connector is stopped for an hour, it resumes from its stored log position and replays every change of that hour, as long as the logs are still available. This is why the archive log retention on the legacy database must be longer than the longest connector outage that the team plans to tolerate. A poller that is down for an hour sees only the final state of each row when it comes back.
Decision table
The table summarises the six strategies against the criteria from the start of the page.
| Strategy | Consistency | Deletes | Latency | Load on legacy DB | Legacy code changes | Reversible after cut-over |
|---|---|---|---|---|---|---|
Big-bang dump and restore |
Perfect, inside a write freeze |
Yes (full copy) |
N/A (downtime window) |
High, once |
None |
Only by a second big bang |
Application dual writes |
Weak: no atomicity, races between writers |
Only where coded |
Immediate |
Low |
Every write path |
Yes, but with the same weaknesses |
Batch ETL |
Weak unless the extract is one consistent read |
Only with full extracts and anti-joins |
Hours (batch interval) |
High, periodic |
None |
Yes, with the same latency |
Trigger-based capture |
Good (in-transaction), relay ordering needs care |
Yes |
Seconds (relay interval) |
Higher on every write |
Schema changes (triggers, change tables) |
Yes, with triggers on the new DB |
Query-based polling |
Weak: misses intermediate states and late commits |
No |
Seconds to minutes (poll interval) |
Medium, grows with frequency |
Needs a reliable last-update column |
Partly |
Log-based CDC (Debezium) |
Strong: every committed change, in commit order, at least once |
Yes, with before image |
Milliseconds to seconds |
Low to medium (log reading) |
None |
Yes, with a source connector on the new DB |
A simple way to read the table: any strategy with "No" in the deletes column, or with "Every write path" in the code changes column, is unsuitable as the backbone of a strangler migration. Of the remaining ones, batch ETL rules out read cut-over because of its latency, and triggers add load where it hurts most. That leaves log-based CDC as the default, with a bulk copy for archive data and small reference tables.
The decision flow below captures the same reasoning as a set of questions.
Combining strategies: the Bookshop choice
Real migrations mix strategies per table. The choice depends on how often a table changes, whether its rows are ever deleted, and how large it is. For the legacy Bookshop schema the choice is:
| Legacy table | Strategy | Reason |
|---|---|---|
|
Log-based CDC, initial snapshot then streaming |
The catalogue is the first capability to move to the new application. Prices change many times a day, books are deleted, and the new catalogue pages need second-level latency. |
|
Log-based CDC |
Customers are created and deactivated ( |
|
Log-based CDC |
Status transitions ( |
|
One-off bulk copy, then excluded from the snapshot |
Millions of rows that never change. An incremental snapshot with a filter, or a separate one-off copy, avoids pushing them through the initial snapshot. Incremental & Blocking Snapshots shows the filter. |
|
Log-based CDC into a mirror table |
Written by the nightly supplier feed in large bursts. A 1:1 mirror ( |
Currency and country reference data |
Big-bang copy during a deployment |
A few hundred rows that change a few times a year. |
None of these choices changes a line of the legacy Struts application or adds an object to the BOOKSHOP schema other
than the signal table BOOKSHOP.DEBEZIUM_SIGNAL, which Debezium uses to trigger snapshots at runtime.
Pitfalls when choosing a strategy
-
Choosing polling because it "only needs a SELECT grant". The grant is easy. The lost deletes and intermediate states are found months later, during reconciliation, when the data has already been used by the new system.
-
Underestimating the initial load. Every strategy that keeps systems in sync starts with a full copy. Measure the time a snapshot of the largest table takes on a copy of production before choosing between an initial snapshot, an incremental snapshot and a separate bulk copy.
-
Forgetting the reverse direction. A migration that cannot run backwards after the write cut-over has a big-bang moment hidden inside it. Choose a strategy that also works from the new database to the legacy one, as Cut-over & Reverse Replication shows.
-
Ignoring cascading deletes and bulk operations. Even log-based CDC depends on what the log contains. The Debezium FAQ notes that for MySQL, rows removed by
ON DELETE CASCADEare not in the binary log and therefore produce no delete events. Check each source connector page for the equivalent limitations of the legacy database. -
Treating latency as a single number. Measure it per table and per time of day. The supplier feed at 02:00 can put the
SUPPLIER_CATALOGUEstream minutes behind while the other tables stay at seconds.
How to verify the choice
Before committing to a strategy, run a short spike against a copy of the legacy database and check the claims on this page with real data:
-
Start the candidate pipeline against a production-sized copy and record the time the initial copy takes.
-
Replay a day of production traffic (or run the legacy batch jobs) and count, per table, inserts, updates and deletes on both sides. Any difference in the delete count rules out the strategy.
-
Pick ten rows that change several times a day and compare their full history on both sides, not only their final state.
-
Measure the extra CPU and I/O on the legacy database during peak hours.
-
Stop the pipeline for an hour, restart it, and check that nothing is missing.
Verification & Reconciliation turns these checks into queries and dashboards that run for the whole migration.
References
-
Debezium — Features (log-based CDC compared with polling and dual writes)
-
Debezium blog — Five Advantages of Log-Based Change Data Capture (Gunnar Morling, 2018)
-
Debezium — FAQ (load on the source database, duplicates after a crash, missing delete events)
-
Debezium blog — Streaming data to a downstream database (Jiri Pechanec, 2017)
The SQL and Java on this page were derived from the official documentation above and were not run. The connector configuration is the one run in the worked example.