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

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

You May Also Like

Query clause in oracle datapump expdp
How to change sysman password for oracle 12c cloud control
How to drop SQL baselines in oracle
How to enable flash recovery area in oracle database
Display sql_id of the sql, using set feedback in oracle 18C - New feature
How to use expdp to export data from physical standby database
how to use DBMS_PRIVILEGE_CAPTURE to capture privs in oracle 12c
Apply database proactive bundle patch in RAC using manual process
ORA-16855: transport lag has exceeded specified threshold
Important views in For Oracle DBA in daily usage

From This Website

ORA-02304: invalid object identifier literal while import with CREATE TYPE OID
How to get the execution plan for a SQL between two AWR snapshots
EMCLI command - OEM 12C
Shell script to monitor goldengate process
resumable_timeout parameter in oracle database
How to flashback a RAC database
Script to get cpu usage and wait event information in oracle database
sec_case_sensitive_logon parameter in oracle
How to get tablespace quota details of an user in oracle
Schema replication using oracle goldengate