4.1. Usage #
First of all, make sure that libraries and binaries path include the Oracle Instant Client installation:
export LD_LIBRARY_PATH=/usr/lib/oracle/11.2/client64/lib export PATH="/usr/lib/oracle/11.2/client64/bin:$PATH"
By default, ora2pgpro looks for /etc/ora2pgpro/ora2pgpro.conf configuration file, if the file exists, you can simply execute:
/usr/local/bin/ora2pgpro
If you want to call another configuration file, give the path as the command-line argument:
/usr/local/bin/ora2pgpro -c /etc/ora2pgpro/new_ora2pgpro.conf
For all command-line parameters available when using ora2pgpro, refer to ora2pgpro.
ora2pgpro returns 0 on success, 1 on error. It returns 2 when a child process has been interrupted and you received the warning message: “WARNING: an error occurs during data export. Please check what's happen.” Most of the time this is an OOM issue, first try reducing DATA_LIMIT value.
Note that performance might be improved by updating stats on Oracle:
DBMS_STATS.GATHER_SCHEMA_STATS DBMS_STATS.GATHER_DATABASE_STATS DBMS_STATS.GATHER_DICTIONARY_STATS
The two options --project_base and --init_project, when used, indicate that ora2pgpro has to create a project template with a work tree, a configuration file and a script to export all objects from the Oracle database. Here is a sample of the command usage:
ora2pgpro --project_base /app/migration/ --init_project test_project Creating project test_project. /app/migration/test_project/ schema/ dblinks/ directories/ functions/ grants/ mviews/ packages/ partitions/ procedures/ sequences/ synonyms/ tables/ tablespaces/ triggers/ types/ views/ sources/ functions/ mviews/ packages/ partitions/ procedures/ triggers/ types/ views/ data/ config/ reports/ Generating generic configuration file Creating script export_schema.sh to automate all exports. Creating script import_all.sh to automate all imports.
It creates a generic configuration file where you define the Oracle database connection and a shell script called export_schema.sh. The sources/ directory will contain the Oracle code, the schema/ will contain the code ported to Postgres Pro. The reports/ directory will contain the HTML reports to help assess the migration cost.
If you want to use your own default configuration file, use the -c option to give the path to that file. Rename it with the .dist suffix if you want ora2pgpro to apply the generic configuration values, the configuration file will be copied untouched otherwise.
Once you have set the connection to the Oracle database, you can execute the script export_schema.sh that will export all object type from your Oracle database and output DDL files into the schema subdirectories. At end of the export, it will give you the command to export data later when the import of the schema will be done and verified.
You can choose to load the DDL files generated manually or use the second script import_all.sh to import those files interactively. If this kind of migration is not currently in progress for you, it is recommended you to use those scripts.