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

Principal Product Manager at Oracle
Ludovico is a member of the Oracle Database High Availability (HA), Scalability & Maximum Availability Architecture (MAA) Product Management team in Oracle. He focuses on Oracle Data Guard, Flashback technologies, and Cloud MAA.

9 thoughts on “Quick Oracle Dataguard check script

  1. Ludovico, can you change your first script from hypothetical to an actual working script. I am getting both values back for the if and the else, and I’m not sure where to turn.

  2. Hi Ludovico,

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

    Thanks,
    Balaji.C

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

  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: DBA survival BLOG » Blog Archive » More about Dataguard and how to check it

  6. 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
    […]

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.