Tool to compare Oracle objects with Postgres objects
Project description
Oracle to Postgres Database Comparison Utility
This utility streamlines the process of comparing the schemas and code objects of Oracle and Postgres databases. This utility can be useful for heterogenous migrations from Oracle to Postgres or vice-versa to check whether all the objects i.e: PLSQL, tablec, indexes, views, columns, sequences are migrated. It leverages Google BigQuery for efficient data analysis and reporting.
Key Features
- Metadata Collection: Extracts comprehensive schema metadata (tables, views, functions, procedures, etc.) from Oracle and Postgres databases.
- BigQuery Integration: Seamlessly imports collected metadata into Google BigQuery for centralized analysis.
- Detailed Comparison Reports: Generates clear, text and html based reports highlighting differences in:
- Object counts (tables, views, etc.)
- Missing objects in either database
- Discrepancies in PLSQL and plpgsql (procedures, functions)
- Other customizable comparison metrics
Prerequisites
- Oracle Database Access: Credentials for Oracle database.
- Postgres Database Access: Credentials for Postgres database.
- Staging Database BigQuery or Postgres database is needed to stage extracted metadata
- BigQuery as Staging:
- Google Cloud Project: A Google Cloud project with BigQuery enabled.
- Service Account: A Google Cloud service account with BigQuery Data Editor and Job User roles.
- Postgres as Staging:
- Postgres Database A Postgres database (maybe CloudSQL), database and username that create tables in the database.
- BigQuery as Staging:
Installation
- Clone the Repository:
git clone https://github.com/samkaradag/oracle2postgres-schema-validator
- Set Up Environment: Install required Python packages: pip install -r requirements.txt
Set environment variables (refer to config.py.example):
- ORACLE_CONN_STRING: Connection string for the Oracle database(s).
- GOOGLE_APPLICATION_CREDENTIALS: Use gcloud auth application-default login
- PROJECT_ID: Your Google Cloud project ID.
- DATASET_ID: The BigQuery dataset to use (created if it doesn't exist).
Client requirements:
- Oracle client installed
- tns_names.ora file that includes the target db tns.
- python3
- Python dependencies installed (pip install -r requirements.txt)
- Google Cloud CLI (https://cloud.google.com/sdk/docs/install-sdk)
- Network connectivity to Oracle and Postgres instances and BigQuery APIs.
Usage
- Collect Metadata:
- Oracle Collect:
cd collector/oracle-collector/ ./collect_data.sh --connectionStr system/password@dbtns cp the zip files mentioned in the output under ../../importer/extracts/ folder
- Postgres Collect:
cd collector/pg-collector/ python collect_pgsql.py ip_address db_name db_user passwd config.yaml cp extracted_data.zip ../../importer/extracts/
- Oracle Collect:
- Import
-
Import to BigQuery:
cd ../../importer python importer.py --project_id your_project_id --dataset_id your_dataset_name You can specify an empty dataset otherwise dataset will be created if not exists.This command will unzip all the zip files underthe extracts folder.
-
Import to Postgres: Create database schema and tables using create_pg_user.sql in postgres
cd ../../importer python importer.py --csv_directory ./extracts --postgres_connection_string postgresql://username:passwd@db_ip_host/dbname
-
- Generate Reports:
- BigQuery as Staging Area:
cd ../importer python reporter.py --project_id your_project_id --dataset_name your_dataset_name --table_name instances --format html
- Postgres as Staging Area:
cd ../importer python reporter.py --db_type postgres --postgres_host your_postgres_host --postgres_port your_postgres_port --postgres_user your_postgres_user --postgres_password your_postgres_password --postgres_database your_postgres_database
- Filter Schemas:
python reporter.py --db_type postgres --postgres_host your_postgres_host --postgres_port your_postgres_port --postgres_user your_postgres_user --postgres_password your_postgres_password --postgres_database your_postgres_database --schemas_to_compare 'SCHEMA1','SCHEMA2','SCHEMA3'
- BigQuery as Staging Area:
Report Output
The generated reports will be saved in the reports directory.
Customization
config.py: Adjust comparison parameters and reporting preferences. generate_report.py: Extend or modify the types of comparisons and report formats.
Contributing
Contributions are welcome! Please feel free to open issues or submit pull requests.
License
This project is licensed under the Google License.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
File details
Details for the file oracle2postgres_schema_validator-0.1.0.tar.gz
.
File metadata
- Download URL: oracle2postgres_schema_validator-0.1.0.tar.gz
- Upload date:
- Size: 43.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.8.3 CPython/3.9.6 Darwin/23.6.0
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 0b450ec3731f486dc4399f405d79f10433944c8c6eeaef3f7f050e9fc80a951d |
|
MD5 | 270e3840c37fcfca58004da8bea4d9c3 |
|
BLAKE2b-256 | d8133d772df202179a9505214bcb54c4e25b971b6bbf29f48903fa3b64a9cf4f |
File details
Details for the file oracle2postgres_schema_validator-0.1.0-py3-none-any.whl
.
File metadata
- Download URL: oracle2postgres_schema_validator-0.1.0-py3-none-any.whl
- Upload date:
- Size: 60.3 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.8.3 CPython/3.9.6 Darwin/23.6.0
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 3115b2afe56006edcdad7a72c0ec132b613425638b479eed7c8b33064e00a633 |
|
MD5 | 4faed55b773a95f94c2f6147e36f2f29 |
|
BLAKE2b-256 | 68dd9bb46ae3664479f581c9440cd14b048cc1f0dba74a14dd5e1dc479464085 |