我的编程空间,编程开发者的网络收藏夹
学习永远不晚

linux 快速定位alert 日志中出错信息

短信预约 -IT技能 免费直播动态提醒
省份

北京

  • 北京
  • 上海
  • 天津
  • 重庆
  • 河北
  • 山东
  • 辽宁
  • 黑龙江
  • 吉林
  • 甘肃
  • 青海
  • 河南
  • 江苏
  • 湖北
  • 湖南
  • 江西
  • 浙江
  • 广东
  • 云南
  • 福建
  • 海南
  • 山西
  • 四川
  • 陕西
  • 贵州
  • 安徽
  • 广西
  • 内蒙
  • 西藏
  • 新疆
  • 宁夏
  • 兵团
手机号立即预约

请填写图片验证码后获取短信验证码

看不清楚,换张图片

免费获取短信验证码

linux 快速定位alert 日志中出错信息


tail -f -500 /data/oracle/SHPBLS/admin/diag/rdbms/shpbls_sb/SHPBLS/trace/alert_SHPBLS.log


| grep 'ORA-|rror'

tail -n 1000 alert_ahjcyl.log |grep ORA-



cd /data/oracle/SHPBLS/admin/diag/rdbms/shpbls_sb/SHPBLS/trace/
tail -n 1000 alert_*.log
tail -n 1000 alert_*.log  | grep ORA-
tail -n 10000 alert_*.log | grep -A 6 ORA-
tail -n 10000 alert_*.log | grep -B 6 ORA-
tail -n 10000 alert_*.log | grep -C 6 ORA-


[oracle@ahjcyl-db bdump]$ tail -n 1000 alert_ahjcyl.log |grep ORA-
ORA-12012: error on auto execute of job 22
ORA-00054: resource busy and acquire with NOWAIT specified
ORA-06512: at "DOCTOR.SPL_SJPT_ARCHUSAGE", line 18
ORA-06512: at "DOCTOR.SPL_SJPT_DAYLY", line 34
ORA-06512: at line 1

---能看到一错误信息,tail -n xx是最后的多少行通过管道符传给grep查看,但是看的摸不到头脑,要是能显示错误信息行再分别附带出错后下面的几行应该更好,再往下看

[oracle@ahjcyl-db bdump]$ tail -n 10000 alert_ahjcyl.log |grep -A 6 ORA-

WARNING: inbound connection timed out (ORA-3136)
Fri Sep  9 18:01:34 2011
WARNING: inbound connection timed out (ORA-3136)
Fri Sep  9 18:05:29 2011
Thread 1 advanced to log sequence 2566 (LGWR switch)
  Current log# 6 seq# 2566 mem# 0: /oracle/oradata/ahjcyl/redo06_02.log
  Current log# 6 seq# 2566 mem# 1: /oradata/ahjcyl/redo06_01.log
Fri Sep  9 20:14:54 2011
Thread 1 advanced to log sequence 2567 (LGWR switch)
--
ORA-1652: unable to extend temp segment by 128 in tablespace                 TEMP 
Fri Sep  9 22:18:55 2011
ORA-1652: unable to extend temp segment by 128 in tablespace                 TEMP 
Fri Sep  9 22:42:39 2011
ORA-1652: unable to extend temp segment by 128 in tablespace                 TEMP 
Sat Sep 10 01:03:00 2011
Starting control autobackup
Control autobackup written to DISK device
        handle '/oracle/flash_recovery_area/AHJCYL/autobackup/2011_09_10/o1_mf_s_761446980_76nkp55y_.bkp'
Sat Sep 10 01:03:05 2011
ALTER SYSTEM ARCHIVE LOG
--
ORA-12012: error on auto execute of job 22
ORA-00054: resource busy and acquire with NOWAIT specified
ORA-06512: at "DOCTOR.SPL_SJPT_ARCHUSAGE", line 18
ORA-06512: at "DOCTOR.SPL_SJPT_DAYLY", line 34
ORA-06512: at line 1
Wed Sep 14 13:02:18 2011
Thread 1 advanced to log sequence 2711 (LGWR switch)
  Current log# 6 seq# 2711 mem# 0: /oracle/oradata/ahjcyl/redo06_02.log
  Current log# 6 seq# 2711 mem# 1: /oradata/ahjcyl/redo06_01.log
Wed Sep 14 13:13:49 2011
Thread 1 advanced to log sequence 2712 (LGWR switch)

--是不是看的有点明确了,如果想要出错信息前的几行呢?再往下看
[oracle@ahjcyl-db bdump]$ tail -n 10000 alert_ahjcyl.log |grep -B 6 ORA-

  Current log# 1 seq# 2564 mem# 1: /oradata/ahjcyl/redo01_01.log
Fri Sep  9 18:00:14 2011
Thread 1 advanced to log sequence 2565 (LGWR switch)
  Current log# 2 seq# 2565 mem# 0: /oracle/oradata/ahjcyl/redo02_02.log
  Current log# 2 seq# 2565 mem# 1: /oradata/ahjcyl/redo02_01.log
Fri Sep  9 18:01:34 2011
WARNING: inbound connection timed out (ORA-3136)
Fri Sep  9 18:01:34 2011
WARNING: inbound connection timed out (ORA-3136)
--
  Current log# 6 seq# 2566 mem# 1: /oradata/ahjcyl/redo06_01.log
Fri Sep  9 20:14:54 2011
Thread 1 advanced to log sequence 2567 (LGWR switch)
  Current log# 4 seq# 2567 mem# 0: /oracle/oradata/ahjcyl/redo04_02.log
  Current log# 4 seq# 2567 mem# 1: /oradata/ahjcyl/redo04_01.log
Fri Sep  9 22:18:55 2011
ORA-1652: unable to extend temp segment by 128 in tablespace                 TEMP 
Fri Sep  9 22:18:55 2011
ORA-1652: unable to extend temp segment by 128 in tablespace                 TEMP 
Fri Sep  9 22:42:39 2011
ORA-1652: unable to extend temp segment by 128 in tablespace                 TEMP 

--但如果要是看数据的前\后几行呢 a+b ,再往下看
[oracle@ahjcyl-db bdump]$ tail -n 10000 alert_ahjcyl.log |grep -C 6 ORA-

Control autobackup written to DISK device
        handle '/oracle/flash_recovery_area/AHJCYL/autobackup/2011_09_08/o1_mf_s_761322189_76jqtf7g_.bkp'
Completed: alter database add logfile group 2 ('/oracle/oradata/ahjcyl/redo02_02.log','/oradata/ahjcyl/redo02_01.log') size 200m
Thu Sep  8 14:24:03 2011
alter database drop logfile group 3
Thu Sep  8 14:24:03 2011
ORA-1624 signalled during: alter database drop logfile group 3...
Thu Sep  8 14:24:50 2011
alter database drop logfile group 3
Thu Sep  8 14:24:50 2011
Starting control autobackup
Control autobackup written to DISK device
        handle '/oracle/flash_recovery_area/AHJCYL/autobackup/2011_09_08/o1_mf_s_761322290_76jqxljw_.bkp'
--
  Current log# 1 seq# 2564 mem# 1: /oradata/ahjcyl/redo01_01.log
Fri Sep  9 18:00:14 2011
Thread 1 advanced to log sequence 2565 (LGWR switch)
  Current log# 2 seq# 2565 mem# 0: /oracle/oradata/ahjcyl/redo02_02.log
  Current log# 2 seq# 2565 mem# 1: /oradata/ahjcyl/redo02_01.log
Fri Sep  9 18:01:34 2011
WARNING: inbound connection timed out (ORA-3136)
Fri Sep  9 18:01:34 2011
WARNING: inbound connection timed out (ORA-3136)
Fri Sep  9 18:05:29 2011
Thread 1 advanced to log sequence 2566 (LGWR switch)
  Current log# 6 seq# 2566 mem# 0: /oracle/oradata/ahjcyl/redo06_02.log
  Current log# 6 seq# 2566 mem# 1: /oradata/ahjcyl/redo06_01.log
Fri Sep  9 20:14:54 2011
Thread 1 advanced to log sequence 2567 (LGWR switch)
  Current log# 4 seq# 2567 mem# 0: /oracle/oradata/ahjcyl/redo04_02.log
  Current log# 4 seq# 2567 mem# 1: /oradata/ahjcyl/redo04_01.log
Fri Sep  9 22:18:55 2011
ORA-1652: unable to extend temp segment by 128 in tablespace                 TEMP 
Fri Sep  9 22:18:55 2011
ORA-1652: unable to extend temp segment by 128 in tablespace                 TEMP 
Fri Sep  9 22:42:39 2011
ORA-1652: unable to extend temp segment by 128 in tablespace                 TEMP 
Sat Sep 10 01:03:00 2011
Starting control autobackup
Control autobackup written to DISK device
        handle '/oracle/flash_recovery_area/AHJCYL/autobackup/2011_09_10/o1_mf_s_761446980_76nkp55y_.bkp'
Sat Sep 10 01:03:05 2011
ALTER SYSTEM ARCHIVE LOG

--没错就是grep -C 具体解释问男人吧,man grep

免责声明:

① 本站未注明“稿件来源”的信息均来自网络整理。其文字、图片和音视频稿件的所属权归原作者所有。本站收集整理出于非商业性的教育和科研之目的,并不意味着本站赞同其观点或证实其内容的真实性。仅作为临时的测试数据,供内部测试之用。本站并未授权任何人以任何方式主动获取本站任何信息。

② 本站未注明“稿件来源”的临时测试数据将在测试完成后最终做删除处理。有问题或投稿请发送至: 邮箱/279061341@qq.com QQ/279061341

linux 快速定位alert 日志中出错信息

下载Word文档到电脑,方便收藏和打印~

下载Word文档

猜你喜欢

blkid输出信息中如何快速定位特定分区

在blkid的输出信息中,要快速定位特定分区,你可以关注几个关键字段,如设备名(如/dev/sda1)、文件系统类型(如ext4)和UUID(通用唯一标识符)。以下是一些步骤和技巧,帮助你快速定位特定分区:使用grep命令过滤:你可以使用g
blkid输出信息中如何快速定位特定分区
2024-10-11

编程热搜

目录