1.错误场景
这周,当执行imp导入数据时,意获得ORA-02304错误
imp system/******** file=/mnt/001003/GSICOSTDB_20230527.dmp log=/mnt/001003/gsicostdb_imp.log fromuser=cost touser=cost202305 ignore=y
输出错误细节:
IMP-00003: ORACLE error 2304 encountered
ORA-02304: invalid object identifier literal
IMP-00017: following statement failed with ORACLE error 2304:
"CREATE TYPE "SYS_PLSQL_68261_411_2" TIMESTAMP '2016-08-26:09:06:36' OID '2C"
"77FD389436E573E050007F010075A4' "
" as table of COST."SYS_PLSQL_68261_35"
"4_2";"
IMP-00003: ORACLE error 2304 encountered
ORA-02304: invalid object identifier literal
. . importing table "ACCNDEPT" 0 rows imported
. . importing table "ACCN_CHANGE" 62 rows imported
. . importing table "ACCN_FACT" 0 rows imported
. . importing table "ACCN_TABLE" 0 rows imported
根据网上文章MOSC Doc ID 1367290.1,这不属于oracle bug,原因与oid有关系,当数据库中插入oid时与已有oid冲突时,就会产生错误
2.解决方案:
1.imp后手工重建
2.重新使用expdp导出数据,然后impdp导入数据时使用参数:TRANSFORM=OID:N
因为要手工重加的type太多,我选择expdp/impdp方式
expdp system/******** directory=dir2 dumpfile=GSICOST_EXPDP.dmp logfile=gsicost_expdp.log schemas=cost
impdp system/******** directory=dir2 dumpfile=GSICOST_EXPDP.dmp logfile=gsicost_expdp.log schemas=cost remap_schema=cost:cost202305 TRANSFORM=OID:N