- 论坛徽章:
- 30
|
数据库中日志的信息如下:
ALTER DATABASE MOUNT
Successful mount of redo thread 1, with mount id 256332863
Database mounted in Exclusive Mode
Lost write protection disabled
Completed: ALTER DATABASE MOUNT
Wed Apr 09 18:47:32 2014
ALTER DATABASE OPEN
Errors in file /u01/app/oracle/diag/rdbms/prod/prod/trace/prod_dbw0_5370.trc:
ORA-01157:cannot identify/lock data file 8 - see DBWR trace file
ORA-01110: data file 8: '/u01/app/oracle/oradata/prod/test02.dbf'
ORA-27037: unable to obtain file status
Linux-x86_64 Error: 2: No such file or directory
Additional information: 3
Block change tracking file is current.
Errors in file /u01/app/oracle/diag/rdbms/prod/prod/trace/prod_ora_5420.trc:
ORA-01157: cannot identify/lock data file 8 - see DBWR trace file
ORA-01110: data file 8: '/u01/app/oracle/oradata/prod/test02.dbf'
ORA-1157 signalled during: ALTER DATABASE OPEN...
Wed Apr 09 18:47:34 2014
Checker run found 1 new persistent data failures
Wed Apr 09 18:48:10 2014
Shutting down instance (abort)
License high water mark = 1
USER (ospid: 5439): terminating the instance
Instance terminated by USER, pid = 5439
Wed Apr 09 18:48:11 2014
Instance shutdown complete
Wed Apr 09 18:48:13 2014
Starting ORACLE instance (normal)
我想每天根据时间(Wed Apr 09 18:47:34 2014)时分秒可以忽略了,检查是否有类似ORA-的错误,如果有输出到一个文本中。请问如何写!
如下是我写的脚本:
path='/u01/app/oracle/diag/rdbms/prod/prod/trace/alert_prod.log'
date1=$(date | awk '{print $1,$2,0$3,$6}')
date2=$(grep -o -E "[a-zA-Z]{3} [a-zA-Z]{3} [0-9]{2} [0-9]{2}:[0-9]{2}:[0-9]{2} [0-9]{4}" $path | awk '{print $1,$2,$3,$5}')
if [ "$date1" == "$date2" ];then
grep "ORA-" alert_prod.log>a.txt
else
echo "NO ORA-"
fi
明显缺少在当天的时间里grep查找,但是不知道怎么写,请大家指点一下! |
|