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.6.tar.gz (14.9 kB view details)

Uploaded Source

Built Distribution

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

Uploaded Python 3

File details

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

File metadata

  • Download URL: ora2pg-1.0.6.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.6.tar.gz
Algorithm Hash digest
SHA256 6971efce6143dcba2cface694c68c7e38ab3329393d14a7e1f791585d1814115
MD5 9bc6fc6c31aa83a4cefef5a76c1967f4
BLAKE2b-256 caf735676eaaeb9573d469bc050bd8c74e95a4744864bff464b7590ac3612460

See more details on using hashes here.

File details

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

File metadata

  • Download URL: ora2pg-1.0.6-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.6-py3-none-any.whl
Algorithm Hash digest
SHA256 1e8a7519c60f9f07f64b88a9214b904960572b8b98558f4f0ebd7ca33512ff71
MD5 086b5ec3833ba05e7a210e6087e09267
BLAKE2b-256 e5e67c013d972c6e04c1821591e569520168b39fa7c0a36fdd150780405c563d

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