DBA Corner

Data is stored somewhere

IMP-00017: Statement Failed with ORA-02304 During Schema Import

An Oracle schema import can fail when object types are imported back into the same database under a different schema. The log commonly shows IMP-00017 together with ORA-02304: invalid object identifier literal, or the Data Pump wrapper error ORA-39083.

Why it happens

Oracle object types can have database-wide object identifiers (OIDs). By default, an export carries those OIDs into the dump file. If the original type still exists and the import tries to create a copy in another schema with the same OID, Oracle rejects the duplicate identifier.

Recommended Data Pump fix

When cloning a schema with impdp, remap the schema and tell Data Pump to generate new OIDs:

impdp system@target   DIRECTORY=DATA_PUMP_DIR   DUMPFILE=source_schema.dmp   LOGFILE=source_to_target.log   SCHEMAS=SOURCE_SCHEMA   REMAP_SCHEMA=SOURCE_SCHEMA:TARGET_SCHEMA   TRANSFORM=OID:N

TRANSFORM=OID:N prevents assignment of the exported OID to newly created object tables and types. Oracle assigns a new OID instead, which is the intended behavior for a schema clone in the same database.

If the import still fails

  • Confirm that the failing statement is creating an object type and that the log includes ORA-02304.
  • Check whether the target schema already contains the type or dependent tables from an earlier attempt.
  • Review the import log for ORA-39083 and later dependency failures; the first error is usually the useful one.
  • Do not use TABLE_EXISTS_ACTION=APPEND as a general replacement for fixing the type definition. It controls existing table data, not the duplicate OID that caused the type creation to fail.
  • For the legacy imp utility, which has no TRANSFORM=OID:N parameter, test a controlled approach that creates the target types with new identifiers before importing dependent objects. Data Pump is preferable when the database release supports it.

Reference

See Oracle’s Data Pump Import documentation for the REMAP_SCHEMA and TRANSFORM parameters.


Comments

Leave a Reply

Your email address will not be published. Required fields are marked *