OBJECTIVE:

Write a script is to monitor goldengate processes like extract and replicat, And in case extract or replicat is down, it will send alert to the respective email ids.

SOLUTION:

Below is the shell script.(gg_alert.sh)

cat gg_alert.sh

#!/bin/bash
EMAIL_LIST="[email protected]"

OIFS=$IFS
IFS="
"
NIFS=$IFS

function status {
OUTPUT=`$GG_HOME/ggsci << EOF 
info all 
exit 
EOF` 
} 
function alert { 
for line in $OUTPUT 
do 
if [[ $(echo "${line}"|egrep 'STOP|ABEND' >/dev/null;echo $?) = 0 ]]
then
GNAME=$(echo "${line}" | awk -F" " '{print $3}')
GSTAT=$(echo "${line}" | awk -F" " '{print $2}')
GTYPE=$(echo "${line}" | awk -F" " '{print $1}')
case $GTYPE in
"MANAGER")
cat $GG_HOME/dirrpt/MGR.rpt | mailx -s "${HOSTNAME} - GoldenGate ${GTYPE} ${GSTAT}" $NOTIFY ;;

"EXTRACT"|"REPLICAT")
cat $GG_HOME/dirrpt/"${GNAME}".rpt |mailx -s "${HOSTNAME} - GoldenGate ${GTYPE} ${GNAME} ${GSTAT}" $EMAIL_LIST ;;
esac
fi
done
}

export GG_HOME=/goldengate/install/software/gghome_1
export ORACLE_HOME=/oracle/app/oracle/product/12.1.0/db_1
export LD_LIBRARY_PATH=$ORACLE_HOME/lib
status
report

Now configure the script in crontab with 30 min interval.

00,30 * * * * /home/goldengate/gg_alert.sh > /home/goldengate/gg_alerts.log
goldengateSHELL script GOLDENGATESHELL SCRIPT


Related Topics

Tablespace monitoring shell script
Shell script to monitor lag in standby datbase using dgmgrl
Alert log rotation script in oracle
Shell script to delete old archives using RMAN
Shell script to report failed login attempt in oracle
Shell script to monitor goldengate process
Shell script for monitoring Alert log
Shell script to monitor asm diskgroup usage
Shell script for monitoring blocking sessions
shell script for file system alert

You May Also Like

How to monitor parallel queries in oracle db
Change dbsnmp password for target db in oem 12c
_use_adaptive_log_file_sync parameter in oracle
How to use oratop tool for oracle database monitoring
ESTIMATE REQUIRED DISK SPACE FOR EXPORT USING estimate_only
COLS & COLSEXCEPT FILTER in goldengate
Steps for changing public hostname for a standalone grid infrastructure
Shell script for monitoring blocking sessions
How to use expdp to export data from physical standby database
Add database as target oracle 12c cloud control

From This Website

How to flashback a Pluggable database ( PDB) in oracle 12.2
ORA-30034: Undo tablespace cannot be specified as temporary tablespace
How to keep or delete columns/Variable of a data frame in R
How to install oracle client in silent mode using response file
Add database as target oracle 12c cloud control
Steps for upgrading weblogic 12.1.2 to 12.1.3
ORA-01536: space quota exceeded for tablespace
ORA-16855: transport lag has exceeded specified threshold
Shell script for monitoring Alert log
How to change flash recovery area location