[Solved] Issue: ORA-39151 during IMPDP

Neste artigo, vamos compartilhar uma situação de erro ORA-39151 durante processo de IMPDP, e como foi a sua solução.

Havia realizado inicialmente um EXPDP de um owner específico, conforme parâmetros abaixos:

USERID=system/SENHA
SCHEMAS=OWNER
DIRECTORY=BSS
DUMPFILE=EXP_OWNER.dmp
LOGFILE=EXP_OWNER.log

O export deste owner foi realizado com sucesso:

Dump file set for SYSTEM.SYS_EXPORT_SCHEMA_01 is:
  /diretorio/OWNER/EXP_OWNER.dmp
Job "SYSTEM"."SYS_EXPORT_SCHEMA_01" successfully completed at 09:38:41

Já os parâmetros do IMPDP foram:

USERID=system/OUTRASENHA
SCHEMAS=OWNER
DIRECTORY=BSS
DUMPFILE=EXP_OWNER.dmp
LOGFILE=IMP_OWNER.log
REMAP_TABLESPACE=USERS:TSPC_OWNER

Porém, durante o processo de import, as mensagens abaixo eram exibidas no Log:

ORA-31684: Object type TYPE:"OWNER"."TYPE" already exists
...
 
ORA-39151: Table "OWNER"."TABELA" exists. All dependent metadata and data will be skipped due to table_exists_action of skip
...
 
Processing object type SCHEMA_EXPORT/PACKAGE/PACKAGE_SPEC
ORA-31684: Object type PACKAGE:"OWNER"."PACK" already exists
...
 
Processing object type SCHEMA_EXPORT/FUNCTION/FUNCTION
ORA-31684: Object type FUNCTION:"OWNER"."FUNC" already exists
...
 
Processing object type SCHEMA_EXPORT/PROCEDURE/PROCEDURE
ORA-31684: Object type PROCEDURE:"OWNER"."PROC" already exists
...
 
Processing object type SCHEMA_EXPORT/VIEW/VIEW
ORA-31684: Object type VIEW:"OWNER"."VIEW" already exists
...
 
Processing object type SCHEMA_EXPORT/VIEW/GRANT/OWNER_GRANT/OBJECT_GRANT
ORA-39111: Dependent object type OBJECT_GRANT:"OWNER" skipped, base object type VIEW:"OWNER"."VIEW" already exists
...
 
Processing object type SCHEMA_EXPORT/PACKAGE/PACKAGE_BODY
ORA-31684: Object type PACKAGE_BODY:"OWNER"."PKG" already exists
...
 
Processing object type SCHEMA_EXPORT/TYPE/TYPE_BODY
ORA-31684: Object type TYPE_BODY:"OWNER"."TP" already exists
...
 
Processing object type SCHEMA_EXPORT/TABLE/TRIGGER
ORA-39083: Object type TRIGGER:"OWNER"."TRG" failed to create with error:
ORA-04020: deadlock detected while trying to lock object OWNER
...
 
ORA-39083: Object type TRIGGER:"OWNER"."TRG2" failed to create with error:
ORA-00942: table or view does not exist
...
 
ORA-39083: Object type TABLE_STATISTICS failed to create with error:
ORA-20000: TABLE "OWNER"."TAB" does not exist or insufficient privileges

Além disso, ao comparar a quantidade de objetos desse owner na origem e destino, percebíamos diferença de número (faltando objetos no destino).

Para resolver a situação, adicionamos o parâmetro CONSISTENT=Y no EXPDP, e disparamos novamente o processo de export:

USERID=system/SENHA
SCHEMAS=OWNER
DIRECTORY=BSS
DUMPFILE=EXP_OWNER1.dmp
LOGFILE=EXP_OWNER1.log
CONSISTENT=Y

Export finalizado com sucesso:

Dump file set for SYSTEM.SYS_EXPORT_SCHEMA_01 is:
  /diretorio/OWNER/EXP_OWNER1.dmp
Job "SYSTEM"."SYS_EXPORT_SCHEMA_01" successfully completed at 10:49:46

Já no IMPDP, não precisamos adicionar ou alterar nenhum parâmetro. Após o disparo do import, notamos que os erros que eram exibidos antes, não estavam mais acontecendo, e o processo finalizou com sucesso e a quantidade de objetos entre origem e destino ficou a mesma.

Leave a Comment

Your email address will not be published.