## Modified by Sugivaradhan #!/bin/ksh #This script monitors the Data Guard standby gap and sends an alert if it exceeds the threshold. #Set variables ORACLE_SID=$1 ORACLE_HOME=`ps -ef |grep pmon|grep $1|awk {'print "pwdx " $2 '}|sh|awk {'print $2 '}|sed 's/....$//'` export PATH=$PATH:$ORACLE_HOME/bin STANDBY_GAP_THRESHOLD=$2 export ORACLE_HOME PATH ORACLE_SID STANDBY_GAP_THRESHOLD #Set output file and remove any existing log file out_file=/home/oracle/monitor_gap_NEW.log rm $out_file 2>/dev/null touch $out_file #Run SQL script to check standby gap standby_gap() { sqlplus -s "/ as sysdba" > $out_file <