2、编写一个check_ora.sh脚本:
#!/usr/bin/ksh
ALERTLOG=/oraclefs/admin/oradb/bdump/alert_ora9i.log
SYSOPR=oracle
# get template first time
# grep "ORA-" $ALERTLOG > /tmp/alertlog.tmplt
grep "ORA-" $ALERTLOG > /tmp/alertlog.cmp
# Compare both files.
# If no difference, let's sleep again
if ! ( cmp -s /tmp/alertlog.tmplt /tmp/alertlog.cmp )
then
banner error
( date; diff /tmp/alertlog.tmplt /tmp/alertlog.cmp | grep ">" | cut -c3- ) | mail -s "Operator: Check alert log" $SYSOPR
mv /tmp/alertlog.cmp /tmp/alertlog.tmplt
fi
3、给这个脚本执行权限:
chmod +x /home/oracle/check_ora.sh
4、在crontab 里增加一条记录:
0 23 * * * /home/oracle/check_ora.sh
5、在客户端设置接收邮件:
在outlook或foxmail中,邮件地址写:oracle@"hostname"
发送和接收邮件服务器都写主机的IP地址
账号和密码写主机的系统账号和密码如:oracle/oracle
6、所有工作完成。
[@more@]来自 “ ITPUB博客 ” ,链接:https://blog.itpub.net/441019/viewspace-1056810/ ,如需转载,请注明出处,否则将追究法律责任。