免费注册 查看新帖 |

Chinaunix

  平台 论坛 博客 文库
最近访问板块 发新帖
查看: 1641 | 回复: 1

一个小问题 [复制链接]

论坛徽章:
0
发表于 2006-04-12 16:02 |显示全部楼层
环境:AIX5+ORACLE10
思路:取oracle数据库alert日志当天的oracle错误行
alert_zhjf1.log 部分内容如下
*******
ORA-12012: error on auto execute of job 2335
ORA-06550: line 1, column 96:
PLS-00306: wrong number or types of arguments in call to 'XLT_QF_TJ'
ORA-06550: line 1, column 96:
PL/SQL: Statement ignored
Wed Apr 12 08:49:09 2006
Errors in file /oracle/app/oracle/admin/zhjf/bdump/zhjf1_j000_467086.trc:
ORA-12012: error on auto execute of job 2335
ORA-06550: line 1, column 96:
PLS-00306: wrong number or types of arguments in call to 'XLT_QF_TJ'
ORA-06550: line 1, column 96:
PL/SQL: Statement ignored
Wed Apr 12 08:57:09 2006
Errors in file /oracle/app/oracle/admin/zhjf/bdump/zhjf1_j000_467086.trc:
ORA-12012: error on auto execute of job 2335
ORA-06550: line 1, column 96:
PLS-00306: wrong number or types of arguments in call to 'XLT_QF_TJ'
ORA-06550: line 1, column 96:
PL/SQL: Statement ignored
Wed Apr 12 10:24:52 2006
Thread 1 advanced to log sequence 42519
  Current log# 1 seq# 42519 mem# 0: /dev/rredo1_01.zhkf
Wed Apr 12 10:57:46 2006
Thread 1 advanced to log sequence 42520
  Current log# 5 seq# 42520 mem# 0: /dev/rredo1_05.zhkf
Wed Apr 12 11:23:01 2006
Thread 1 advanced to log sequence 42521
  Current log# 2 seq# 42521 mem# 0: /dev/rredo1_02.zhkf
Wed Apr 12 11:37:43 2006
Thread 1 advanced to log sequence 42522
  Current log# 3 seq# 42522 mem# 0: /dev/rredo1_03.zhkf
Wed Apr 12 11:39:05 2006
Global Enqueue Services Deadlock detected. More info in file
/oracle/app/oracle/admin/zhjf/bdump/zhjf1_lmd0_1876390.trc.
Wed Apr 12 13:20:55 2006
Thread 1 advanced to log sequence 42523
  Current log# 4 seq# 42523 mem# 0: /dev/rredo1_04.zhkf
Wed Apr 12 15:41:11 2006
Thread 1 advanced to log sequence 42524
  Current log# 1 seq# 42524 mem# 0: /dev/rredo1_01.zhkf

实施:
当天时间  格式  date +"%a %h %d"  返回
Wed Apr 12

过滤错误行 awk '/Wed Apr 12/,/test/' alert_zhjf1.log|grep ORA-  返回
ORA-12012: error on auto execute of job 2335
ORA-06550: line 1, column 96:
ORA-06550: line 1, column 96:
ORA-12012: error on auto execute of job 2335
ORA-06550: line 1, column 96:
ORA-06550: line 1, column 96:
ORA-12012: error on auto execute of job 2335
ORA-06550: line 1, column 96:
ORA-06550: line 1, column 96:
ORA-12012: error on auto execute of job 2335
ORA-06550: line 1, column 96:
ORA-06550: line 1, column 96:

关键是awk 后面跟的时间是个变量也就是date +"%a %h %d"  怎么实现??谢了!

论坛徽章:
8
摩羯座
日期:2014-11-26 18:59:452015亚冠之浦和红钻
日期:2015-06-23 19:10:532015亚冠之西悉尼流浪者
日期:2015-08-21 08:40:5815-16赛季CBA联赛之山东
日期:2016-01-31 18:25:0515-16赛季CBA联赛之四川
日期:2016-02-16 16:08:30程序设计版块每日发帖之星
日期:2016-06-29 06:20:002017金鸡报晓
日期:2017-01-10 15:19:5615-16赛季CBA联赛之佛山
日期:2017-02-27 20:41:19
发表于 2006-04-12 16:18 |显示全部楼层
awk -v d="$(date +'%a %h %d')" '$0~d,/test/{if($0~/^ORA-/)print}' alert_zhjf1.log
您需要登录后才可以回帖 登录 | 注册

本版积分规则 发表回复

  

北京盛拓优讯信息技术有限公司. 版权所有 京ICP备16024965号-6 北京市公安局海淀分局网监中心备案编号:11010802020122 niuxiaotong@pcpop.com 17352615567
未成年举报专区
中国互联网协会会员  联系我们:huangweiwei@itpub.net
感谢所有关心和支持过ChinaUnix的朋友们 转载本站内容请注明原作者名及出处

清除 Cookies - ChinaUnix - Archiver - WAP - TOP