linux as 5 mailx监控oracle

 

[oracle@oralin5 ~]$ cat .profile
export EDITOR=vi
export ORACLE_BASE=/u01/app/oracle
export ORACLE_HOME=/u01/app/oracle/product/10.2.0/db_1
export ORACLE_SID=tdb
export ORACLE_TERM=xterm
export NLS_DATE_FORMAT='YYYY-MM-DD HH24:MI:SS'
export TNS_ADMIN=/u01/app/oracle/product/10.2.0/db_1/network/admin
export ORA_NLS33=/u01/app/oracle/product/10.2.0/db_1/ocommon/nls/admin/data
export LD_LIBRARY_PATH=/u01/app/oracle/product/10.2.0/db_1/lib:/u01/app/oracle/product/10.2.0/db_1/network/lib:/lib:/usr/lib:/usr/local/lib
export LIBPATH=/u01/app/oracle/product/10.2.0/db_1/lib:/u01/app/oracle/product/10.2.0/db_1/network/lib:/lib:/usr/lib:/usr/local/lib
export PATH=/u01/app/oracle/product/10.2.0/db_1/bin:/u01/app/oracle/product/10.2.0/db_1/lib:./root/bin:/usr/lib/qt-3.3/bin:/usr/kerberos/sbin:/usr/kerberos/bin:/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin:/root/bin:/sbin:/usr/lbin:/usr/sbin:/bin
export TMPDIR=/tmp
export DBALIST="testmail@163.com,abc@def.com.cn"
umask 022
[oracle@oralin5 ~]$

[oracle@oralin5 ~]$ cat mi.sh
#!/bin/ksh
source /home/oracle/.profile
#for SID in `cat $ORACLE_HOME/sidlist`
for SID in 'tdb'
do
cd /u01/app/oracle/admin/tdb/bdump
if [ -f alert_${SID}.log ]
then
mv alert_${SID}.log alert_work.log
touch alert_${SID}.log
cat alert_work.log >> alert_${SID}.hist
grep ORA- alert_work.log > alert.err
fi
if [ `cat alert.err|wc -l` -gt 0 ]
then
mailx -s "testdb ORA- mail ${SID} ORACLE ALERT ERRORS" $DBALIST < alert.err
fi
done
[oracle@oralin5 ~]$

done
[oracle@oralin5 ~]$ crontab -l
* * * * * sleep 5; /home/oracle/mi.sh
[oracle@oralin5 ~]$
[oracle@oralin5 ~]$ cat /etc/hosts
127.0.0.1       localhost
220.181.12.14   smtp.163.com
123.125.50.29   pop3.163.com
192.168.8.132   oralin5
[oracle@oralin5 ~]$

[oracle@oralin5 ~]$ cat /etc/resolv.conf
#search localdomain
nameserver 8.8.8.8
[oracle@oralin5 ~]$

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值