Re: Dataguard Monitoring

From: Andrew Kerber <andrew.kerber_at_gmail.com>
Date: Tue, 5 Oct 2010 08:24:21 -0500
Message-ID: <AANLkTinCWg=3W3Fi3TP9pLfCFrp+sqeM0LtRq79TUx=S_at_mail.gmail.com>



I think it is pretty much like 10g. Here is my 10g script:

#!/bin/bash
set -x
# First, we must set the environment . . . . export PATH=$PATH:/usr/local/bin
export ORACLE_SID=$1
export ORAENV_ASK=NO
. oraenv
export TNS_ADMIN=$ORACLE_HOME/network/admin #ORACLE_HOME=`cat /etc/oratab|grep $ORACLE_SID:|cut -f2 -d':'` #export ORACLE_HOME
export REMDEST=$1"DR"
#export REMDEST
getlog() {
$ORACLE_HOME/bin/sqlplus -s $connstring << ! set echo off feed off head off time off timing off $stmt
exit
!
}

connstring="sys/manager_at_$REMDEST as sysdba"

# GET LATEST SEQUENCE FOR THREAD 1 ON STANDBY # stmt="select max(sequence#) from v\$archived_log where thread# = 1 and applied = 'YES' and resetlogs_change#=(select max(resetlogs_change#) from v\$archived_log);"
thread1_stby=`getlog | tail -1 | while read var; do echo $var; done`

# GET LATEST SEQUENCE FOR THREAD 2 ON STANDBY - uncomment for RAC, add 1 for each rac node#
# stmt="select max(sequence#) from v\$archived_log where thread# = 2 and applied = 'YES' and resetlogs_change#=(select max(resetlogs_change#) from v\$archived_log)"
# thread2_stby=`getlog | tail -1 | while read var; do echo $var; done`

connstring="sys/manager as sysdba"

# GET LATEST SEQUENCE FOR THREAD 1 ON PROD # stmt="select max(sequence#) from v\$archived_log where thread# = 1 and resetlogs_change#=(select max(resetlogs_change#) from v\$archived_log);" thread1_prod=`getlog | tail -1 | while read var; do echo $var; done`

# GET LATEST SEQUENCE FOR THREAD 2 ON PROD #i - uncomment for RAC, add 1 for each rac node#
# stmt="select max(sequence#) from v\$archived_log where thread# = 2 and resetlogs_change#=(select max(resetlogs_change#) from v\$archived_log);" # thread2_prod=`getlog | tail -1 | while read var; do echo $var; done`

thread1_diff=`expr $thread1_prod - $thread1_stby` thread2_diff=0
# uncomment next line for rac
# thread2_diff=`expr $thread2_prod - $thread2_stby`

# if [ "$thread1_diff" -gt 5 ] || [ "$thread2_diff" -gt 5 ]; then if [ "$thread1_diff" -gt 5 ]; then
  MSG=`echo -e "$1 archive logs are out of sync by $thread1_diff logs\n"`   echo "$MSG" | mail -s "** $1"DR" STANDBY OUT OF SYNC **" me_at_myemail.com   echo `date` >> /u01/app/oracle/bin/dg_monitor_history.log   echo $MSG >> /u01/app/oracle/bin/dg_monitor_history.log else
  MSG=`echo -e "Standby for $1 archive logs are in sync\n"`   echo "$MSG" | mail -s "** $1"DR" Standby in Sync **" me_at_myemail.com fi

#if [ "$thread1_diff" -gt 1 ] || [ "$thread2_diff" -gt 1 ]; then if [ "$thread1_diff" -gt 1 ]; then
  MSG=`echo -e "$1 archive logs are out of sync by $thread1_diff logs\n"`   echo `date` >> /u01/app/oracle/bin/dg_monitor_history.log   echo $MSG >> /u01/app/oracle/bin/dg_monitor_history.log fi

On Tue, Oct 5, 2010 at 8:15 AM, <TESTAJ3_at_nationwide.com> wrote:

>
> Howard, what are you trying to accomplish, where archive logs are not being
> shipped?
>
> joe
> _______________________________________
> Joe Testa, Oracle Certified Professional
> Senior Engineering & Administration Lead
> (Work) 614-677-1668
> (Cell) 614-312-6715
>
>
>
>
>
> From: Howard Latham <howard.latham_at_gmail.com> To: ORACLE-L <
> oracle-l_at_freelists.org> Date: 10/05/2010 09:10 AM Subject: Dataguard
> Monitoring Sent by: oracle-l-bounce_at_freelists.org
> ------------------------------
>
>
>
> 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
>
>
>

-- 
Andrew W. Kerber

'If at first you dont succeed, dont take up skydiving.'

--
http://www.freelists.org/webpage/oracle-l
Received on Tue Oct 05 2010 - 08:24:21 CDT

Original text of this message