impdp報錯ORA-39083 ORA-02304 Object type TYPE failed to create


環境
Red Hat Enterprise Linux Server release 5.8 (Tikanga)
ORACLE Release 11.2.0.3.0 Production

我用expdp,impdp復制一個shema,在impdp導入的時候報錯
ORA-39083: Object type TYPE failed to create with error:
ORA-02304: invalid object identifier literal
Failing sql is:
CREATE TYPE "GENIDCDEV2"."ARRAY_TYPE2" OID '0367306C82464BF1E0534E092D0A4AB5' is array(48) of varchar2(255)

查看官方文檔的impdp章節,搜索OID,發現了如下有用的內容
查看impdp help=y 可以使用一個參數:transform

TRANSFORM
Enables you to alter object creation DDL for objects being imported.

OID - If the value is specified as n, the assignment of the exported OID during the
creation of object tables and types is inhibited. Instead, a new OID is assigned.
This can be useful for cloning schemas, but does not affect referenced objects. The
default value is y.

這個參數默認是Y,如果改成N,那么導入的時候會把各個對象重新賦予新的OID。
transform=oid:n
這樣,再用impdp導入的時候就不會出現
ORA-39083,ORA-02304
注意:exp/imp不支持oid轉換,又是一個使用數據泵的優勢。

因此我想到了兩種方法可以解決問題
1.用下面impdp語句重新導入
impdp system/'*****' directory=dir_lisx REMAP_SCHEMA=WMSUAT:GENIDCDEV2 dumpfile=wmsuat20150304.dump include=TYPE transform=oid:n logfile=impdp_wmsuat20150304_2.log

Import: Release 11.2.0.3.0 - Production on Wed Mar 4 14:55:40 2015

Copyright (c) 1982, 2011, Oracle and/or its affiliates. All rights reserved.

Connected to: Oracle Database 11g Enterprise Edition Release 11.2.0.3.0 - 64bit Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options
Master table "SYSTEM"."SYS_IMPORT_FULL_01" successfully loaded/unloaded
Starting "SYSTEM"."SYS_IMPORT_FULL_01": system/******** directory=dir_lisx REMAP_SCHEMA=WMSUAT:GENIDCDEV2 dumpfile=wmsuat20150304.dump include=TYPE transform=oid:n logfile=impdp_wmsuat20150304_2.log
Processing object type SCHEMA_EXPORT/TYPE/TYPE_SPEC
Job "SYSTEM"."SYS_IMPORT_FULL_01" successfully completed at 14:55:45


2.手工重建剛才導入失敗的type
核查type的ddl語句
SELECT dbms_metadata.get_ddl('TYPE','ARRAY_TYPE2','WMSUAT') from dual ;

CREATE OR REPLACE TYPE "WMSUAT"."ARRAY_TYPE2" is array(48) of varchar2(255) ;

記得重新編譯一下新clone的schema
EXEC DBMS_UTILITY.compile_schema(schema => 'GENIDCDEV2');

 


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM