Customise Consent Preferences

We use cookies to help you navigate efficiently and perform certain functions. You will find detailed information about all cookies under each consent category below.

The cookies that are categorised as "Necessary" are stored on your browser as they are essential for enabling the basic functionalities of the site. ... 

Always Active

Necessary cookies are required to enable the basic features of this site, such as providing secure log-in or adjusting your consent preferences. These cookies do not store any personally identifiable data.

No cookies to display.

Functional cookies help perform certain functionalities like sharing the content of the website on social media platforms, collecting feedback, and other third-party features.

No cookies to display.

Analytical cookies are used to understand how visitors interact with the website. These cookies help provide information on metrics such as the number of visitors, bounce rate, traffic source, etc.

No cookies to display.

Performance cookies are used to understand and analyse the key performance indexes of the website which helps in delivering a better user experience for the visitors.

No cookies to display.

Advertisement cookies are used to provide visitors with customised advertisements based on the pages you visited previously and to analyse the effectiveness of the ad campaigns.

No cookies to display.

Shell Script To Monitor Lag In Standby Datbase Using Dgmgrl

Breadcrumb Abstract Shape
Breadcrumb Abstract Shape
Breadcrumb Abstract Shape
Breadcrumb Abstract Shape
Breadcrumb Abstract Shape
Breadcrumb Abstract Shape
  • User AvatarKiran Dalvi
  • 01 Oct, 2023
  • 0 Comments
  • 56 Secs Read

Shell Script To Monitor Lag In Standby Datbase Using Dgmgrl

SCRIPT PREPARATION:

PRIMARY DB UNIQUE_NAME –  PRIM
STANDBY DB UNIQUE_NAME – STANDBY

 
#!/bin/bash


export ORACLE_HOME=/oracle/app/oracle/product/12.1.0/dbhome_1

export ORACLE_SID=PRIM

export PATH=$ORACLE_HOME/bin:$PATH

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 ” info@learnomate.org <DB_DG_DATABASE.log
else
if [[ “$time_param” == “seconds” && “$time_value” -ge 30 ]]
then

mailx -s “DREAIDB LAG is in seconds ” info@learnomate.org<DB_DG_DATABASE.log

else
if [[ “$time_param” == “hour(s)” && “$time_value” -ge 1 ]]
then

mailx -s “DREAIDB LAG is in hours ” info@learnomate.org <DB_DG_DATABASE.log
fi
fi
fi

 

Now configure the the script in crontab.
1
00,10,20,30,40,50 * * * * /home/oracle/dgmgrl_standby_lag.sh > /tmp/dg_lag.log

Hope it helps!