2008年(8065)
分类: 服务器与存储
2008-05-21 09:22:46
每天晚上服务器上的所有批处理作业执行完后,我们都要在服务器上运行一个错误检查,它是一个简单的批处理文件,在关键日志中用关键字执行qgrep并格式化信息以让其可读性更佳,和前面叙述的一样,你可以通过文件名容易地从“当前的”日志中分辨出“旧的”日志,下面是批处理文件error_check.bat的内容:
代码清单15:
error_check.bat set SERVER=DBSERVER set LOGFILE=error_check.log echo ********************************************************* > %LOGFILE% echo ******************************************************** >> %LOGFILE% echo ******************************************************** >> %LOGFILE% echo %SERVER% >> %LOGFILE% echo Daily Error Report >> %LOGFILE% date /T >> %LOGFILE% echo ******************************************************** >> %LOGFILE% echo ******************************************************** >> %LOGFILE% echo ******************************************************** >> %LOGFILE% echo . >> %LOGFILE% echo . >> %LOGFILE% echo ******************************************************** >> %LOGFILE% echo The following files have been found with errors. >> %LOGFILE% echo ******************************************************** >> %LOGFILE% echo . >> %LOGFILE% echo . >> %LOGFILE% echo Backup files >> %LOGFILE% echo . >> %LOGFILE% qgrep -l RMAN- D:\oracle\admin\common\backup\logs\* >> %LOGFILE% echo . >> %LOGFILE% echo . >> %LOGFILE% echo Batch files >> %LOGFILE% echo . >> %LOGFILE% qgrep -l error D:\oracle\admin\common\batch\logs\* >> %LOGFILE% echo . >> %LOGFILE% echo . >> %LOGFILE% echo Clone files >> %LOGFILE% echo . >> %LOGFILE% qgrep -l RMAN- D:\oracle\admin\common\clone\logs\* >> %LOGFILE% echo . >> %LOGFILE% echo . >> %LOGFILE% echo Alert Logs >> %LOGFILE% echo . >> %LOGFILE% @rem qgrep -l ORA- D:\oracle\product\10.2.0\admin\DBNAME1\udump\* >> %LOGFILE% qgrep -l ORA- D:\oracle\product\10.2.0\admin\DBNAME2\udump\* >> %LOGFILE% @rem echo . >> %LOGFILE% echo . >> %LOGFILE% |
备份文件检查是检查RMAN错误,批处理文件检查是检查文件删除和创建动作,克隆文件错误检查是检查数据库复制是否失败,警告日志检查容易使人误解,实际上它是检查udump目录是否有文件错误,在日志创建后,我们使用一个自由邮件客户端Bmail将其发送给我们,下面是我们的邮件批处理文件email_errors.bat内容:
代码清单16:
bmail -s 10.10.10.10 -t support2@thecountyoverhere.gov -f Oracle@ thecountyoverhere.gov -h -a "DBSERVER Daily Error Report" -m error_check.log bmail -s 10.10.10.10 -t support1@thecountyoverthere.gov -f Oracle@ thecountyoverhere.gov -h -a "DBSERVER Daily Error Report" -m error_check.log |