Ora2Pg is a free tool used to migrate an Oracle database to a PostgreSQL compatible schema. It connects your Oracle database, scan it automatically and extracts its structure or data, it then generates SQL scripts that you can load into PostgreSQL.
In my org2pg.config I specify to use relative paths.
PSQL_RELATIVE_PATH 1
Invocation
I have a custom PowerShell script, export-raw-data.ps1 that calls ora2pg to create a data.sql file in the migration_data/data. My working directory is ORA2PG_MIGRATION. The precise invocation is
The \ir command is similar to \i, but resolves relative file names differently. When executing in interactive mode, the two commands behave identically. However, when invoked from a script, \ir interprets file names relative to the directory in which the script is located, rather than the current working directory.
Question
How can I instruct ora2pg to generate a path relative to the script location rather than the baseDir provided in the ora2pg command?
Configuration
I have the following directory structure. The
migration_data
template folder was generated by ora2pg.In my org2pg.config I specify to use relative paths.
Invocation
I have a custom PowerShell script,
export-raw-data.ps1
that calls ora2pg to create a data.sql file in themigration_data/data
. My working directory isORA2PG_MIGRATION
. The precise invocation isThis generates as I would expect
data.sql
andMY_TABLE_data.sql
files in themigration_data\data
folder.Actual Result
When I inspect data.sql the `\ir command includes the baseDir supplied in the ora2pg call.
Expected Result
I would have expected the relative path to be relative to the sql file, not to the baseDir. That is, I would have expected this.
According to the PostgreSQL documentation
Question
How can I instruct ora2pg to generate a path relative to the script location rather than the baseDir provided in the ora2pg command?