
XferDB v1.3.0 — Oracle as a source, and live migration from MongoDB
XferDB v1.3.0 — Oracle as a source, and live migration from MongoDB
I just shipped v1.3.0 of XferDB. Two new sources headline it: Oracle, which XferDB can now copy to PostgreSQL, YugabyteDB, MySQL or SQLite, and stream from live; and MongoDB, which can now be the source of a live migration too. The third big piece is resuming: a migration that fails or is cancelled no longer means starting over.
Live migration is still a beta, from every source. It works end to end and runs in the compatibility matrix on every change, but it hasn't run against enough real workloads yet for me to call it done. Try it on a copy of your data first.
Download
xferdb (CLI + API server)
| Platform | Binary |
|---|---|
| Linux x86_64 | xferdb-linux-amd64 |
| macOS Apple Silicon | xferdb-darwin-arm64 |
| macOS Intel | xferdb-darwin-amd64 |
xferdb-web (Web UI, optional)
| Platform | Binary |
|---|---|
| Linux x86_64 | xferdb-web-linux-amd64 |
| macOS Apple Silicon | xferdb-web-darwin-arm64 |
| macOS Intel | xferdb-web-darwin-amd64 |
Checksums: SHA256SUMS.
xferdb-web is a separate process — it holds no migration state or database credentials, it just serves the UI and reverse-proxies /api/* to xferdb server. Run it if you want the browser UI; the CLI works standalone without it.
The xferdb binary is bigger this time (about 36 MB, up from 21 MB). That's the Oracle driver: it's pure Go, so there's no Oracle client to install, but it's most of the difference.
If you'd rather build from source:
git clone https://github.com/bchan77/XferDB.git cd XferDB && git checkout v1.3.0 && go build -o xferdb ./cmd/xferdb
Full list of changes: CHANGELOG.md. Step-by-step guide to live migration, now covering every source: docs/LIVE_MIGRATION.md.
Before you upgrade
No configuration changes are needed, but two things behave differently:
xferdb migrateuses the project's saved settings. Before, the CLI sent its own defaults for table workers, segment workers and a few others with every run, so the settings saved in the project never applied: create a project with 3 table workers, runxferdb migrate, and it ran with 1. Now a setting is only sent when a flag, anXFERDB_*variable or the config file gives one. If your scripts relied on the CLI's defaults, pass them as flags.- Identity columns arrive as identity columns. An Oracle or PostgreSQL identity column, a PostgreSQL
serial, or a MySQLAUTO_INCREMENTcolumn used to arrive as a plain number column, so the application's first insert without a key failed after the switch-over. They now generate keys on the target too, starting past the largest key copied.
What's in v1.3.0
Oracle as a source
Oracle 12c and later can now be migrated to PostgreSQL, YugabyteDB, MySQL or SQLite. A project connects to a service name and reads one schema: the login's own, or the one you name. The web UI has an Oracle source type, and Load schemas lists the schemas that hold tables.
Oracle's types map to their nearest equivalent on each target (NUMBER(10) to bigint, DATE to a timestamp, CLOB to text, XMLTYPE to xml), and NUMBER values stay exact: they're read as decimal text, never through a float. Unquoted upper-case names arrive in lower case, so SHOP.CUSTOMERS becomes customers. Primary keys, indexes and foreign keys come along, and identity columns stay identity columns.
Here it is on a real schema: an Oracle 23ai database with 52 tables and 17.3 million rows, going to PostgreSQL 16 on my laptop:
An Oracle to PostgreSQL migration in progress: 5.6 million of 17.3 million rows copied, with the per-table progress below
The whole run took 12 minutes 49 seconds: the copy, with five tables at a time, then 58 indexes and 56 foreign keys, which took 7 seconds of that. The Oracle server is in my homelab, not on the same machine, so every row crossed the network. The customers.id identity column arrived as GENERATED BY DEFAULT AS IDENTITY, and the seven foreign keys that point at it came along with it.
Two things made Oracle copies slow, and both are fixed. One worker copying a table read it with OFFSET, so each batch made Oracle skip every row before it, and the cost grew with the square of the table's size; it now pages by primary key (on PostgreSQL and YugabyteDB sources too). And the driver fetched 25 rows per round trip, and native JSON columns one value at a time. Together, a 1M-row table with two JSON columns went from about 39 seconds per 10,000-row batch to 0.6.
Live migration from Oracle (beta)
Oracle 21c and 23ai can also be the source of a live migration. Changes are read with LogMiner from inside the pluggable database, which every edition has, so nothing is created on the source. Each committed transaction's rows are read back as of its commit, so a streamed row arrives exactly as a copied one would.
The readiness check covers what LogMiner needs: ARCHIVELOG mode, supplemental logging, the LogMiner and flashback privileges, and primary keys. On 21c, LogMiner can only mine archived logs, so the stream runs as far behind as archive_lag_target; 23ai streams within seconds.
Live migration from MongoDB (beta)
A MongoDB 4.2+ replica set, or a sharded cluster through one mongos, can now be a live source, again with nothing created on the source: changes come from a change stream. Documents go through the project's schema plan exactly as in the copy, and fields the plan doesn't know land in _extra, even ones that first appear mid-stream, so a MongoDB stream never pauses for a schema change.
On a sharded cluster, a shard key change that moves a document arrives as a delete on one shard and an insert on another; XferDB applies it as the single change it is. And the live copy reads with majority read concern, so it never copies a write that a failover could roll back.
Resume instead of starting over
A migration that failed or was cancelled now has a Resume button (and xferdb resume). It runs again under the same id and settings: finished tables are skipped, the rest continue from their checkpoints, nothing on the target is dropped, and only the indexes and constraints not yet created are created. If the server restarts in the middle of a migration, or while one is paused, it's marked as interrupted and can be resumed the same way.
Indexes and constraints you can watch
After the copy, XferDB creates the indexes, then the foreign keys and checks. On a big table that can take as long as the copy, and it used to show nothing but "post-schema". Every statement is now a step with its timing, and the migration page lists them:
The Indexes & constraints card after the Oracle migration: 114 statements done in 7 seconds, each index with its table, start time and duration
Validation runs in parallel
Validation now checks as many tables at once as the migration used workers, largest first, and reads the source and target at the same time. Once no whole table is left to start, idle workers help with a large one in key-range parts. On the Oracle run above, L2 validation re-read all 17,311,543 rows on both sides, fingerprinted them, and passed all 52 tables in 1 minute 42 seconds.
Validation after the Oracle migration: all 52 tables match at L2, with the same row count on both sides
Smaller things
- The migration page names its project, instead of just showing a migration ID.
- Schema and database pickers for every connection type: Load schemas for PostgreSQL, YugabyteDB and Oracle, Load databases for MongoDB.
- Support bundles tell what happened, in order: a timeline of the migrations, table errors, index steps and validations, plus the server's recent log with credentials masked.
Fixes
- YugabyteDB index builds. Creating indexes on several tables at once made YugabyteDB's online builds wait on each other until they timed out (15 minutes on my test server, on an 80-row table), or abort with Restart read required. Indexes are now created one at a time on YugabyteDB, retried when YugabyteDB asks, and a build that failed part-way is dropped and rebuilt instead of being left behind invalid.
- Oracle foreign keys between differently declared columns. Oracle lets a foreign key column be declared differently from the key it references. Mapped separately, one side could become
numeric(19)and the otherbigint, and PostgreSQL refused the foreign key. The referencing column now takes the referenced column's type. - Create database gave up after 10 seconds, which isn't always enough for PostgreSQL to copy its template database on slow storage.
- Analyze reported
varchar(10)vscharacter varying(10)as a difference, and called every table of a first migration incompatible. - Interval columns failed validation unless both sides spelled them the same way.
- The live cutover's quiet check could pass while a write was still on its way to capture, and complete the cutover with that write left behind.
Showing our work: 81/81 passing
v1.2.0 shipped at 71/71. The compatibility matrix is now 81 cases: MongoDB → PostgreSQL (26), MySQL → PostgreSQL (18), PostgreSQL → PostgreSQL (10), PostgreSQL → MySQL (4), PostgreSQL → SQLite (4), MySQL → SQLite (2), MySQL → MySQL (1), eight YugabyteDB cases, two MongoDB → YugabyteDB, and six new Oracle cases on 21c and 23ai: Oracle → PostgreSQL (3), MySQL (2) and SQLite (1).
Twelve of the 81 are live migrations: four from PostgreSQL, two from YugabyteDB, four from MongoDB (replica sets and sharded clusters, to PostgreSQL and YugabyteDB), and two from Oracle. Each one copies, streams, cuts over and validates. Same setup as before: real databases in Kubernetes, a fresh namespace per case, and L2 validation on every result. The release passed the full set at small and medium size before it was tagged, along with the web UI's end-to-end tests.
What I'm still not claiming:
- Live migration is a beta, from every source. If you use it, I'd like to hear how it went.
- Oracle is tested on 21c and 23ai. Copying should work from 12c on, but I haven't run it against anything older. And 19c can't stream yet: its LogMiner has to run from the root container, which needs a different setup.
- Not every Oracle index comes along. Function-based indexes, such as a unique index on
LOWER(email), are skipped, and so is a descending index, which Oracle reports the same way. If a unique one is skipped, the target doesn't enforce that uniqueness. Check the indexes on your target after an Oracle migration; this is next on my list. - Live migration from MySQL isn't there yet.
- SQLite → PostgreSQL is implemented and unit-tested, but still has no automated end-to-end coverage.
Thanks
Oracle is where "move the data" is most often a project of its own. If you try XferDB on a real Oracle schema, especially one older or stranger than my test databases, tell me what happened, good or bad.
— Billy