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.

Ludovico

Oracle ACE Director and Computing Engineer at CERN
Ludovico is an Oracle ACE Director, frequent speaker and community contributor, working as Computing Engineer at CERN, the European Organization for Nuclear Research, in Switzerland.

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
    result=”SUCCESS”
    fi
    […]

  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 ?

    Thanks,
    Balaji.C

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.