DB error due to HP-UX Error:23

liglewang發表於2012-03-24
DB:Oracle 9.2.0.7
OS:HP-UX 9000/800 64bit
週五接到應用人員反映其程式日誌中報如下錯誤:[@more@]

寫記錄時發生一個錯誤。請繼續操作,如果問題仍然存在,請系統管理員檢查應用程式的配置。
(SBL-DBC-00111)
ORA-01116: error in opening database file 762
ORA-01110: data file 762: '/dev/vgcrm09/rlv9_data16g_21'
ORA-27041: unable to open file
HP-UX Error: 23: File table overflow Additional information: 3 (0x56b5) EAITransport EAITransportWarning 2 0
2012-03-22 16:31:13 [3] Stack trace:
寫記錄時發生一個錯誤。請繼續操作,如果問題仍然存在,請系統管理員檢查應用程式的配置。
(SBL-DBC-00111)
ORA-01116: error in opening database file 232
ORA-01110: data file 232: '/dev/vgcrm04/rlv4_undo8g_03'
ORA-27041: unable to open file
HP-UX Error: 23: File table overflow Additional information: 3 (0x56b5) EAITransport EAITransportWarning 2 0
2012-03-22 16:31:19 [3] Stack trace:


由上可知,資料庫在訪問(或者開啟)資料檔案(如上所報:/dev/vgcrm04/rlv4_undo8g_03)時報HP-UX Error:23:File table overflow。
23為HP-UX系統中的錯誤編號,可透過查詢/usr/include/sys/errno.h檔案得到其詳細內容:
crmdb1:[/oracle/wangz]$grep 23 /usr/include/sys/errno.h
* @(#)B11.23_LR common/sys/errno.h $Revision: $
#define ENFILE 23 /* File table overflow */
23表示的意思是:File table overflow,說明當前系統的file table已經溢位了,在HP-UX中,file table大小由核心引數nfile決定,nfile決定了在同一時間系統中所有程式允許開啟檔案數量的最大值。接著查詢系統當前nfile的使用情況:
crmdb1:[/oracle/horizon/wangz]$kcusage |grep nfile
nfile 1495381 / 1500000
當前系統nfile值為1500000,而當前已經使用到了1495381,非常接近於nfile的上限值,因此剛才的報錯就很容易解釋了。

隨後檢視主機作業系統日誌資訊,在/var/adm/syslog/syslog.log檔案中發現如下錯誤:
Mar 22 11:08:00 crmdb1 vmunix: pid 5540 (oracle) killed: stdio_cleanup - system wide limit of open files reached
Mar 22 11:08:05 crmdb1 vmunix: pid 5584 (oracle) killed: stdio_cleanup - system wide limit of open files reached
Mar 22 11:08:05 crmdb1 vmunix: pid 5587 (oracle) killed: stdio_cleanup - system wide limit of open files reached
Mar 22 11:08:05 crmdb1 vmunix: file: table is full

透過詢問研發人員瞭解,其近期並未有新應用程式上線,連線數也並未高出平時太多,還是很懷疑是程式出了問題。該問題需要持續跟蹤監控。
解決該問題的最簡單方法是加大核心引數nfile,不過如果不從根本上找到原因,不管將nfile設成多大,還是有可能會用完的,何況當前1500000已是一個不算小的閥值了。

以下列出關於處理此問題可能會用到的指令碼和命令:
1、顯示當前核心引數配置
kctune
2、顯示當前nfile的使用是多少
kcusage | grep nfile
或者
sar -v 2 3 -- 2:間隔時間(s);3執行次數
3、顯示某個程式開啟的檔案數及詳細檔案
/usr/local/bin/lsof -a -p 29999 -- 29999是作業系統程式號
4、顯示當前系統每個程式開啟的檔案總數(即使用的nfile項)
建立指令碼/tmp/proc_num_file
然後在命令列執行:
glance -adviser_only -syntax /tmp/proc_num_file -iterations 1 > /tmp/proc_num_file.out
檢視/tmp/proc_num_file.out結果檔案即可

proc_num_file指令碼copy於HP網站

來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/25834554/viewspace-1057702/,如需轉載,請註明出處,否則將追究法律責任。

相關文章