RMAN-08137: warning: archived log not deleted, needed for standby or upstream capture process

A la hora de revisar porque RMAN no era capaz de eliminar los archive logs dándonos el siguiente error:

RMAN-08137: warning: archived log not deleted, needed for standby or upstream capture process
archived log file name=+RECO/XXXXXX/ARCHIVELOG/2024_07_26/thread_2_seq_31382.5872.1175352221 thread=2 sequence=31382
RMAN-08137: warning: archived log not deleted, needed for standby or upstream capture process
archived log file name=+RECO/XXXXXX/ARCHIVELOG/2024_07_26/thread_2_seq_31383.3853.1175352377 thread=2 sequence=31383

Este error es causado porque en una migración no eliminaron de manera correcta los procesados integrados del extract de un ogg.

SQL> r
  1  Select Capture_Name,
  2         Capture_Type,
  3         Status,
  4         To_Char(Required_Checkpoint_Scn, '999999999999999') As Req_Scn,
  5         To_Char(Oldest_Scn, '999999999999999') As Oldest_Scn
  6*   From Dba_Capture

CAPTURE_NAME       CAPTURE_TY STATUS   REQ_SCN          OLDEST_SCN
------------------ ---------- -------- ---------------- ----------------
OGG$CAP_KA2          LOCAL      DISABLED                0                0
OGG$CAP_KA2          LOCAL      DISABLED              0                0

Para eliminarlo, deberíamos entrar en el ogg y ejecutar la siguiente sentencia para cada proceso que se ha quedado obsoleto UNREGISTER EXTRACT #CAPTURE_NAME# DATABASE.

Una vez lanzada la sentencia anterior, si consultamos de nuevo la consulta debería devolvernos cero filas en caso que lo hayamos realizado bien

SQL> r
  1  Select Capture_Name,
  2         Capture_Type,
  3         Status,
  4         To_Char(Required_Checkpoint_Scn, '999999999999999') As Req_Scn,
  5         To_Char(Oldest_Scn, '999999999999999') As Oldest_Scn
  6*   From Dba_Capture

no rows selected

Ejecutamos nuestro pequeño scripts para comprobar que podemos ya eliminar esos archive logs obsoletos

[oracle@_scripts]$ cat rman.sh
#!/bin/bash
. /home/oracle/.bashrc
LOG=$(hostname -s)_`date +%Y%m%d%H%M%S`
touch  ${P_RAIZ}/log/${LOG}.log

rman target / log=${P_RAIZ}/log/${LOG}.log << EOF
run
{
 DELETE NOPROMPT ARCHIVELOG ALL COMPLETED BEFORE 'SYSDATE-1';
}
EOF
[oracle@_scripts]$ . rman.sh
[oracle@_scripts]$

Listo. ¡Espero que os sirva!