Check if any archive log applied is skipped in applying on Standby Oracle Database Dataguard

you want to see all logs with their applied status:

SELECT THREAD#, SEQUENCE#, APPLIED
FROM V$ARCHIVED_LOG
ORDER BY THREAD#, SEQUENCE#;

check if any archivelog applied is skipped in between in Dataguard command

To check if any archivelog was skipped during application in Oracle Data Guard, you can use the following SQL command on the standby database:

SELECT THREAD#, SEQUENCE#, APPLIED 
FROM V$ARCHIVED_LOG 
WHERE APPLIED IN ('YES', 'NO') 
ORDER BY THREAD#, SEQUENCE#;

Use a query to highlight gaps

SELECT a.SEQUENCE# AS CURRENT_SEQ, b.SEQUENCE# AS NEXT_SEQ
FROM V$ARCHIVED_LOG a, V$ARCHIVED_LOG b
WHERE a.SEQUENCE# + 1 = b.SEQUENCE#
  AND a.APPLIED = 'YES'
  AND b.APPLIED = 'YES'
  AND b.SEQUENCE# - a.SEQUENCE# > 1
ORDER BY a.SEQUENCE#;

This will help you spot any missing or skipped logs between applied sequences.

To retrieve archived log application status in Oracle Data Guard and filter out sessions that have only NO applied logs,

SELECT THREAD#, 
       MIN(SEQUENCE#) AS FIRST_SEQ, 
       MAX(SEQUENCE#) AS LAST_SEQ, 
       COUNT(*) AS TOTAL_LOGS,
       SUM(CASE WHEN APPLIED = 'YES' THEN 1 ELSE 0 END) AS APPLIED_YES,
       SUM(CASE WHEN APPLIED = 'NO' THEN 1 ELSE 0 END) AS APPLIED_NO
FROM V$ARCHIVED_LOG
GROUP BY THREAD#
HAVING SUM(CASE WHEN APPLIED = 'YES' THEN 1 ELSE 0 END) = 0;

This entry was posted in Oracle on by .
Unknown's avatar

About SandeepSingh

Hi, I am working in IT industry with having more than 15 year of experience, worked as an Oracle DBA with a Company and handling different databases like Oracle, SQL Server , DB2 etc Worked as a Development and Database Administrator.

Leave a Reply