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

An error occurred while migrating data from Oracle spatial! #1759

Closed ruralqiu closed 3 months ago

ruralqiu commented 3 months ago

error: [2024-03-25 11:01:48] [========================>] 1/1 tables (100.0%) end of scanning.
[2024-03-25 11:02:00] [> ] 0/1 tables (0.0%) end of scanning.
Can't call method "do" on an undefined value at /usr/local/share/perl5/Ora2Pg.pm line 9239. Issuing rollback() due to DESTROY without explicit disconnect() of DBD::Oracle::db handle (DESCRIPTION=(ADDRESS=(HOST=192.10.5.92)(PROTOCOL=tcp)(PORT=1521))(CONNECT_DATA=(SID=ORCL))) at /usr/local/share/perl5/Ora2Pg.pm line 9238.

postgresql version: 12 oracle version:Release 11.2.0.1.0

oracle: -- Table structure for T_GIS_KJZBDZB_COPY

DROP TABLE "ORAGIS"."T_GIS_KJZBDZB_COPY"; CREATE TABLE "ORAGIS"."T_GIS_KJZBDZB_COPY" ( "ID" VARCHAR2(32 BYTE) NOT NULL, "ZYID" VARCHAR2(50 BYTE) NOT NULL, "ZYLX" VARCHAR2(12 BYTE) NOT NULL, "SHAPE" "MDSYS"."SDO_GEOMETRY" NOT NULL, "IS_EFFECTIVE" CHAR(1 BYTE) DEFAULT 1 NOT NULL, "CREATE_TIME" TIMESTAMP(6) NOT NULL, "UPDATE_TIME" TIMESTAMP(6) NOT NULL, "ORG_CODE" VARCHAR2(50 BYTE) NOT NULL, "CREATE_USER" VARCHAR2(50 BYTE) NOT NULL ) LOGGING NOCOMPRESS PCTFREE 10 INITRANS 1 STORAGE ( INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645 BUFFER_POOL DEFAULT ) PARALLEL 1 NOCACHE DISABLE ROW MOVEMENT ;

data: INSERT INTO "ORAGIS"."T_GIS_KJZBDZB_COPY" VALUES ('760c4b12d39d40179ee3ad898a9c644b', 'be71a21c62194004852070f33e60b968', 'SGXX', "MDSYS"."SDO_GEOMETRY"(2001,8307,"MDSYS"."SDO_POINT_TYPE"(83.419189453125,42.890625,98.11254487),NULL,NULL), '1', TO_TIMESTAMP('2018-03-28 11:59:59.362000', 'SYYYY-MM-DD HH24:MI:SS:FF6'), TO_TIMESTAMP('2018-03-28 11:59:59.362000', 'SYYYY-MM-DD HH24:MI:SS:FF6'), '65010200000000000001', 'fc9d67c9f03f44f6a63886015485dc83');

darold commented 3 months ago

Table data export when there is a geometry column was totally broken, commit b791246 fixes this issue.

ruralqiu commented 3 months ago

Okay, thank you

ruralqiu commented 3 months ago

Hello, I have updated the latest code, but the same error still persists. Please investigate and handle it again. Thank you again

darold commented 3 months ago

Hi, everything is working well with your example, here is the data export from ora2pg:

INSERT INTO "T_GIS_KJZBDZB_COPY" ("ID","ZYID","ZYLX","SHAPE","IS_EFFECTIVE","CREATE_TIME","UPDATE_TIME","ORG_CODE","CREATE_USER")
VALUES (
E'760c4b12d39d40179ee3ad898a9c644b',E'be71a21c62194004852070f33e60b968',
E'SGXX',ST_GeomFromText('POINT (83.419189453125 42.890625)', 4326),
E'1','2018-03-28 11:59:59.362000','2018-03-28 11:59:59.362000',E'65010200000000000001',
E'fc9d67c9f03f44f6a63886015485dc83'
);
ruralqiu commented 3 months ago

Thank you very much for resolving my issue in a timely manner!I'll give it a try later.

ruralqiu commented 3 months ago

Thank you very much for resolving my issue in a timely manner!I'll give it a try later.

------------------ 原始邮件 ------------------ 发件人: "darold/ora2pg" @.>; 发送时间: 2024年3月25日(星期一) 下午4:03 @.>; @.>;"State @.>; 主题: Re: [darold/ora2pg] An error occurred while migrating data from Oracle spatial! (Issue #1759)

Hi, everything is working well with your example, here is the data export from ora2pg: INSERT INTO "T_GIS_KJZBDZB_COPY" ("ID","ZYID","ZYLX","SHAPE","IS_EFFECTIVE","CREATE_TIME","UPDATE_TIME","ORG_CODE","CREATE_USER") VALUES (E'760c4b12d39d40179ee3ad898a9c644b',E'be71a21c62194004852070f33e60b968',E'SGXX',ST_GeomFromText('POINT (83.419189453125 42.890625)', 4326),E'1','2018-03-28 11:59:59.362000','2018-03-28 11:59:59.362000',E'65010200000000000001',E'fc9d67c9f03f44f6a63886015485dc83');
— Reply to this email directly, view it on GitHub, or unsubscribe. You are receiving this because you modified the open/close state.Message ID: @.***>