您的位置:首页 > 移动开发 > Objective-C

DataPump Import Of Object Types Fails With Errors ORA-39083 ORA-2304 Or ORA-39117 ORA-39779 (Doc ID

2013-11-23 14:25 3747 查看
Applies to:

Oracle Server - Enterprise Edition - Version 10.1.0.2 to 11.2.0.3 [Release 10.1 to 11.2]

Information in this document applies to any platform.

***Checked for relevance on 30-NOV-2011***

Symptoms

The example below is based on the directory object my_dir that refers to an existing directory on the server where the Oracle RDBMS is installed. Example:

Windows: CONNECT system/manager

CREATE OR REPLACE DIRECTORY my_dir AS 'D:\export';

GRANT read, write ON DIRECTORY my_dir TO public;

Unix: CONNECT system/manager

CREATE OR REPLACE DIRECTORY my_dir AS '/home/users/export';

GRANT read, write ON DIRECTORY my_dir TO public;

A schema that owns object types needs to be duplicated from schema U1 to schema U2 in the same database. Example:

CONNECT system/manager

CREATE USER u1 IDENTIFIED BY u1 DEFAULT TABLESPACE users;

CREATE USER u2 IDENTIFIED BY u2 DEFAULT TABLESPACE users;

ALTER USER u1 QUOTA UNLIMITED ON users;

ALTER USER u2 QUOTA UNLIMITED ON users;

GRANT create session, create table, create type TO u1;

GRANT create session, create table, create type TO u2;

CONNECT u1/u1

CREATE TYPE my_coltype AS OBJECT (nr NUMBER, txt VARCHAR2(10))

/

CREATE TYPE my_tabtype AS OBJECT (nr NUMBER, txt VARCHAR2(10))

/

CREATE TABLE my_reltab (nr NUMBER, col1 my_coltype);

CREATE TABLE my_objtab OF my_tabtype;

INSERT INTO my_reltab VALUES (1, my_coltype(1, 'Line 1'));

INSERT INTO my_objtab VALUES (1, 'Line 1');

COMMIT;

The schema U1 can be exported successfully. E.g.:

expdp system/manager DIRECTORY=my_dir DUMPFILE=expdp_u1.dmp LOGFILE=expdp_u1.log SCHEMAS=u1

The import into schema U2 fails though with the following errors:

impdp system/manager DIRECTORY=my_dir DUMPFILE=expdp_u1.dmp LOGFILE=impdp_u1.log

REMAP_SCHEMA=u1:u2...

ORA-39083: Object type TYPE failed to create with error:

ORA-02304: invalid object identifier literal

Failing sql is:

CREATE TYPE "U2"."MY_COLTYPE" OID 'DDB334945FA24A41AC0099E457715B62' as ...

ORA-39083: Object type TYPE failed to create with error:

ORA-02304: invalid object identifier literal

Failing sql is:

CREATE TYPE "U2"."MY_TABTYPE" OID 'EEC16EAE6DF34B4FA755DBB448EC4F78' as ...

Processing object type SCHEMA_EXPORT/TABLE/TABLE

ORA-39117: Type needed to create table is not included in this operation. Failing sql is:

CREATE TABLE "U2"."MY_RELTAB" ...

ORA-39117: Type needed to create table is not included in this operation. Failing sql is:

CREATE TABLE "U2"."MY_OBJTAB" OF "U2"."MY_TABTYPE" ...

...

Similar errors with the original export and import utilities are:

...

IMP-00017: following statement failed with ORACLE error 2304:

"CREATE TYPE "MY_COLTYPE" TIMESTAMP '2006-01-04:12:36:27' OID 'F1C8AAABCB114"

"6B0B2672663397B0156' as object (nr number, txt varchar2(10))"

IMP-00003: ORACLE error 2304 encountered

ORA-02304: invalid object identifier literal

IMP-00017: following statement failed with ORACLE error 2304:

"CREATE TYPE "MY_TABTYPE" TIMESTAMP '2006-01-04:12:36:28' OID '317DF88365654"

"C6784C17B0FE14C4610' as object (nr number, txt varchar2(10))"

IMP-00003: ORACLE error 2304 encountered

ORA-02304: invalid object identifier literal

IMP-00063: Warning: Skipping table "U2"."MY_OBJTAB" because object type "U2"."MY_TABTYPE"

cannot be created or has different identifier

IMP-00063: Warning: Skipping table "U2"."MY_RELTAB" because object type "U2"."MY_COLTYPE"

cannot be created or has different identifier

Import terminated successfully with warnings.

...Cause

The object types MY_COLTYPE and MY_TABTYPE already exist in the source schema U1. When the types are exported, we also export the object_identifier (OID) of the types. Within the current archictecture,
the object-identifier needs to be unique in the database.

During import (into the same database), we try to create the same object types in the U2 schema. As the OID of the types already exists in the source schema U1, the types cannot be created in the
target schema U2. Import will fail due to:

ORA-02304: invalid object identifier literal

Solution

1. In Oracle10g Release 1 (10.1.0.x.y), you can pre-create the object types and the tables in the target schema, and run an import with the TABLE_EXISTS_ACTION parameter. Example:

CONNECT u2/u2

CREATE TYPE my_coltype AS OBJECT (nr NUMBER, txt VARCHAR2(10))

/

CREATE TYPE my_tabtype AS OBJECT (nr NUMBER, txt VARCHAR2(10))

/

CREATE TABLE my_reltab (nr NUMBER, col1 my_coltype);

CREATE TABLE my_objtab OF my_tabtype;

impdp system/manager DIRECTORY=my_dir DUMPFILE=expdp_u1.dmp LOGFILE=impdp_u1.log

REMAP_SCHEMA=u1:u2
TABLE_EXISTS_ACTION=append...

Processing object type SCHEMA_EXPORT/TYPE/TYPE_SPEC

ORA-31684: Object type TYPE:"U2"."MY_COLTYPE" already exists

ORA-31684: Object type TYPE:"U2"."MY_TABTYPE" already exists

Processing object type SCHEMA_EXPORT/TABLE/TABLE

Processing object type SCHEMA_EXPORT/TABLE/TABLE_DATA

. . imported "U2"."MY_OBJTAB" 6.132 KB 1 rows

. . imported "U2"."MY_RELTAB" 6.226 KB 1 rows

Job "SYSTEM"."SYS_IMPORT_FULL_01" completed with 3 error(s) at 13:13

Note that beginning with Oracle10g Release 2, this will fail for the table MY_RELTAB with the errors:

...

Processing object type SCHEMA_EXPORT/TYPE/TYPE_SPEC

ORA-31684: Object type TYPE:"U2"."MY_COLTYPE" already exists

ORA-31684: Object type TYPE:"U2"."MY_TABTYPE" already exists

Processing object type SCHEMA_EXPORT/TABLE/TABLE

ORA-39152: Table "U2"."MY_RELTAB" exists. Data will be appended to existing table

but all dependent metadata will be skipped due to table_exists_action of append

ORA-39152: Table "U2"."MY_OBJTAB" exists. Data will be appended to existing table

but all dependent metadata will be skipped due to table_exists_action of append

Processing object type SCHEMA_EXPORT/TABLE/TABLE_DATA

. . imported "U2"."MY_OBJTAB" 6.125 KB 1 rows

ORA-31693: Table data object "U2"."MY_RELTAB" failed to load/unload and is being skipped

due to error:

ORA-29913: error in executing ODCIEXTTABLEOPEN callout

ORA-29400: data cartridge error

ORA-39779: type "U2"."MY_COLTYPE" not found or conversion to latest version is not possible

Job "SYSTEM"."SYS_IMPORT_FULL_01" completed with 6 error(s) at 12:39:54

2. Beginning with Oracle10g Release 2 (10.2.0.x.y), there is no need to pre-create the object types and the tables in the target schema. Instead, you can use the Import DataPump parameter TRANSFORM
which enables you to alter object creation DDL for the types. The value N (= No) for the transform name OID implies that a new OID is assigned. Example:

impdp system/manager DIRECTORY=my_dir DUMPFILE=expdp_u1.dmp LOGFILE=impdp_u1.log

REMAP_SCHEMA=u1:u2 TRANSFORM=oid:n...

Processing object type SCHEMA_EXPORT/TYPE/TYPE_SPEC

Processing object type SCHEMA_EXPORT/TABLE/TABLE

Processing object type SCHEMA_EXPORT/TABLE/TABLE_DATA

. . imported "U2"."MY_OBJTAB" 6.125 KB 1 rows

. . imported "U2"."MY_RELTAB" 6.218 KB 1 rows

Job "SYSTEM"."SYS_IMPORT_FULL_01" completed with 1 error(s) at 12:38:56

Note that the remaining error is an ORA-31684 "Object type USER:"U2" already exists", which was reported earlier at the import. This error is not related. The ORA-31684 can be ignored if the target
schema already exists in the target database.

Also note that the transform name OID for the Import DataPump parameter TRANSFORM has been introduced in Oracle10g Release 2 (10.2.0.x.y). If you use this value in Oracle10g Release 1, the Import
DataPump job will fail with:
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: 
相关文章推荐