Skip to main content

Oracle to postgresql migration tool

Project description

Oracle to postgresql migration tool

usage demo

  • prepare environment (optional step)

    • # pyvenv3 ve-ora2pg
    • # source ve-ora2pg/bin/activate
  • install package

    • # pip install ora2pg
  • usage

    • example:
    ora2pg --replace-query \
                     "foo[select * from foo where bar='bar']" \
                     "foo2[select * from foo2 where bar='bar']" \
                     --use-copy \
                     -l foo,bar,example \
                     --log-file=/tmp/ora2pg.log \
                     pq://postgresql-connect-string oracle-connect-string
    

Speedup copying process

Use --processes and --use-copy parameters to speedup copying large amount of data. Processes means number of processes to decode data for PG, not number of parallel queries.

Ora2Pg copy tables - help output

ora2pg [-h] [--truncate-tables] [--disable-triggers]
                 [--batch-copy-rowcount BATCH_ROWCOUNT]
                 [--table-list TABLES_TO_COPY] [--use-copy]
                 [--log-file LOG_FILE] [--exclude-list EXCLUDE_LIST]
                 [--skip-count]
                 [--replace-query [REPLACE_QUERY [REPLACE_QUERY ...]]]
                 [--force] [--processes PROCESSES] [--fk-drop] [--cmp]
                 [--cmp-tab-list] [--seq-last-number-fix]
                 pg_uri ora_uri
positional arguments:
  pg_uri                PG connect string, pq://...
  ora_uri               ORA connect string

optional arguments:
  -h, --help            show this help message and exit
  --truncate-tables, -z
                        truncate tables before copy
  --disable-triggers, -t
                        disable triggers before copy
  --batch-copy-rowcount BATCH_ROWCOUNT, -b BATCH_ROWCOUNT
                        number of rows to copy at once, default=6000
  --table-list TABLES_TO_COPY, -l TABLES_TO_COPY
  --use-copy            use PG COPY command to copy data
  --log-file LOG_FILE   log file, default=ora2pg.log
  --exclude-list EXCLUDE_LIST, -x EXCLUDE_LIST
                        Exclude table list (comma separated). Copy all tables
                        in schema excluding this list
  --skip-count          Do not perform counting rows before copy. Disables
                        progress bar.
  --replace-query [REPLACE_QUERY [REPLACE_QUERY ...]]
                        replase query for table, format: table_name[select *
                        from table_name where cond=some_value]
  --force               Don't ack, just do
  --processes PROCESSES
                        Number of processes to decode data to COPY in PG,
                        default=1
  --fk-drop, -f         Drop foreign keys in PG and exit
  --cmp                 Count rows in PG & ORA DBs and exit
  --cmp-tab-list        Compare table list - user input and oracle user_tables
                        and exit
  --seq-last-number-fix
                        Update sequences last numbers and exit

Create Postgresql DB schema by Oracle schema

usage: gen_pg_tabs [-h] [-l OBJECT_LIST] [-v] [-p] [-f] [-t] [-i] [-s]
                      [-d DEST_DIR] [-m]
                      connect_string

positional arguments:
  connect_string        ORACLE connect string as for SQL Plus

optional arguments:
  -h, --help            show this help message and exit
  -l OBJECT_LIST, --object-list OBJECT_LIST
                        object list to export, comma separate names
  -v, --verbose
  -p, --primary-keys    add primary keys directives in to create table
                        definition
  -f, --foreign-keys    add foreign keys directives in to create table
                        definition
  -t, --export-tables   export tables
  -i, --export-indexes  export indexes
  -s, --export-sequences
                        export sequences
  -d DEST_DIR, --destination-dir DEST_DIR
                        save tables, indexes and etc in separate files under
                        DEST_DIR/1Tab, DEST_DIR/1Tind, ...
  -m, --sequence-strart-last-number

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

ora2pg-1.0.5.tar.gz (14.9 kB view details)

Uploaded Source

Built Distribution

ora2pg-1.0.5-py3-none-any.whl (15.7 kB view details)

Uploaded Python 3

File details

Details for the file ora2pg-1.0.5.tar.gz.

File metadata

  • Download URL: ora2pg-1.0.5.tar.gz
  • Upload date:
  • Size: 14.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.8.0 pkginfo/1.8.2 readme-renderer/34.0 requests/2.27.1 requests-toolbelt/0.9.1 urllib3/1.26.9 tqdm/4.28.1 importlib-metadata/4.11.3 keyring/23.5.0 rfc3986/2.0.0 colorama/0.4.4 CPython/3.8.9

File hashes

Hashes for ora2pg-1.0.5.tar.gz
Algorithm Hash digest
SHA256 6d18c93e9c15bbd3532b77360924e10202200bb2567df1a551d4940bb80abae0
MD5 e4e7062931ff2357ff155eb2fc059e68
BLAKE2b-256 c15ab720f7ef63af855fec609eae370847066da8d84bd4b4fee9e01f2aa3152a

See more details on using hashes here.

File details

Details for the file ora2pg-1.0.5-py3-none-any.whl.

File metadata

  • Download URL: ora2pg-1.0.5-py3-none-any.whl
  • Upload date:
  • Size: 15.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.8.0 pkginfo/1.8.2 readme-renderer/34.0 requests/2.27.1 requests-toolbelt/0.9.1 urllib3/1.26.9 tqdm/4.28.1 importlib-metadata/4.11.3 keyring/23.5.0 rfc3986/2.0.0 colorama/0.4.4 CPython/3.8.9

File hashes

Hashes for ora2pg-1.0.5-py3-none-any.whl
Algorithm Hash digest
SHA256 7b42d8cff491371353159a8f2da95cf21389cab8e5108400738b2cd86f9108b5
MD5 3c87a283a604e16eeeee788d1b982178
BLAKE2b-256 3ddbdb00ec39ef7bf91c53f82bc439b2b16c7f8a87f516c211c83ee497807b03

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page