From:       To:      

Home > Documentation > Oracle to PostgreSQL

Command line version of Oracle to PostgreSQL converter

To perform batch conversion or call conversion procedure from an automation script you can use console version of Oracle-to-PostgreSQL converter called O2PAGENT.EXE. Find this file in the installation folder. You can either run this tool directly from command line or call it from any script as well. The program supports the following command-line options:

--case_sense   make names case sensitive (default is off)
--dest=...   PostgreSQL database
--dump   export Oracle data into PostgreSQL script file
--help   display help message and exit
--host=...   PostgreSQL server IP address or network name
--logfile=...   path to the logfile where execution traces will be written
--mode=...   how to process an existing PostgreSQL database (0 - overwrite the entire database, 1 - overwrite existing tables only, 2 - skip existing tables, 3 - merge)
--port=...   PostgreSQL port
--profile=...   path to the file to load conversion settings from
--pswd=...   PostgreSQL user password
--silent   use this option to disable program output
--skip_idx   skip converting indexes
--src=...   Oracle dump file name
--tab_def   convert table definitions only
--tab_file=...   name of the file containing table names to convert (one table name per line)
--user=...   PostgreSQL user name

In the following example the program converts Oracle dump file "c:\db1.dmp" into PostgreSQL database "db1_from_oracle" on the remote PostgreSQL server "pgshost":

OD2PAGENT.EXE --src=c:\db1.dmp --dest=db1_from_oracle --host=pgshost 
--user=postgres --pswd=the_passsword

Table names file should be formatted as follows:

Table_1
Table_2
...
Table_N

Notes:

  1. You can omit 'host' parameter to connect local PostgreSQL server
  2. It is necessary to specify 'port' parameter only if it differs from the default port 5432
  3. If you omit 'tab_file' parameter, all database tables will be converted
  4. If you omit 'mode' parameter, default mode 'overwrite the entire database' will be used
  5. Command line parameters that contain spaces should be enclosed in quotes (for example --dest="my database")