RE: Dataguard Monitoring

  • From: Don Granaman <DonGranaman@xxxxxxxxxxxxxxx>
  • To: "howard.latham@xxxxxxxxx" <howard.latham@xxxxxxxxx>, ORACLE-L <oracle-l@xxxxxxxxxxxxx>
  • Date: Wed, 6 Oct 2010 10:37:31 -0500

Don't know if much is different in 11g, but this works in 10.2.

On the standby, this info is available via:
SQL> select * from v$dataguard_stats;

Although, I do something a bit different - monitoring how far (in time) the 
standby is behind - from the primary, via cron.

$ chk-standby.sh
2010-10-06 10:26 : standby is 1.73 minutes behind

--- Cut here for rather awkward shell script.  I might upgrade to Andrew's ---
USAGE="chk-standby.sh"
THRESHHOLD=30

cd $DBA_LOGBOOK
sqlplus -s sys/`getpass sys`@MYSTANDBY as sysdba << EOF
spool chk-standby.log
REM column MINUTES_BEHIND format 999999.9
set echo off heading off trimspool on termout off
select to_char(sysdate,'YYYY-MM-DD HH24:MI'),
       ': standby is ' || trim(to_char(1440 * (sysdate - 
max(next_time)),99999.99) ||
       ' minutes behind') from v\$archived_log where applied = 'YES';
quit
EOF

# Begin stuff that makes real shell scripters cringe
cat chk-standby.log | grep -v '^$' >> standby-chk.log
expr `cat chk-standby.log | cut -c31-100 | cut -d" " -f1` > late.log
export LATE=`cat late.log | grep -v '^$' | cut -d"." -f1`

if [ ${LATE} -gt ${THRESHHOLD} ]
then
   cat chk-standby.log | grep -v '^$' > ~/dbalogs/standby.errors
   mail -s "$0 : `date +%m/%d/%y:%H:%M:%S`" criticallist < 
$DBA_LOBOOK/standby.errors
fi

rm -f $DBA_LOGBOOK/standby.errors late.log chk-standby.log


PS: I don't trust that new-fangled grid control thingie.  Its just another 
failure point.  Humph.
________________________________
From: oracle-l-bounce@xxxxxxxxxxxxx [mailto:oracle-l-bounce@xxxxxxxxxxxxx] On 
Behalf Of Howard Latham
Sent: Tuesday, October 05, 2010 8:10 AM
To: ORACLE-L
Subject: Dataguard Monitoring

Anyone point me in the right direction for an 11g Linux Script to
monitor Dataguard lag?

I have googled and looked on oracle Support.

--
Howard A. Latham

Sent from my Nokia N97

Other related posts: