問題是因背景無法登入發現該BUG的,連PLSQL及伺服器上的oracle DBA也無法登入oracle
檢視系統相關資源:

負載高,系統層的CPU使用高, 解決方法: 重新開機伺服器,問題解決
通過查找原因:
得到以下BUG而引起問題的所在
oracle版本是10.2.0.1。隻要Linux x86主機運作天數是是24.8的倍數都有可能引發該bug(剛剛好上面系統運作的時間是198天),因為time()函數值為null,造成無限死循環,進而耗盡cpu。
該oracle BUG的解決方法如下:
解決辦法三種:
1) 重新開機主機;
2) 打patch set,如更新到10.2.0.4;
3) 對該bug單獨打臨時patch 4612267。
第一種方法沒有徹底解決問題,以後照舊;第二種方法,更新時間長,且要求停庫很久,目前生産環境暫不适合;
參考文檔:
Doc ID: 338461.1 SQL*Plus 10.2.0.1 Hangs, When System Uptime Is Long Period of Time
Doc ID: 4612267.8 Bug 4612267 - OCI client spins when machine uptime >= 249 days
我采取的是第三種方法,打更新檔包的方式。而且據oracle官方文檔說明,oracle11已經修複該問題。
下面是pache 4612267更新檔包的安裝及驗證方法:
先停監聽、dbconsole和資料庫
$ lsnrctl stop
$ emctl stop dbconsole
$ sqlplus / as sysdba
SQL> shutdown immediate
注意:dbconsole是在已經裝了Oracle EM的情況下要停止,如果未安裝則無需幹涉。
安裝patch
$ mkdir $ORACLE_BASE/patches
$ cd $ORACLE_BASE/patches
$ rz (SecureCRT裡上傳p4612267_10201_LINUX.zip 檔案, 其它上傳方式也可以)
$ unzip p4612267_10201_LINUX.zip
$ cd 4612267/
$ $ORACLE_HOME/OPatch/opatch apply
Invoking OPatch 10.2.0.1.0
…
Please shutdown Oracle instances running out of this ORACLE_HOME on the local system.
(Oracle Home = '/u01/app/oracle/product/10.2.0/db_1')
Is the local system ready for patching?
Do you want to proceed? [y|n]
y (此處輸入y)
User Responded with: Y
ApplySession adding interim patch '4612267' to inventory
The local system has been patched and can be restarted.
OPatch succeeded.
驗證patch
$ $ORACLE_HOME/OPatch/opatch lsinventory
Oracle interim Patch Installer version 10.2.0.1.0
Copyright (c) 2005, Oracle Corporation. All rights reserved
Oracle Home : /u01/app/oracle/product/10.2.0/db_1
Central Inventory : /u01/app/oracle/oraInventory
from : /u01/app/oracle/product/10.2.0/db_1/oraInst.loc
OPatch version : 10.2.0.1.0
OUI version : 10.2.0.1.0
OUI location : /u01/app/oracle/product/10.2.0/db_1/oui
Log file location : /u01/app/oracle/product/10.2.0/db_1/cfgtoollogs/opatch/opatch-2009_Jan_13_11-06-27-HKT_Tue.log
Lsinventory Output file location : /u01/app/oracle/product/10.2.0/db_1/cfgtoollogs/opatch/lsinv/lsinventory-2009_Jan_13_11-06-27-HKT_Tue.txt
--------------------------------------------------------------------------------
Installed Top-level Products (2):
Oracle Database 10g 10.2.0.1.0
Oracle Database 10g Products 10.2.0.1.0
There are 2 products installed in this Oracle Home.
Interim patches (1) :
Patch 4612267 : applied on Tue Jan 13 11:05:10 HKT 2009
Created on 5 Oct 2005, 13:48:00 hrs US/Pacific
Bugs fixed:
4612267
啟動資料庫、監聽和dbconsole
SQL> startup
$ lsnrctl start
$ emctl start dbconsole
如果有需要,還可以删除patch,删除前先停庫
$ cd $ORACLE_BASE/patches/4612267
$ $ORACLE_HOME/OPatch/opatch rollback -id 4612267
RollbackSession removing interim patch '4612267' from inventory
此時再執行上面的驗證patch指令就會發現該patch已經删除了。
注:
Running STRACE tool shows:
$ strace /oracle/home/bin/sqlplus -V 2>&1 |less
……
old_mmap(NULL, 385024, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x41794000
gettimeofday({1122996561, 411035}, NULL) = 0
access("/usr/local/UD/conf/sqlnet.ora", F_OK) = -1 ENOENT (No such file or directory)
access("/usr/local/UD/lib/oracle/network/admin/sqlnet.ora", F_OK) = -1 ENOENT (No such file or directory)
fcntl64(-1218313656, F_SETFD, FD_CLOEXEC) = -1 EBADF (Bad file descriptor)
It is looping on the times() function.--死循環中
times(NULL) = -1825782405
系統資源過高的真正原因在于此!!
本文轉自 holy2009 51CTO部落格,原文連結:http://blog.51cto.com/holy2010/1001600