Script Para Listar Erros Distinos no Log do DataPump

DICA RÁPIDA: O script abaixo lista os códigos de erros apresentados em um arquivo de log do DataPump, de forma resumida e com a contagem de ocorrências do mesmo código de erro:

# informar o nome do arquivo de log que foi gerado pelo Data Pump
ARQUIVO_LOG=imp.log

rm -f erros.txt
grep ORA- $ARQUIVO_LOG | awk -F ":" '{ print $1}' | sort | uniq > erros.txt
for E in $(cat erros.txt); do
  QTDE=$(grep -wc $E $ARQUIVO_LOG)
 echo "=========================== $E ($QTDE) =============================================================================="
 TIPO=$(echo "$E" | awk -F "-" '{ print $1} ')
 CODIGO=$(echo "$E" | awk -F "-" '{ print $2} ')
 oerr $TIPO $CODIGO
 echo ""; echo "";
done;

Exemplo do resultado:

$ ./lista_erros.sh
=========================== ORA-00904 (2) ==============================================================================
00904, 00000, "%s: invalid identifier"
// *Cause:
// *Action:


=========================== ORA-00942 (1) ==============================================================================
00942, 00000, "table or view does not exist"
// *Cause:
// *Action:


=========================== ORA-01452 (5) ==============================================================================
01452, 00000, "cannot CREATE UNIQUE INDEX; duplicate keys found"
// *Cause:
// *Action:


=========================== ORA-01775 (1) ==============================================================================
01775, 00000, "looping chain of synonyms"
// *Cause:
// *Action:


=========================== ORA-01917 (32) ==============================================================================
01917, 00000, "user or role '%s' does not exist"
// *Cause:  There is not a user or role by that name.
// *Action: Re-specify the name.


=========================== ORA-02149 (2) ==============================================================================
02149, 00000, "Specified partition does not exist"
// *Cause:   Partition not found for the object.
// *Action:  Retry with correct partition name.


=========================== ORA-31684 (855) ==============================================================================
31684, 00000, "Object type %s already exists"
// *Document: NO


=========================== ORA-31693 (2) ==============================================================================
31693, 00000, "Table data object %s failed to load/unload and is being skipped due to error:\n%s"
// *Cause:  Table failed to load or unload due to some error.
// *Action: Check load/unload error, correct problem and retry command.


=========================== ORA-39082 (63) ==============================================================================
39082, 00000, "Object type %s created with compilation warnings"
// *Cause:  The object in the SQL statement following this error was created
//          with compilation errors. If this error occurred for a view, it
//          is possible that the base table of the view was missing.
// *Action: This is a warning. The object may have to be recompiled before
//          being used.


=========================== ORA-39083 (41) ==============================================================================
39083, 00000, "Object type %s failed to create with error:\n%s\nFailing sql is:\n%s"
// *Cause:  Examine original error code to determine actual cause
// *Action: Original error code will contain more information

O resultado acima pode ser útil para ter uma visão geral de todos os erros ocorridos e ajudar na análise de priorização dos erros que requerem mais atenção.

Leave a Comment

Scroll to Top

Discover more from Blog do Dibiei

Subscribe now to keep reading and get access to the full archive.

Continue reading