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

Migration Problem #654

Closed keakarsu closed 6 years ago

keakarsu commented 6 years ago

Hi There,

I want to copy my data from oracle to postgres. When I start migration I got some errors. I want to write what I do from starting to getting error

1- Install ora2pg 2- Install DBD:Oracle and DBD:Pg 3- Check connection for Oracle and Postgres 4- Edit config file 5- Create project ora2pg --init_project MyProject 6- Run export_schema.sh 7- Run ora2pg -t COPY -o data.sql -b ./data -c ./config/ora2pg.conf -J 4 -j 3 Than Get This Error

[========================>] 1995/1995 tables (100.0%) end of scanning. DBD::Pg::db do failed: ERROR: relation "act_evt_log" does not exist at /usr/local/share/perl5/Ora2Pg.pm line 12746. FATAL: ERROR: relation "act_evt_log" does not exist DBD::Pg::db do failed: ERROR: relation "act_evt_log" does not exist at /usr/local/share/perl5/Ora2Pg.pm line 12746. FATAL: ERROR: relation "act_evt_log" does not exist Aborting export... DBD::Oracle::db disconnect failed: ORA-03113: end-of-file on communication channel Process ID: 0 Session ID: 2941 Serial number: 37035 (DBD ERROR: OCISessionEnd) at /usr/local/share/perl5/Ora2Pg.pm line 12001. Aborting export... DBD::Pg::db do failed: ERROR: relation "act_evt_log" does not exist at /usr/local/share/perl5/Ora2Pg.pm line 12746. FATAL: ERROR: relation "act_evt_log" does not exist DBD::Pg::db do failed: ERROR: relation "act_evt_log" does not exist at /usr/local/share/perl5/Ora2Pg.pm line 12746. FATAL: ERROR: relation "act_evt_log" does not exist DBD::Oracle::db disconnect failed: ORA-03113: end-of-file on communication channel Process ID: 0 Session ID: 2941 Serial number: 37035 (DBD ERROR: OCISessionEnd) at /usr/local/share/perl5/Ora2Pg.pm line 12001. Aborting export... DBD::Oracle::db disconnect failed: ORA-03135: connection lost contact Process ID: 0 Session ID: 2941 Serial number: 37035 (DBD ERROR: OCISessionEnd) at /usr/local/share/perl5/Ora2Pg.pm line 12001. Aborting export... [========================>] 0/0 rows (100.0%) Table ACT_EVT_LOG-part-0 (1 sec., 0 recs/sec) [========================>] 0/0 rows (100.0%) Table ACT_EVT_LOG-part-2 (1 sec., 0 recs/sec) [========================>] 0/0 rows (100.0%) Table ACT_EVT_LOG-part-1 (2 sec., 0 recs/sec) [========================>] 0/0 rows (100.0%) Table ACT_EVT_LOG-part-3 (2 sec., 0 recs/sec) [========================>] 0/0 rows (100.0%) Table ACT_EVT_LOG (4 sec., 0 recs/sec) DBD::Oracle::db prepare failed: ORA-03135: connection lost contact Process ID: 32033 Session ID: 2941 Serial number: 37035 (DBD ERROR: OCIStmtExecute/Describe) [for Statement "SELECT A.COLUMN_NAME, A.NULLABLE, A.DATA_DEFAULT, A.TABLE_NAME, A.OWNER, A.COLUMN_ID FROM DBA_TAB_COLUMNS A, ALL_OBJECTS O WHERE A.OWNER=O.OWNER and A.TABLE_NAME=O.OBJECT_NAME and O.OBJECT_TYPE='TABLE' AND A.TABLE_NAME='ACT_GE_BYTEARRAY' AND A.OWNER='LOGO' ORDER BY A.COLUMN_ID "] at /usr/local/share/perl5/Ora2Pg.pm line 8185. FATAL: _column_attributes() ORA-03135: connection lost contact Process ID: 32033 Session ID: 2941 Serial number: 37035 (DBD ERROR: OCIStmtExecute/Describe) Aborting export...

I try to find out something but unfortunately I'm not able to find any solution.

banita720 commented 2 years ago

Hi Team,

I am getting below error while migrating data from oracle to postgres

[root@ecop-eastus2-poc-db-vm-01 ecop_project]# ora2pg -t COPY -o data.sql -b ./data -c ./config/ora2pg.conf [========================>] 48/48 tables (100.0%) end of scanning. DBD::Pg::db do failed: ERROR: relation "aggregatekey" does not exist at /usr/local/share/perl5/Ora2Pg.pm line 16583. FATAL: ERROR: relation "aggregatekey" does not exist Aborting export...

Could you plz help me to fix the issue.

banita720 commented 2 years ago

Steps to Migrate:

1.Export Schema ./export_schema.sh

  1. Import: ./import_all.sh -h ecop-eastus2-nprd-pg.postgres.database.azure.com -d postgres -o ecopadmin@ecop-eastus2-nprd-pg -U ecopadmin@ecop-eastus2-nprd-pg -s -I sslmode=require
  2. copy: ora2pg -t COPY -o data.sql -b ./data -c ./config/ora2pg.conf
sandeepkandhway commented 1 year ago

I too faced similar issue . My ora2pg is setup on my personal system (Windows). My PG_DSN parameters were set and I have also exported all the schemas and imported them to postgres. But post that I got an issue as below :

PS C:\ora2pg\initialize_project\migv1> ora2pg -t COPY -o data.sql -b ./data -c ./config/ora2pg.conf
[========================>] 52/52 tables (100.0%) end of scanning.
DBD::Pg::db do failed: ERROR:  relation "doorbell_info_t" does not exist at C:/Strawberry/perl/site/lib/Ora2Pg.pm line 8381.
FATAL: ERROR:  relation "doorbell_info_t" does not exist

Can anyone suggest why its unable to find that table.

The table exist in Postgres Server in a database named mydb and within that mydb database , I have created a schema myschema and imported the table DDLs there.

darold commented 1 year ago

May be ALTER DATABASE mydb SET search_path TO myschema, public; could help.

sandeepkandhway commented 1 year ago

Thanks. I have configured ora2pg and imported the schema structure dump to target postgres database but while importing data encountered the below issue:

I was testing data migration using ora2pg utility (v 23.2) and encountered the below issue:

# ora2pg -t COPY -o data.sql -b ./data -c ./config/ora2pg.conf -J 2
[========================>] 68088/67890 rows (100.3%) Table RLSE_ORD_AUD_T (3 sec., 22696 recs/sec)
[========================>] 118751/118751 rows (100.0%) Table RLSE_ORD_AUD_T_BACKUP (4 sec., 29687 recs/sec)
[========================>] 1/1 rows (100.0%) Table RLSE_ORD_DOC_TYP_T (0 sec., 1 recs/sec)
[========================>] 2771/2719 rows (101.9%) Table RLSE_ORD_FILE_T (30 sec., 92 recs/sec)
**[======================>  ] 41/44 rows (93.2%) Table RLSE_ORD_SHP_DTL_T (1 sec., 41 recs/sec)**
**[========================>] 13/12 rows (108.3%) Table SETTINGS_T (0 sec., 13 recs/sec)**
[========================>] 0/0 rows (100.0%) Table SHP_NODE_GRP_LCK_T (0 sec., 0 recs/sec)
[========================>] 991/991 rows (100.0%) Table SHP_NODE_T (0 sec., 991 recs/sec)
[========================>] 4440/4297 rows (103.3%) Table STK_ORD_DWNLD_T (48 sec., 92 recs/sec)

As I can see above there are several rows where the import has happened more than 100% and some less. How to troubleshoot such scenarios and ensure that no data is missed while importing data to the target postgres database.

Thanks.