查看alter错误,grep -A,-B,-C的妙用

alert 日志记录了数据库的很多重要信息,要养成时常检查alert日志的习惯,但如果日志很大vi打开翻来覆去找着麻烦,怎么做的可以查错呢?

看我的测试

[[email protected] 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查看,但是看的摸不到头脑,要是能显示错误信息行再分别附带出错后下面的几行应该更好,再往下看

[[email protected] 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)

--是不是看的有点明确了,如果想要出错信息前的几行呢?再往下看
[[email protected] 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 ,再往下看
[[email protected] 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
时间: 2024-10-07 09:49:34

查看alter错误,grep -A,-B,-C的妙用的相关文章

Ubuntu启动、停止、重启MySQL,查看MySQL错误日志、中文编码错误

1)启动: sudo /etc/init.d/mysql start 2)停止: sudo /etc/init.d/mysql stop 3)重启: sudo /etc/init.d/mysql restart 4)查看日志: cat /var/log/mysql.err cat /var/log/mysql/error.log 5)不支持中文 修改 /etc/mysql/my.cnf 在 [client] 下面增加: default-character-set=utf8 或 character

如何查看通过系统命令查看ORA错误信息?

比如直接查看ORA-01031错误 gaosheng-> oerr ora 01031 01031, 00000, "insufficient privileges" // *Cause: An attempt was made to change the current username or password // without the appropriate privilege. This error also occurs if // attempting to ins

查看数据库错误日志的位置

mysql> show variables like "log_error"; +---------------+------------------------------+ | Variable_name | Value | +---------------+------------------------------+ | log_error | /app/log/mysql/error.log | +---------------+--------------------

查看IIS错误日志

部署在IIS中的程序,难免出现数据产生异常 在事件查看器中,可以看出来具体的错误信息,代码定位

Ubuntu启动、停止、重新启动MySQL,查看MySQL错误日志、中文编码错误

1)启动: sudo /etc/init.d/mysql start 2)停止: sudo /etc/init.d/mysql stop 3)重新启动: sudo /etc/init.d/mysql restart 4)查看日志: cat /var/log/mysql.err cat /var/log/mysql/error.log 5)不支持中文 改动 /etc/mysql/my.cnf 在 [client] 以下添加: default-character-set=utf8 或 charact

linux——查看系统日志错误并解决

http://www.cnblogs.com/milliard/p/5597435.html 国内:中科大源日志名称: System来源: volmgr日期: 2017/1/15 星期日 12:14:58事件 ID: 46任务类别: 无级别: 错误关键字: 经典用户: 暂缺计算机: WIN-QP5VIGL12L1描述:故障转储初始化未成功 ----------------错误 2017/1/15 星期日 12:14:54 volmgr 46 无 ----系统错误:故障转储初始化未成功,事件来源v

cocos2dx编译安卓版本查看C++错误

首先,在Mac下面相关软件路径,打开"终端",然后输入  pico .bash_profile  回车 export COCOS2DX_ROOT=/Users/bpmacmini01/Documents/cocos2d-2.1rc0-x-2.1.2/ export NDK_ROOT=/Users/bpmacmini01/Documents/AndroidDevelop/ndk-r9d export ANDROID_NDK_ROOT=/Users/bpmacmini01/Document

Apache服务器不能启动查看启动错误信息

httpd.conf配置错误 如果apache的配置文件httpd.conf搞错了,在windows里启动它,会提示the requested operation has failed ,这是比较郁闷的事,因为查错要看个半天. 其实可以用命令行模式启动apache,并带上参数,apache会提示你哪句有误,然后就可以针对性的解决,命令如下: httpd.exe -w -n "Apache2" -k start 可以在Apache安装目录的bin子目录下使用如下命令安装一个Apache服

cocos2dx编译安卓版本号查看C++错误

首先,在Mac以下相关软件路径,打开"终端",然后输入  pico .bash_profile  回车 export COCOS2DX_ROOT=/Users/bpmacmini01/Documents/cocos2d-2.1rc0-x-2.1.2/ export NDK_ROOT=/Users/bpmacmini01/Documents/AndroidDevelop/ndk-r9d export ANDROID_NDK_ROOT=/Users/bpmacmini01/Document