| Four methods move the data: a bulk export and load, Ora2Pg, a managed replication service with change data capture, or query-based pulls through oracle_fdw. |
| The downtime window decides the method, not the data volume. Volume only decides whether the chosen method finishes inside the window. |
| Load table data first and build secondary indexes, foreign keys and triggers afterwards, then reset every sequence above its column’s maximum value. |
| LOB columns are the usual reason a load runs several times its estimate, because they dominate transfer time and memory rather than row count. |
There are four practical ways to migrate data from Oracle to PostgreSQL: a bulk export and load, Ora2Pg, a managed replication service running change data capture, or querying Oracle directly through a foreign data wrapper. Which one you use is settled by how long the source can stop accepting writes, not by how much data there is. Volume decides whether the method you picked finishes in time. For where this sits in the wider project, see the step-by-step migration guide.
Four ways to move data from Oracle to PostgreSQL
Two of these methods need the source to go read-only for the duration, one keeps both databases in step until the moment you switch, and one lets you move a domain at a time while both stay in use. That difference is the whole decision. Speed matters only within the window the method allows.
| Method | Speed | Change data capture | Best for |
|---|---|---|---|
| Bulk export and COPY | Fastest | No | A one-time move with a real maintenance window |
| Ora2Pg | Fast | No | Schema and data in one free tool, any target |
| AWS DMS / Google Cloud DMS | Moderate | Yes | Short cutover windows on a managed cloud target |
| oracle_fdw | Slowest | No | Phased moves and selective pulls, both systems live |
The ladder above is deliberately ordered. Ask whether writes can pause before asking anything else, because a yes makes the rest of the decision simple and cheap. Only when the answer is no does the target platform start to matter.
Ora2Pg moves data as well as schema, which is what makes it the usual default for a one-time migration. One tool and one configuration file produce the converted schema and the loaded data from the same run, and it emits COPY output rather than INSERT statements when told to. It has no change data capture, so it belongs on the same side of the ladder as the bulk export: fast, free, and dependent on the source going quiet.
oracle_fdw is a different shape of answer. It presents Oracle tables as foreign tables inside PostgreSQL, so you can read them, join across both systems, and copy a domain at a time with ordinary SQL. That suits a migration run in stages, where some applications have moved and others have not. It pulls on demand rather than replicating, so it is not a substitute for change data capture, and it is the slowest of the four for a full load because every row crosses the wire as the result of a query. For what each tool covers beyond data movement, see Ora2Pg and AWS DMS compared.
Bulk loading: fastest for a one-time move
Extract the data and load it with PostgreSQL’s COPY, either from CSV or from the COPY output Ora2Pg can emit directly. Row-by-row INSERT is the single most common reason a load that should take hours takes days.
-- Load from a server-side file
COPY accounts (id, name, region, created_at)
FROM '/var/lib/postgresql/import/accounts.csv'
WITH (FORMAT csv, HEADER true);
-- Or stream from the client, which needs no server filesystem access
\copy accounts FROM 'accounts.csv' WITH (FORMAT csv, HEADER true)
Build the constraints afterwards, not during. Every secondary index is maintained on every inserted row, and every foreign key is checked on every insert, so creating them up front can multiply load time. AWS gives the same advice in its own Oracle to PostgreSQL walkthrough, recommending that you exclude foreign key constraints, triggers and secondary indexes from the schema script because they “can cause problems during the migration”, then create them once the data is in.
Reset every sequence. Loading rows does not advance a sequence, so it still returns 1 while the table holds millions of rows. Set each one above the maximum value of the column it feeds:
SELECT setval(
pg_get_serial_sequence('accounts', 'id'),
(SELECT COALESCE(MAX(id), 1) FROM accounts)
);
PostgreSQL’s documentation puts the semantics plainly: after SELECT setval('myseq', 42), the “next nextval will return 43”. Run this for every sequence, generated from the catalogue rather than from a list someone typed, because the one that gets missed is always the one in production the next morning.
Keeping both databases in sync with change data capture
Where writes cannot pause, a managed replication service does a full load and then streams ongoing changes until you are ready to switch. Google states that its Database Migration Service “supports continuous and one-time migration flows”, and AWS Database Migration Service works the same way. The cutover then becomes a short planned switch rather than an outage sized by your data volume.
What these services carry is row data. What they do not carry is most of the schema: secondary indexes, sequences, default values, stored procedures, triggers and views are a separate exercise, handled by a schema conversion tool. Planning as though the replication service covers the schema is a reliable way to lose a week, because the gap surfaces during the first test load rather than during planning.
Change data capture also has prerequisites on the Oracle side, and they are changes to a production database rather than to your migration environment. The capture reads Oracle’s redo stream, which means supplemental logging has to be enabled and the capture account needs privileges it almost certainly does not hold today. Both need a change window of their own, booked before the migration work starts rather than discovered halfway through it. Tables with no primary key are the other recurring surprise, because a replication service needs some way to identify the row it is updating.
Two things to build while the replication is running rather than after. First, monitoring on replication lag, because “lag is zero” is the gate on the cutover and you want a history of it rather than a single reading. Second, the reverse task, replicating PostgreSQL back to Oracle. That reverse task is what the documented rollback depends on, and it has to exist and be running before cutover rather than being built under pressure during one. Both of those sit inside the cutover plan on our Oracle to PostgreSQL migration services page.
Moving terabytes with a tight cutover window?
Send us the data volume, the LOB share and the window you have to work inside, and we will tell you which method fits and what it will take to finish in time. A plan built on your numbers rather than on an average.
Large tables and LOB columns
Most of a migration’s data volume usually sits in a handful of tables, and most of its elapsed time usually sits in the LOB columns inside them. Sizing the plan on total gigabytes hides both.
Split the largest tables into parallel streams. Pick a key with even distribution, which is rarely the primary key on a table that grew over fifteen years. Check the distribution before choosing, because a split on a skewed key produces one stream that finishes in minutes and one that runs all night. Keep the small tables in a single task instead, since coordination costs more than it saves below a certain size.
Treat LOB columns as their own pass. CLOB and BLOB columns dominate transfer time and memory for every tool that moves them, and they are usually the reason a load that was sized correctly on row count exhausts memory. Move them separately with their own batch sizing, and size that batch against the largest values rather than the average, because the average is what makes the plan look fine.
Estimate on row width, not row count. A hundred million narrow rows move faster than two million rows carrying documents. If the estimate was built from SELECT COUNT(*), it is an estimate of a different table.
How to prove the data matches
Three checks, and they catch progressively more. Running only the first is the most common mistake in this phase, because it produces a number that looks like proof.
Row counts per table. The cheapest check and the weakest. It confirms the load finished. It confirms nothing about whether the values arrived intact, because a truncated column, a lost time component and a character set problem all preserve the row count exactly.
Column-level checksums. Aggregate each column on both sides and compare. This is the check that catches truncation, type-conversion drift and encoding problems. Run it per column rather than per row, so a mismatch tells you where to look instead of only that something is wrong.
Sampled result comparison. Run the reports and high-value queries against both databases and diff the output. This is the only check that catches a behaviour difference, because those produce a correct-looking result on both sides with different numbers in it. Sample deliberately: the oldest rows, the newest, the ones with NULLs, the ones with the longest text, and anything with a date near a boundary. What those behaviour differences are, and what each looks like in production, is covered in the challenges that cause most defects.
Planning an Oracle to PostgreSQL migration?
Tell us the Oracle version, roughly how large the database is and where you want to land. You will talk to a database architect, not an account manager.