pgrecon: Open-Source Tool for Oracle to PostgreSQL Schema Conversion
pgrecon is an open-source tool that assesses and converts Oracle database schemas to PostgreSQL using a deterministic rule engine and generates reviewable SQL*Plus scripts for migration evaluation.
Tool Overview and Functionality
pgrecon is an open-source tool designed for assessing and converting Oracle database schemas to PostgreSQL, licensed under the Apache-2.0 protocol. It operates by generating a reviewable, read-only SQL*Plus script that produces a dump, from which it builds a local inventory without connecting to either database. The tool employs a deterministic rule engine that applies 80 rules to the inventory, covering aspects such as data types, storage, PL/SQL constructs, and performance posture. Each rule provides line-level evidence and guidance for remediation, ensuring a thorough and transparent migration process. This approach allows users to evaluate compatibility and identify potential issues before committing to a migration, making pgrecon a valuable resource for organizations considering a shift from Oracle to PostgreSQL.
Conversion and Estimation Features
The conversion and estimation features of pgrecon provide a structured approach to assessing Oracle to PostgreSQL migration feasibility. An effort estimator generates person-day ranges based on named components and stated assumptions, offering a practical guide for planning migration efforts (PostgreSQL). The converter produces plain PostgreSQL DDL for components it can prove, including tables with native partition children, constraints, indexes, sequences, views (with CONNECT BY hierarchies transformed into WITH RECURSIVE), materialized views, comments, grants, simple DML triggers, and standalone routines, now including ROWNUM top-N bounds as LIMIT and MERGE statements (PostgreSQL). Components that cannot be carried faithfully are logged as named lines in a residue report, ensuring that no unverified DDL is emitted (PostgreSQL).
Verification and Benchmarking
Verification and benchmarking in pgrecon rely on continuous integration (CI) workflows that ensure the tool's reliability across multiple Oracle and PostgreSQL versions. The full extraction path is verified nightly against Oracle XE 11g, XE 21c, and Oracle Free 23ai, with converted output applied to PostgreSQL 16, 17, and 18 on every commit. A schema fuzzer generates adversarial Oracle estates to test robustness, ensuring no silent data loss or crashes. Public benchmarks, such as the one measuring the conversion of Oracle's HR, OE, and CO samples along with utPLSQL, PLJSON, Logger, and Alexandria, show that 423 statements were processed with zero rejections using pgrecon 0.7.3, as reported in the repository's workflow. Additionally, CI applies the bundled sample's conversion to live PostgreSQL 16, 17, and 18 instances with check_function_bodies enabled, ensuring compatibility and correctness.
Migration Effort Estimation
pgrecon's migration effort estimation provides a detailed breakdown of the resources required for an Oracle to PostgreSQL migration. The tool calculates low, expected, and high estimates in person-days based on five key components: setup, schema conversion, finding remediation, PL/SQL porting by volume, and data movement. These estimates allow teams to challenge individual assumptions and re-run the analysis with their own parameters, offering flexibility and transparency in planning. For example, using the bundled sample inventory, the estimate command outputs a subtotal of 81.7 person-days for development, with testing and stabilization adding a range of 106 to 180 person-days. This approach enables organizations to better understand the scope and complexity of their migration project. As noted in the tool's documentation, these results are verbatim from the bundled sample database and can be reproduced quickly, ensuring consistency and reliability in the estimation process.
Implementation and Usage
The Implementation and Usage section of pgrecon outlines the process for assessing and converting Oracle schemas to PostgreSQL. The tool uses command-line flags such as --source-version to target specific Oracle releases, and --legacy to generate variants compatible with Oracle 9.2 to 11.1. A sample dump is available in the repository, accessible via git clone https://github.com/Muzzammil242/pgrecon, and users can load it with pgrecon load pgrecon/examples/dump_oracle21c --db sample.db. For custom environments, the pgrecon script --source-version 19 command generates migration scripts, which a DBA can execute and return the resulting dump_dir/. Subsequent steps include loading the dump into a PostgreSQL database, generating reports with pgrecon report --db inventory.db --remedies, estimating migration impact with pgrecon estimate --db inventory.db, and creating a runbook with pgrecon runbook --db inventory.db. The source code, rule catalogue, and issue tracker are hosted on github.com/Muzzammil242/pgrecon, alongside release notes and benchmark methodology.
Sources and reporting notes
Based on published source material. No independent hands-on testing is claimed.