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

Issue in migrating from SQL Server to CloudSQL Postgres #1794

Closed Pavithra2826 closed 1 day ago

Pavithra2826 commented 3 weeks ago

Hi, I have installed all the pre-requisites to migrate from SQL Server to postgres. But got below error while trying to migrate object(Procedure) from SQL Server to Postgres Attached the sample conf file used for migration. Could you please check and provide the correct sample conf file to migrate from MSSQL to postgres

@XXXX:~/$ ora2pg -c ora2pg.conf -t procedure -o sp.sql FATAL: you must set ORACLE_DSN in ora2pg.conf or use a DDL input file. Aborting export...

ora2pg.txt

darold commented 3 weeks ago

Hi,

You cannot just invent the configuration directives and wish it can work. Where did you get these?

SOURCE   dbi:ODBC:driver=msodbcsql18;server=XXXXXXX;database=XXX;TrustServerCertificate=yes
USER     XXXXXXX
PASSWORD XXXXXX

you must use the following;

ORACLE_DSN      dbi:Oracle:host=mydb.mydom.fr;sid=SIDNAME;port=1521
ORACLE_USER     system
ORACLE_PWD      manager

I agree that the name is no more adapted to the multiple DBMS that Ora2Pg is able to migrate now, but this is historical.

Pavithra2826 commented 3 weeks ago

I am trying to migrate SQLServer database, Can we use oracle configuration directives for SQLServer? Should I change anything in the configuration directives to support SQL Server.

cp130630:~/mssql$ ora2pg -c ora2pg.conf -t procedure -o sp.sql FATAL: 12537 ... ORA-12537: TNS:connection closed (DBD ERROR: OCIServerAttach) Aborting export..

Pavithra2826 commented 2 weeks ago

Could you please confirm

darold commented 1 day ago

You should have a look to the documentation for directive ORACLE_DSN.