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
978 stars 341 forks source link

ORACLE_DSN doesnt recognized #1694

Closed tbw777 closed 5 months ago

tbw777 commented 9 months ago

docker run --rm --name ora2pg -e CONFIG_LOCATION=/config/ora2pg.conf -e OUTPUT_LOCATION=/data/ -e ORA_HOST=dbi:Oracle:host=localhost;sid=SIDNAME;port=1521 -e ORA_USER=system -e ORA_PWD=oracle -v ora2pg/config:/config -v ora2pg/data:/data --network host georgmoser/ora2pg INFO: CONFIG_LOCATION variable detected: '/config/ora2pg.conf' INFO: OUTPUT_LOCATION variable detected: '/data/' INFO: ORA_HOST_FLAG variable detected: 'dbi:Oracle:host=localhost;sid=SIDNAME;port=1521' INFO: ORA_USER variable detected: 'system' INFO: ORA_PWD variable detected: '' INFO: no args provided. Using default: '--debug -c /config/ora2pg.conf --basedir /data/ --source dbi:Oracle:host=localhost;sid=SIDNAME;port=1521 --user system --password ' [2023-09-28 13:13:48] Ora2Pg version: 24.1 [2023-09-28 13:13:48] Export type: [2023-09-28 13:13:48] Geometry export type: INTERNAL [2023-09-28 13:13:48] FATAL: you must set ORACLE_DSN in ora2pg.conf or use a DDL input file. Aborting export...

ora2pg.conf:

ORACLE_DSN dbi:Oracle:host=localhost;sid=SIDNAME;port=1521 PG_VERSION 15

darold commented 9 months ago

I guess that the ora2pg.conf is not at the place it is expected by Ora2Pg, something is wrong in your docker use.

tbw777 commented 9 months ago

Its correct place, because then i hide PG_VERSION from this config i get a version warning:

WARNING: target PostgreSQL version must be set in PG_VERSION configuration directive. Using default: 11

darold commented 9 months ago

Ok, then this is because ORACLE_DSN is not set or it is set to ist default value :ORACLE_DSN dbi:Oracle:host=localhost;sid=SIDNAME;port=1521.

Looking at info message:

INFO: no args provided. Using default: '--debug -c /config/ora2pg.conf --basedir /data/ --source dbi:Oracle:host=localhost;sid=SIDNAME;port=1521 --user system --password

I don't know about the docker run but if you want to run ora2pg directly with your parameters this could be done using;

ora2pg -c=/config/ora2pg.conf -b /data/ -s "dbi:Oracle:host=localhost;sid=THESID;port=1521" -u system -w oracle -d
tbw777 commented 9 months ago

On windows i cant run without docker there is no any versions on winget or chocolatey or wsl apt

tbw777 commented 9 months ago

after compile on win platform i get the same error without the docker but on the same config:

ora2pg -c ora2pg.conf -debug [2023-09-28 19:04:14] Ora2Pg version: 24.1 [2023-09-28 19:04:14] Export type: TABLE [2023-09-28 19:04:14] Geometry export type: INTERNAL [2023-09-28 19:04:14] FATAL: you must set ORACLE_DSN in ora2pg.conf or use a DDL input file. Aborting export...

with template and any other value:

ORACLE_DSN dbi:Oracle:host=mydb.mydom.fr;sid=SIDNAME;port=1521

i got the same error

darold commented 9 months ago

In your ora2pg.conf file the value of ORACLE_DSN must be set with something else than the default, replacing SIDNAME by anything else will work.

tbw777 commented 9 months ago

the problem was in bad service_name, now error is fixed

[2023-09-28 19:54:31] Trying to connect to database: dbi:Oracle:host=localhost;service_name=some_name;port=1521 install_driver(Oracle) failed: Can't load 'C:/Strawberry/perl/site/lib/auto/DBD/Oracle/Oracle.xs.dll' for module DBD::Oracle: load_file:═х эрщфхэ єърчрээ√щ ьюфєы№ at C:/Strawberry/perl/lib/DynaLoader.pm line 206.

but now i dont know what to do with this on win

on docker something is works

[2023-09-28 17:17:11] [1] Scanning table SOME_TABLE (1 rows)...

there is no any rows

first dump is finished

darold commented 9 months ago

Then now you know what is the problem with ORACLE_DSN so you can retry to use ora2pg with docker. Otherwise you need to install DBD::Oracle on Windows which could be something not very easy.

tbw777 commented 9 months ago

I suggest making the message more informative. Errors that the value is not set or set incorrectly is different

darold commented 9 months ago

I agree.