0

I am new to Oracle and needing help just getting a quick script to check Oracle Dataguard. Do any of you have a simple script that could be used to just give me a quick status on dataguard? Just a quick check, if dataguard is in sync or not.

I was given the below query, and it appears the script just simply tells the log gap count between the primary and stand by. Does that seem reasonable or is there a better approach? In this case, if the log gap is more than say, 3, then dataguard needs to be investigated?

select LOG_ARCHIVED-LOG_APPLIED "LOG_GAP" from
(SELECT MAX(SEQUENCE#) LOG_ARCHIVED FROM V$ARCHIVED_LOG WHERE DEST_ID=1 AND ARCHIVED='YES'),
(SELECT MAX(SEQUENCE#) LOG_APPLIED FROM V$ARCHIVED_LOG WHERE DEST_ID=2 AND APPLIED='YES');

1 Answer 1

0

Log switches - by default - are not bound to a time limit, meaning a lag of 3 sequences could mean a lag of 3 minutes or 3 hours as well. Periodic log switches can be forced by setting the ARCHIVE_LAG_TARGET parameter.

But it is better to query V$DATAGUARD_STATS on the standby that reports the lag in seconds. Something like:

select
  name,
  value,
  time_computed
from
 v$dataguard_stats
where
  name in ('apply lag', 'transport lag')
;
1
  • Thank you so much for all your help. Commented Dec 30, 2023 at 2:40

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.