Pattern 05 · Modernization

Oracle → PostgreSQL migration pattern

A production pattern for moving off Oracle licensing onto PostgreSQL — assess honestly, convert PL/SQL deliberately, replicate continuously, and cut over only when validation proves parity.

$0
license cost for PostgreSQL — the economic driver
5
phases: assess → convert → replicate → validate → cutover
1
rehearsed rollback plan before any cutover

01 · PROBLEM

Oracle licensing is a growing tax on growth

Oracle licensing — processor-based, plus annual support — scales with your hardware and penalizes modern architectures (more cores, more replicas, more environments). Meanwhile PostgreSQL has closed the enterprise gap: it now handles the OLTP, mixed, and analytical workloads most Oracle estates actually run, with extensions (PostGIS, pgvector, TimescaleDB, Citus) and operational tooling (Patroni, pgBackRest) that make it a production platform, not a compromise.

This pattern describes how to migrate production Oracle estates to PostgreSQL without heroic cutovers — continuous replication, dual-run validation, and rollback plans that have been rehearsed, not just written.

02 · WHEN TO USE

Fit and anti-fit

  • License and support renewals are forcing the conversation, or growth plans multiply processor costs.
  • You want portability and vendor-independence — PostgreSQL runs well on every cloud and on-prem.
  • Workloads are OLTP, mixed, or analytical with standard SQL and procedural logic you own.
  • The organization can fund conversion engineering — especially PL/SQL rewrites — not just a "lift and shift."

Don't use it as a pure lift-and-shift: moving Oracle-isms (RAC clustering assumptions, autonomous transactions, DBMS_* package calls) to Postgres without redesign just relocates the pain. And if your estate is dominated by third-party applications certified only on Oracle, or deeply coupled to proprietary features with no appetite for change, honesty beats a doomed migration.

03 · ARCHITECTURE

Reference migration flow

Oracle to PostgreSQL migration patternOracle to PostgreSQL migration pattern: assess, convert schema, convert PL/SQL code, replicate data with change data capture, validate continuously, cut over with a blue-green switch, then optimize. Assessinventory · ora2pg analysis Convert schematypes · DATE · empty-string Convert codePL/SQL → plpgsql · packages Replicate datainitial load + CDC Validatecounts · checksums · app tests Perf baselinecapture before you move Dual-run / shadowcompare outputs Cutoverblue-green · rollback ready Optimizevacuum · indexes · planner Rollback plantested rehearsal, not a document Decommissionlicense exit · archive App remediationdrivers · SQL dialect · ORM HA / DR on PostgresPatroni · streaming · PITR Ops runbooksmonitoring · on-call · upgrades Validation runs continuously from the first replicated row — not as a phase before cutover. The migration is done when the app can't tell the difference.

The spine of the pattern: replicate early, validate continuously, cut over late. Validation isn't a phase — it's a standing process from the first replicated row to decommission.

04 · COMPONENTS

What each piece does

ComponentResponsibilityBuild/buy notes
AssessmentInventory databases, score compatibility per object (PL/SQL units, proprietary-feature usage), size the hand-conversion backlog honestlyAutomated analysis (ora2pg, AWS SCT) plus human review of the hard 20% — packages, autonomous transactions, DBMS_* calls
Schema conversionData types, constraints, indexes, sequences, partitions — and the semantic traps: DATE vs timestamp, empty-string vs NULL, NUMBER precisionAutomate the 80%; hand-convert the semantic edge cases and prove them with fixtures, not assumptions
Code conversionPL/SQL → plpgsql: packages, procedures, functions, triggers; autonomous-transaction redesign; job scheduling → orchestratorThe long pole. Tools convert structure; engineers rewrite idioms — exception handling, bulk collect, package state. Budget per unit.
Replication (initial + CDC)Bulk load then continuous change capture with lag monitoringDebezium, AWS DMS, or your enterprise replicator — pick for your topology, test failover, keep Oracle warm through stabilization
ValidationRow counts, checksums, data sampling, application-level dual-run comparisonDual-run is the gold standard: same inputs, compare outputs, investigate diffs — including Oracle-vs-Postgres semantic diffs
CutoverBlue-green switch with rehearsed rollbackRehearse the rollback like the cutover — an untested rollback is a hope; keep reverse-replication or reconciliation ready
Postgres operationsHA (streaming replication with Patroni), PITR backups, vacuum/autovacuum tuning, monitoringRAC and Data Guard get re-architected, not migrated — design Postgres HA/DR from day one

05 · FLOW

How the migration proceeds

F1
Assess honestly. Automated inventory plus manual review of PL/SQL units, proprietary features, and third-party dependencies. Output: per-object compatibility scores and a sequenced wave plan — easy wins first.
F2
Baseline performance. Capture production query performance before moving. You can't prove parity without a baseline.
F3
Convert schema and code. ora2pg handles structure; engineers handle meaning — the idioms that don't transliterate get rewritten and unit-tested on production fixtures. Remediate applications in parallel: drivers, SQL dialect differences, ORM quirks.
F4
Replicate continuously. Initial load, then CDC with lag alerting. Start validation immediately — counts, checksums, sampled row comparison, with attention to Oracle-vs-Postgres semantic differences.
F5
Dual-run. Route shadow traffic or replayed workloads to Postgres; compare results against Oracle. Fix diffs until they're explained, not just small.
F6
Cut over blue-green. Switch with the rollback rehearsed and ready. Keep Oracle warm until the stabilization window closes, then decommission and exit the licenses and support contracts.

06 · TRADEOFFS

Decisions with real costs

DecisionOption AOption BOur default
StrategyBig-bang — one cutover, maximum riskWave-based trickle — longer program, contained blast radiusWave-based; big-bang only for trivial estates
Procedural codeConvert PL/SQL → plpgsql faithfully — preserves behavior, preserves complexitySimplify/move logic to app — better long-term, more app workConvert faithfully first; simplify where the business signs off
Postgres flavorManaged (RDS, Cloud SQL, Azure) — less ops, some limitsSelf-managed — full control, full responsibilityManaged default; self-manage only with a real Postgres ops team
DowntimePlanned outage window — simpler, business costNear-zero via CDC + blue-green — more engineeringNear-zero for production; windows only for dev/test

On Oracle → PostgreSQL specifically, see our in-depth migration guide.

07 · SECURITY

Non-negotiables

  • Lower environments: migrate with masked or synthetic data; production dumps in dev are how breaches start.
  • Credential rotation: new secrets for the Postgres estate — don't carry Oracle service accounts across.
  • Encryption parity: TDE equivalents (disk-level + pgcrypto where needed), TLS everywhere, audit logging from day one.
  • Replication security: CDC channels are privileged — encrypt, authenticate, and monitor them like production access, because they are.
  • Privilege redesign: Oracle roles and VPD/FGAC policies don't transliterate — rebuild least-privilege on Postgres, don't replicate the old grants.

08 · GOVERNANCE

Running it like a program, not a project

  • Wave governance: each wave has entry/exit criteria; no wave cuts over until dual-run diffs are explained.
  • Rollback rehearsals: tested on schedule, timed, with named owners — a rollback plan that's never been run is fiction.
  • License tracking: track Oracle license and support-contract retirement per wave; the business case is realized at decommission, not at cutover.
  • Knowledge transfer: your DBAs and developers learn Postgres operations during the program, not after — pair with practitioners throughout.

09 · COST

Where the money goes

  • Conversion engineering is the dominant cost — PL/SQL conversion and app remediation, not tooling.
  • Dual-running doubles infra temporarily; budget it per wave and decommission Oracle aggressively after each stabilization window.
  • License savings are real but lagging — model the crossover point honestly, including the program cost.
  • Postgres ops (managed service fees or DBA time) replaces license cost; it's smaller, but it isn't zero.

10 · IMPLEMENTATION

A phased path that de-risks

P0
Assessment. Inventory, per-object compatibility scoring, wave sequencing, honest TCO model. Start with the Oracle → PostgreSQL Migration Pack questionnaire.
P1
Pilot wave. One representative database end to end: convert, replicate, dual-run, cut over. Proves the factory before scaling it.
P2
Scale waves (ongoing). Factory model: parallel conversion tracks, shared validation harness, wave-by-wave cutovers with rehearsed rollbacks.
P3
Optimize & exit (ongoing). Postgres performance tuning, decommission Oracle, retire licenses and support contracts, transfer ops knowledge.

Engagement tie-in: our Modernization practice runs these migrations as engineering programs, starting with a fixed-scope Oracle → PostgreSQL assessment.

11 · RELATED

Keep exploring

Oracle → PostgreSQL Guide

The in-depth migration guide: assessment, PL/SQL conversion, and cutover detail.

Read guide →

Oracle → PostgreSQL Migration Pack

Discovery questionnaire, compatibility matrix, cutover checklist, reference architecture — the working instruments.

Open pack →

SQL Server → PostgreSQL migration pattern

The sibling pattern — same spine, different source-database idioms.

Read pattern →

Start here

Talk to an Architect

Bring your hardest AI, data, or modernization problem. We'll tell you plainly whether we can help — and what it takes.

FAQ

Questions we hear

It depends on database count, PL/SQL volume, and proprietary-feature coupling — not data size. Moderate estates run months from assessment to cutover; estates heavy on PL/SQL packages and proprietary features run in phased quarters. The assessment phase exists to replace guessing with a measured plan.

Usually yes, using initial load plus change-data-capture with a blue-green cutover. Zero-downtime is an engineering outcome you design for — it requires dual-run validation and a rehearsed rollback, not just a replication tool.

They are re-architected, not migrated. RAC's clustering becomes PostgreSQL streaming replication with an automated failover manager like Patroni; Data Guard becomes streaming replicas plus WAL-archived backups and rehearsed point-in-time recovery. Plan this as part of conversion, not after.