darold / ora2pg

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.
http://www.ora2pg.com/
GNU General Public License v3.0
991 stars 342 forks source link

Why ? Aborting export... #1645

Closed sgrinko closed 1 year ago

sgrinko commented 1 year ago

Hi,

I test HEAD

On May, the following changes were made: https://github.com/darold/ora2pg/blob/269d550180b3bd5e36b45be55b884f4486082251/lib/Ora2Pg.pm#L1231

I.e. Table visibility restrictions cannot be used to issue the'SHOW'command. However, after executing the project initialization command: ora2pg --project_base $HOME_DIR/ --init_project $SCHEMA -c /etc/ora2pg/ora2pg.conf a file is created to export 'export_schema.sh', which contains the following code:

#!/bin/sh
#-------------------------------------------------------------------------------
#
# Generated by Ora2Pg, the Oracle database Schema converter, version 23.2
#
#-------------------------------------------------------------------------------
...
ora2pg -t SHOW_TABLE -c $namespace/config/ora2pg.conf > $namespace/reports/tables.txt
ora2pg -t SHOW_COLUMN -c $namespace/config/ora2pg.conf > $namespace/reports/columns.txt
ora2pg -t SHOW_REPORT -c $namespace/config/ora2pg.conf --dump_as_html --cost_unit_value  $unit_cost --estimate_cost > $namespace/reports/report.html

for etype in $(echo $EXPORT_TYPE | tr " " "\n")
do
...
        ora2pg -p -t $etype -o $ltype.sql -b $namespace/schema/${ltype}s -c $namespace/config/ora2pg.conf
...

We see here the use of the same configuration file for all commands $namespace/config/ora2pg.conf

Since we use the ALLOW\EXCLUDE directives, this leads to errors in the logs

...
Generating generic configuration file
Creating script export_schema.sh to automate all exports.
Creating script import_all.sh to automate all imports.
Aborting export...
Aborting export...
Aborting export...
Running: ora2pg -p -t SEQUENCE -o sequence.sql -b ./schema/sequences -c ./config/ora2pg.conf
...

and the absence of reports in the directory: reports within report files only 1 line: FATAL: you can not use global filters in ALLOW/EXCLUDE directive with SHOW_* reports

Configuration file 1 for all commands and the export script is generated automatically. We do not have the option to have a separate configuration file for SHOW commands

I propose to consider as an option: instead of interrupting work do

It's possible? Or maybe there's another workaround?

darold commented 1 year ago

Yes, message FATAL: you can not use global filters in ALLOW/EXCLUDE directive with SHOW_* reports means that you can not use global object name inclusion/exclusion. You need to specify the type of the object, for example to exclude some tables and views:

EXCLUDE  TABLE[MYTABLE1 MYTABLE2];VIEW[MYVIEW1 MYVIEW2]

A global declaration mean such definition:

EXCLUDE  MYTABLE1 MYTABLE2 MYVIEW1 MYVIEW2

this kind of declaration is not supported because it will with be applied to all kind of export type.

sgrinko commented 1 year ago

Thank you! Remade on: EXCLUDE TABLE[SYS_FBA_.* BIN.*] Now it works without errors. Reports are created.