Oracle AIX 11g:Automate archive destination notification in mail

Oracle AIX 11g:Automate archive destination notification in mail


This post to get the notification when filesystem archive destination reach at threshold values.



1.Use below script.automate_arc.sh


#!/usr/bin/ksh
######## For Automate disk untilization Mail####
set -a

export ORACLE_SID=DBEXPERT
export ORACLE_HOME=/oracle11g/11.2.0.4/products/apps/11.2.0.4
export PATH=$ORACLE_HOME/bin:$PATH

cd /oracle11g/products/apps/11.2/scripts

sqlplus -s   / as sysdba <<EOF
set lines 150;
set pages 100;
spool /oracle11g/products/apps/11.2/scripts/loc.log
archive log list
spool off

EOF

arc_loc=`cat /oracle11g/products/apps/11.2/scripts/loc.log|grep "Archive destination"`
arc_dest=${arc_loc:21}


echo $arc_dest

df -gt  $arc_dest > res.log
capacity=`awk  -F" "  '{ print $5 }' res.log`
echo $capacity
perc=${capacity:5}
perc1=`echo $perc| tr -d '%'`
echo $perc1
if [[ $perc1 -gt 90 ]]; then
echo "Dear TEAM," >/oracle11g/products/apps/11.2/scripts/ticket.log
echo "                     "   >>/oracle11g/products/apps/11.2/scripts/ticket.log
echo "                     "   >>/oracle11g/products/apps/11.2/scripts/ticket.log

echo "Kindly log a call with Oracle DB Team."   >>/oracle11g/products/apps/11.2/scripts/ticket.log
echo "                     "   >>/oracle11g/products/apps/11.2/scripts/ticket.log
echo "                     "   >>/oracle11g/products/apps/11.2/scripts/ticket.log
echo "Call Type            SR  Call"   >>/oracle11g/products/apps/11.2/scripts/ticket.log
echo "Service Type / Domain        Oracle DBA"   >>/oracle11g/products/apps/11.2/scripts/ticket.log
echo "Classification            Automated Mail:DB Archive destionation almost 90% full"   >>/oracle11g/products/apps/11.2/scripts/ticket.log
echo "Priority                High"   >>/oracle11g/products/apps/11.2/scripts/ticket.log
echo "Engineer Name            By default Auto Alert Staff"   >>/oracle11g/products/apps/11.2/scripts/ticket.log
echo "Call source            Email"   >>/oracle11g/products/apps/11.2/scripts/ticket.log
echo "Title                Automated Mail:DB Archive destionation almost 90% full"   >>/oracle11g/products/apps/11.2/scripts/ticket.log
echo "Call Description    "   >>/oracle11g/products/apps/11.2/scripts/ticket.log
echo "                     "   >>/oracle11g/products/apps/11.2/scripts/ticket.log
echo "                     "   >>/oracle11g/products/apps/11.2/scripts/ticket.log
echo "Dear Team,"   >>/oracle11g/products/apps/11.2/scripts/ticket.log
echo "Please do disk clean up on archive destination."   >>/oracle11g/products/apps/11.2/scripts/ticket.log
echo "Its is almost 90%."   >>/oracle11g/products/apps/11.2/scripts/ticket.log
echo "                     "   >>/oracle11g/products/apps/11.2/scripts/ticket.log
echo "                     "   >>/oracle11g/products/apps/11.2/scripts/ticket.log
echo "**This is automated mail generated**"   >>/oracle11g/products/apps/11.2/scripts/ticket.log

mailx -s "Automated Mail:DB Archive destionation almost 90% full" dba@de.com dba2 de.com< /oracle11g/products/apps/11.2/scripts/ticket.log
fi

rm  /oracle11g/products/apps/11.2/scripts/loc.log
rm /oracle11g/products/apps/11.2/scripts/ticket.log
rm /oracle11g/products/apps/11.2/scripts/res.log

 2.Run the script.

bash automate_arc.sh

Comments

Popular posts from this blog

Agent Installation on Windows Server. SQL Server (Failover Cluster) target addition in OEM 12c

Oracle 10g/11g Linux:SMS the alert logs ORA- errors generated in timestamp

Oracle 11g: Install Instant Client 11.2.0.3.0 on Linux x86_64 Server.