DBA Hub

📋Steps in this guide1/3

Shell Script To Monitor Lag In Standby Datbase Using Dgmgrl

SCRIPT PREPARATION:

oracle configurationintermediate
by OracleDba
11 views
1

Overview

SCRIPT PREPARATION: PRIMARY DB UNIQUE_NAME –  PRIM STANDBY DB UNIQUE_NAME – STANDBY export ORACLE_SID=PRIM export PATH=$ORACLE_HOME/bin:$PATH
2

Section 2

echo -e “show database STANDBY”|${ORACLE_HOME}/bin/dgmgrl sys/orcl1234 > DB_DG_DATABASE.log cat /home/oracle/DB_DG_DATABASE.log | grep “Apply Lag” > FILTERED_DB_DG_DATABASE.log time_value=`cut -d ” ” -f 14 FILTERED_DB_DG_DATABASE.log` time_param=`cut -d ” ” -f 15 FILTERED_DB_DG_DATABASE.log` if [[ “$time_param” == “minutes” && “$time_value” -ge 1 ]] then mailx -s “DREAIDB LAG is in minutes ” [email protected] <DB_DG_DATABASE.log else if [[ “$time_param” == “seconds” && “$time_value” -ge 30 ]] then mailx -s “DREAIDB LAG is in seconds ” [email protected] <DB_DG_DATABASE.log else if [[ “$time_param” == “hour(s)” && “$time_value” -ge 1 ]] then mailx -s “DREAIDB LAG is in hours ” [email protected] <DB_DG_DATABASE.log fi fi fi
3

Section 3

Code/Command (click line numbers to comment):

1
00,10,20,30,40,50 * * * * /home/oracle/dgmgrl_standby_lag.sh > /tmp/dg_lag.log

Comments (0)

Please to add comments

No comments yet. Be the first to comment!