您的位置:首页 > 数据库 > Oracle

Nagios监控ORACLE ALERT日志脚本

2015-01-27 13:34 183 查看
这篇文章为本人原创,以被LINUX公社盗用,操他妈的
会点Nagios的知道怎么用吧
#把nagios加入oinstall组
#usermod -a -G oinstall nagios

#! /bin/sh

dbversion=11

bdump=/u01/app/oracle/oradata/PROD/dump/diag/rdbms/prod/PROD/trace/alert_PROD.log

STATE_OK=0

STATE_WARNING=1

STATE_CRITICAL=2

STATE_UNKNOWN=3

if [ $dbversion = 11 ]

then ins_log_pwd=$bdump

else

ins_log_pwd=$ORACLE_BASE/admin/$SERVICE_NAME/bdump/alert_$ORACLE_SID.log

fi

if [ `tail -50 $ins_log_pwd | grep 'ORA-' |grep -v -i -E '1013|1031|1144|1652|1722|8103|12012|3297|1410|2050|3113|3136|1555|1461|00600|1580|27054|6512' | wc -l` -gt 0 ];then

dmsgtmp=`tail -50 $ins_log_pwd | grep 'ORA-' |grep -v -i -E '1013|1031|1144|1652|1722|8103|12012|3297|1410|2050|3113|3136|1555|1461|00600|1580|27054|6512'`

echo "CRITICAL - $dmsgtmp"

echo "Oracle log result:" >> /home/nagios/alert.log

echo " instance alert check result: $dmsgtmp " >> /home/nagios/alert.log

echo `date +%Y-%m-%d-%H:%M:%S` >> /home/nagios/alert.log

exit $STATE_CRITICAL

fi

if [ `tail -50 $ins_log_pwd | grep 'ORA-' |grep -v -i -E '1013|1031|1144|1652|1722|8103|12012|3297|1410|2050|3113|3136|1555|1461|00600|1580|27054|6512' | wc -l` -eq 0 ];then

echo "No error"

exit $STATE_OK

fi

错误对照:
ORA-1013:用户请求取消当前的操作

ORA-1031:权限不足

ORA-1144:文件大小 ( 块) 超出 块的最大数

ORA-1652:无法通过(在表空间中)扩展 temp 段

ORA-1722:无效数字

ORA-8103:object no longer exists”

// *Cause: The object has been deleted by another user since the operation

// began, or a prior incomplete recovery restored the database to

// a point in time during the deletion of the object.

// *Action: Delete the object if this is the result of an incomplete

// recovery.

ORA-12012:error on auto execute of job 计划任务执行失败了

ORA-3297:file contains used data beyond requested RESIZE value

Cause: Some portion of the file in the region to be trimmed is currently in use by a database object

Action: Drop or move segments containing extents in this region prior to resizing the file, or choose a resize value such that only free space is in the trimmed.

ORA-1410:无效的 ROWID

ORA-2050:事务处理已重算,某些远程 DBs 可能有问题

ORA-3113:

ORA-3136:inbound connection timed out

ORA-1555:快照过旧: 回退段号 在名称为 "" 过小snapshot too old

ORA-1461:仅可以为插入 LONG 列的 LONG 值赋值

ORA-00600:死锁

ORA-1580:创建控制备份文件时出错

ORA-27054:NFS file system where the file is created or resides is not mounted with correct options

ORA-6512:类似于这样ORA-06512: at "SYS.DBMS_ISCHED", line 3761

ORA-06512: at "SYS.DBMS_ISCHED", line 772

ORA-06512: at "SYS.DBMS_SCHEDULER", line 1236

ORA-06512: at line 2
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: