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 can leverage Google BigQuery or any Postgres database as a staging environment 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
-
Install pip package:
pip install oracle2postgres_schema_validator
-
Set Up Environment:
Client environment requirements:
- python3.9
- Shell environment (CLI) to run python scripts.
- Network connectivity to Oracle and Postgres instances and BigQuery APIs.
Usage
-
Collect Metadata:
-
Oracle Collect: Optional: Grant required access to metadata views which are the all_* views highlighted below. If you just want to get objects of the connected user you can skip this step and set --view_type to user.
Please replace oracle_db_user with your database user. ```sql Option 1: Grant select any dictionary to oracle_db_user;
Option 2: GRANT SELECT ON all_objects TO <db_user>; GRANT SELECT ON all_synonyms TO <db_user>; GRANT SELECT ON all_source TO <db_user>; GRANT SELECT ON all_indexes TO <db_user>; GRANT SELECT ON all_users TO <db_user>; GRANT SELECT ON all_role_privs TO <db_user>; GRANT SELECT ON all_roles TO <db_user>; GRANT SELECT ON all_triggers TO <db_user>; GRANT SELECT ON all_tab_columns TO <db_user>; GRANT SELECT ON all_tables TO <db_user>; GRANT SELECT ON all_constraints TO <db_user>; GRANT SELECT ON all_tab_privs TO <db_user>; GRANT SELECT ON all_sys_privs TO <db_user>;
Execute the following command by putting your db connection settings. If you want to get all_* views use --view_type all, if you want to get user_* views use --view_type user: ```bash oracollector --host oracle_ip_address --user db_user --password db_passwd --service oracle_service_name --view_type all
-
Postgres Collect:
pgcollector --host pg_ip_address --database db_name --user user_name --password db_pwd
Collector files will output 2 zip files. These needs to be moved under extracts directory before running importer.
-
-
Import
- Import to BigQuery:
importer --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 under the extracts folder.
-
Import to Postgres:
importer --postgres_connection_string "postgresql://db-user:db-pwd@db_ip/db_name" --schema schema_compare
- Import to BigQuery:
-
Generate Reports: In order to generate comparison report you need to run "reporter". Please use "--format html" flag to generate html report. You can use --format text to print output as text on the screen.
- BigQuery as Staging Area:
reporter --project_id your_project_id --dataset_name your_dataset_name --table_name instances --format html
- Postgres as Staging Area:
reporter --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 --schema_name schema_compare --format html
- Filter Schemas:
reporter --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' --format html
- BigQuery as Staging Area:
Report Output
The generated html report will be saved in the reports directory.
Contributing
Contributions are welcome! Please feel free to open issues or submit pull requests.
Clone the Repository: ```bash git clone https://github.com/samkaradag/oracle2postgres-schema-validator
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.7.tar.gz
.
File metadata
- Download URL: oracle2postgres_schema_validator-0.1.7.tar.gz
- Upload date:
- Size: 22.5 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 | f79003e91b91534d42c036cea415e6cc4f36185a79d187b9cda846f712b0c9fd |
|
MD5 | 5dd4f70c18831a6984b588426f15dbd9 |
|
BLAKE2b-256 | 5c0f4d91b83cfffe4982f3fe225ec2ab6847c1d41517a06f7597da1b4d2bd438 |
File details
Details for the file oracle2postgres_schema_validator-0.1.7-py3-none-any.whl
.
File metadata
- Download URL: oracle2postgres_schema_validator-0.1.7-py3-none-any.whl
- Upload date:
- Size: 32.0 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 | 5f0268b6c8403f2680e73af005791a6b4b7dd7c88b4de39fd0632dd73321cc1b |
|
MD5 | 6b2c0b077021d38175238ce2cdca79e1 |
|
BLAKE2b-256 | 16d9fb42a3b9c87fb9a8d4aaba8b9892b3c97be77deecdb4fe16e61d1fa831bd |