Following script will be useful for tracking Oracle GoldenGate replicat process and related lag. This script will generate output on standard screen. You can redirect it using file redirection to logfile or other locations.
while true
do
<goldengate home directory>/ggsci <<EOF > test.out
info all
exit
EOF
lag=`cat test.out | grep TESTREPLICAT | awk '{print $4}'`
#echo $lag
echo `date +"%m-%d-%y %T"` $lag
sleep 5
done
You can also run the above file contents in background and redirect the output to file using below command.
nohup /home/paresh/check_gg_lag.sh 1>check_gg_lagout 2>&1 &