Quick Oracle Dataguard check script

Oracle Dataguard has his own command-line dgmgrl to check the whole dataguard configuration status.
At least you should check that the show configuration command returns SUCCESS.

This is an hypothetic script:

Another script should check for the gap between production online log and the log stream received by the standby database. This can be accomplished with v$managed_standby view.
The Total Block Gap between production and standby can be calculated this way:
Sum all blocks from v$archived_logs where seq# between Current Standby Seq# and Current Production Seq#. Then add current block# of the production LGWR process and subtract current block# from RFS standby process. This gives you total blocks even if there is a log sequence gap between sites.
This is NOT the gap of online log APPLIED to the standby database. THIS IS THE GAP OF ONLINE LOG TRANSMITTED TO THE STANDBY RFS PROCESS and can be used to monitor your dataguard transmission from production to disaster recovery environment.

This is an excerpt of such script (please take care that it does not check against RFS failures, so it can fails when RFS is not alive):

Any comment is appreciated!

The following two tabs change content below.


Oracle ACE Director and Principal Consultant at Trivadis
Ludovico is an Oracle ACE Director, frequent speaker and community contributor, working as Principal Consultant for Trivadis, the leading Oracle consulting firm in Switzerland and German-speaking Europe.

7 thoughts on “Quick Oracle Dataguard check script

  1. I found the following non-critical warning returned by the broker on the first script:
    Warning: ORA-16610: command ‘Broker automatic health check’ in progress

    Is it safe to ignore this warning and force a SUCCESS message??
    echo $result | grep “Broker automatic health check” >/dev/null
    if [ $? -eq 0 ] ; then

  2. Pingback: DBA survival BLOG » Blog Archive » More about Dataguard and how to check it

  3. I get following error when i run ur perl script

    Unterminated operator at ./dg line 30.

  4. you’re right, doing cut&paste of my script it seems that all occurrences of:

    $sth = $prodh->prepare( <<EOSQL );

    have become:

    $sth = $prodh->prepare( < <EOSQL );

    there is an extra blank between < operators. try to remove it and let me know!

  5. Pingback: Dataguard check script for Real Application Clusters (MAA) « DBA survival BLOG

  6. Hi Ludovico,

    How to identify the server i am working on is configured with Oracle data guard set up ?


Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.