Data Guard Status
Submitted by dave on Thu, 12/10/2015 - 10:51
Standby - Difference between SCN Timestamp and SYSTIMESTAMP of DB instance
SELECT TO_CHAR(SCN_TO_TIMESTAMP(CURRENT_SCN), 'DD-MON-YYYY HH24:MI SSxFF') as LAST_COMMIT_TIME, TO_CHAR(SYSTIMESTAMP, 'DD-MON-YYYY HH24:MI SSxFF') as CURRENT_DB_TIME FROM V$DATABASE;
Standby - Seconds Between SCN Timestamp and SYSTIMESTAMP of DB instance
SELECT TO_CHAR(SYSDATE,'YYYY-MM-DD HH24:MI'), INST_ID, ( CAST( SYSTIMESTAMP AS DATE ) - CAST( SCN_TO_TIMESTAMP(CURRENT_SCN) AS DATE ) ) * 86400 AS SECONDS_LAG FROM GV$DATABASE;
Standby - Log Apply Status by Thread
SELECT a.thread#, b. last_seq, a.applied_seq, TO_CHAR(a. last_app_timestamp,'YYYY-MM-DD HH24:MI') LAST_APP_TIMESTAMP, b.last_seq-a.applied_seq ARC_DIFF FROM (SELECT thread#, MAX(sequence#) applied_seq, MAX(next_time) last_app_timestamp FROM gv$archived_log WHERE applied = 'YES' GROUP BY thread#) a, (SELECT thread#, MAX (sequence#) last_seq FROM gv$archived_log GROUP BY thread#) b WHERE a.thread# = b.thread#;
Checking Status
alter system set log_archive_dest_state_x=enable scope=both sid='*'; Select message from v$dataguard_status;
Others
select * From v$dataguard_config; select * From v$dataguard_status order by timestamp desc; SELECT DEST_ID "ID", STATUS "DB_status", DESTINATION "Archive_dest", ERROR "Error" FROM V$ARCHIVE_DEST WHERE DEST_ID <=5;