##########################################
### Run this shell script to monitor the status of the mview refresh.
### Author: Anbu Subramanian
### $1----Instance.
### $2----Log_user.
### $3----Schema_user.
### $4---- Name of the Materialized view.
###########################################
dba_team='anbus@1234'
. /oracle/.102boraenv
dtstamp=`date +%m%d%Y%H%M%S`
opwd=`cat $HOME/mview/.infodb.$1`
export opwd
outputdir=$HOME/mview
sqlplus -s > /dev/null <
$opwd@$1
set feedback off
set echo off
spool $outputdir/$1_broken.log
select broken from dba_jobs where log_user='$2' and schema_user='$3';
spool off
END1
/usr/bin/cat $outputdir/$1_broken.log grep 'N' >>$outputdir/$1_test.log
if [ $? != 0 ]
then
mailx -s " IMPORTANT!!!!!!!!$3.$4@$1 is invalid on $dtstamp " $dba_team <
Error in $3.$4 Materialized view.Please check the status in $1.
Read $outputdir/$1_broken.log for details
EOMAIL
###else###mailx -s "$3.$4@$1 is valid on $dtstamp." $dba_team <$outputdir/$1_test.log
fi
rm $outputdir/$1_test.log
No comments:
Post a Comment