- 论坛徽章:
- 0
|
小弟剛接觸Solaris不久, 現根據需要想寫一個自動檢查Oracle alert log,查找有發生錯誤的信息,并發告警mail的腳本。
有在網上找到一位前輩的一個腳本如下,但由于其所輸出的error未包含有日期信息,查看起來不便。
現在希望能連error信息所在行及其以上三行全部輸出,請問要如何做?
小弟所使用的腳本如下:
oracle@fwdev $ cat ckalertlog.sh
####################################################################
## ckalertlog.sh ##
####################################################################
#!/bin/ksh
.. /test/oracle/oracle.profile
for SID in `cat $ORACLE_HOME/SIDLIST`
do
cd $ORACLE_BASE/admin/$SID/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 "Oracle Alert Errors on ${SID} " mymail address < alert.err
fi
rm -f alert.err
rm -f alert_work.log
done
oracle@fwdev $
oracle alert log 如下所示。
Fri Apr 3 23:55:36 2009
ARC1: Evaluating archive log 1 thread 1 sequence 4798
ARC1: Unable to archive log 1 thread 1 sequence 4798
Log actively being archived by another process
Fri Apr 3 23:55:39 2009
ARCH: Completed archiving log 1 thread 1 sequence 4798
Sat Apr 4 00:02:21 2009
Errors in file /oracle/admin/fwprod/bdump/fwprod_ckpt_1556.trc:
ORA-00600: internal error code, arguments: [ksmals], [tabBis:qesmmaComputeBounds], [], [], [], [], [], []
Sat Apr 4 00:02:59 2009
Control autobackup written to SBT_TAPE device
comment 'API Version 2.0,MMS Version 5.0.0.0',
media '720003'
handle 'c-1564407803-20090404-00'
Sat Apr 4 00:03:28 2009
Errors in file /oracle/admin/fwprod/bdump/fwprod_ckpt_1556.trc:
ORA-00600: internal error code, arguments: [ksmals], [tabBis:qesmmaComputeBounds], [], [], [], [], [], []
Sat Apr 4 00:03:54 2009
Starting control autobackup
Sat Apr 4 00:04:35 2009
Errors in file /oracle/admin/fwprod/bdump/fwprod_ckpt_1556.trc:
ORA-00600: internal error code, arguments: [ksmals], [tabBis:qesmmaComputeBounds], [], [], [], [], [], []
請各位不吝賜教,小弟在線等。。。
[ 本帖最后由 suny628 于 2009-4-22 11:53 编辑 ] |
|