轉載-找出Oracle alert檔案中的ORA錯誤
找出Oracle alert檔案中的ORA錯誤
位於$ORACLE_BASE/[SID]/bdump/的alert_[SID].log檔案雖然不影響Oracle的正常執行,但是對於Oracle DBA 來說是一個定位問題的重要線索。今天周大師提出一個需求,通常來說alert檔案比較大,裡面記錄了很多有用的資訊,但是通常來說比較注重看ORA-XXXX的錯誤資訊,如果使用Linux的grep(grep ORA < alert_[sid].log)命令雖然可以輕易地找出所有ORA-XXXX的錯誤,缺丟失了“時間”這個重要的資訊。於是乎,我用Perl寫了個小程式,用於同時獲得這兩個重要的資訊。使用Perl進行編寫的原因是:
1。Linux環境下基本上都有Perl的執行環境。
2。Perl處理文字實在太爽了。
首先,看看alert檔案內容的大概樣子:
... .... Fri Aug 28 22:47:27 2009 Errors in file /u01/app/oracle/admin/ora10g/udump/ora10g_ora_17805.trc: ORA-00313: open failed for members of log group 1 of thread 1 ORA-00312: online log 1 thread 1: '/u01/app/oracle/oradata/ora10g/redo01.log' ORA-27037: unable to obtain file status Linux-x86_64 Error: 2: No such file or directory Additional information: 3 Fri Aug 28 22:47:28 2009 Errors in file /u01/app/oracle/admin/ora10g/udump/ora10g_ora_17805.trc: ORA-00313: open failed for members of log group 2 of thread 1 ORA-00312: online log 2 thread 1: '/u01/app/oracle/oradata/ora10g/redo02.log' ORA-27037: unable to obtain file status Linux-x86_64 Error: 2: No such file or directory Additional information: 3 Fri Aug 28 22:47:29 2009 Errors in file /u01/app/oracle/admin/ora10g/udump/ora10g_ora_17805.trc: ORA-00313: open failed for members of log group 3 of thread 1 ORA-00312: online log 3 thread 1: '/u01/app/oracle/oradata/ora10g/redo03.log' ORA-27037: unable to obtain file status Linux-x86_64 Error: 2: No such file or directory Additional information: 3 .... ...
你看到時間和錯誤資訊了嗎 :) 。以下是我寫的perl小程式:
#! /usr/bin/perl -w # alert_ora_finder.pl use strict; my ($argv) = @ARGV; if ( $argv && ! -e $argv ) { print ' Welcome To Use alert_ora_finder (Oracle Alert File ORA Error Finder) Powered By killkill $ cat alert_[sid].log | alert_ora_finder.pl $ tail -f alert_[sid].log | alert_ora_finder.pl $ alert_ora_finder.pl alert_[sid].log '; exit; } my $cap_regex = '^(\w+ \w+ \d{2} \d{2}:\d{2}:\d{2} \d{4})|(ORA-\d+:.+)$'; my $tmp_date = ""; my $line_counter = 0; while ( <> ) { $line_counter++; if( m/$cap_regex/oi ) { if ($1) { $tmp_date = $1; next; } print "$line_counter | $tmp_date | $2 \n" if ($2); } }
輸入如下:
[root@oracle01 perl]# ./alert_ora_finder.pl /u01/app/oracle/admin/ora10g/bdump/alert_ora10g.log 230 | Fri Aug 28 22:47:27 2009 | ORA-00313: open failed for members of log group 1 of thread 1 231 | Fri Aug 28 22:47:27 2009 | ORA-00312: online log 1 thread 1: '/u01/app/oracle/oradata/ora10g/redo01.log' 232 | Fri Aug 28 22:47:27 2009 | ORA-27037: unable to obtain file status 237 | Fri Aug 28 22:47:28 2009 | ORA-00313: open failed for members of log group 2 of thread 1 238 | Fri Aug 28 22:47:28 2009 | ORA-00312: online log 2 thread 1: '/u01/app/oracle/oradata/ora10g/redo02.log' 239 | Fri Aug 28 22:47:28 2009 | ORA-27037: unable to obtain file status 244 | Fri Aug 28 22:47:29 2009 | ORA-00313: open failed for members of log group 3 of thread 1 245 | Fri Aug 28 22:47:29 2009 | ORA-00312: online log 3 thread 1: '/u01/app/oracle/oradata/ora10g/redo03.log' 246 | Fri Aug 28 22:47:29 2009 | ORA-27037: unable to obtain file status 1411 | Wed Sep 23 23:18:07 2009 | ORA-1653: unable to extend table GAME.MANY_OBJECTS by 128 in tablespace GAME 1413 | Wed Sep 23 23:18:07 2009 | ORA-1653: unable to extend table GAME.MANY_OBJECTS by 128 in tablespace GAME 1415 | Wed Sep 23 23:18:07 2009 | ORA-1653: unable to extend table GAME.MANY_OBJECTS by 128 in tablespace GAME 1469 | Wed Sep 23 23:18:07 2009 | ORA-1652: unable to extend temp segment by 128 in tablespace GAME
其中,最左邊的是輸入端的行號,第二列是時間,第三列就是ORA-XXXX的錯誤資訊了。
來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/17252115/viewspace-749937/,如需轉載,請註明出處,否則將追究法律責任。
相關文章
- 用外部表的方式查詢alert日誌檔案中ora-錯誤資訊
- alert日誌中的兩種ORA錯誤分析
- Oracle的ORA-00059錯誤(超出資料檔案個數)Oracle
- 【轉載】ORA-27054 錯誤解決
- oracle alert日誌檔案報錯ORA-27302: failure occurred at: skgpspawn3OracleAI
- Oracle ORA 錯誤大全Oracle
- ORACLE11GRAC alert日誌ORA-600 [kqlnrc_1]錯誤處理Oracle
- Oracle ORA-錯誤表Oracle
- 【原創】用外部表的方式查詢當天資料庫alert日誌檔案中當天所有的ora-錯誤資訊資料庫
- 檔案-ALERT檔案
- ORA-16038錯誤--當前REDO不能歸檔解決-轉載整理
- 使用sqlldr載入外部檔案中的資料到Oracle中(轉)SQLOracle
- 轉載ORA-01591錯誤故障處理
- Oracle RAC中ORA-01843錯誤分析Oracle
- ORA-01565 亂改SPFILEORCL.ORA檔案造成的錯誤
- 案例學習Oracle錯誤:ORA-00922(轉)Oracle
- Oracle的Ora-00031 錯誤Oracle
- 轉載ORA-01591錯誤故障處理(ji)
- ORA-00265:修改Oracle歸檔模式錯誤分析Oracle模式
- impdp/expdp報錯: ORA-39064: 無法寫入日誌檔案 ORA-29285: 檔案寫入錯誤
- 【11g】使用ADRCI工具的“show alert”命令快速檢索出alert中所有“ORA-”錯誤資訊
- oracle 外部表alert_orcl.oraOracle
- 案例學習Oracle錯誤:ORA-01631(轉)Oracle
- oracle ora-00054錯誤處理Oracle
- oracle錯誤之ORA-00600Oracle
- Oracle 10.2.0.3的Ora-1461錯誤Oracle
- linux命令從log檔案中找出404 或者500的所有報錯資訊?Linux
- vs中的專案載入不出來,提示錯誤
- ALERT日誌中常見監聽相關報錯之一:ORA-609錯誤的排查
- ALERT日誌中常見監聽相關報錯之二:ORA-3136錯誤的排查
- linux中誤刪除oracle資料檔案的恢復操作(轉)LinuxOracle
- Oracle清理trace、alert、aud、listener.log檔案Oracle
- oracle清理trace、alert、aud、listener等日誌檔案Oracle
- 水煮十三《——ora-16038日誌檔案錯誤處理
- Oracle執行expdp寫入NFS檔案系統提示ORA-39001 ORA-39000 ORA-31641 ORA-27054錯誤OracleNFS
- RMAN備份報錯ORA-27040: skgfrcre: 建立錯誤,無法建立檔案
- oracle ORA-00607,ORA-006000錯誤Oracle
- 在 Linux 上找出並解決程式錯誤的主要方法(轉)Linux