問題是因後臺沒法登陸發現該BUG的,連PLSQL及服務器上的oracle DBA也沒法登陸oraclesql
查看系統相關資源:數據庫
負載高,系統層的CPU使用高, 解決方法: 重啓服務器,問題解決服務器
經過查找緣由:oracle
獲得如下BUG而引發問題的所在app
oracle版本是10.2.0.1。只要Linux x86主機運行天數是是24.8的倍數都有可能引起該bug(剛恰好上面系統運行的時間是198天),由於time()函數值爲null,形成無限死循環,從而耗盡cpu。 less
該oracle BUG的解決方法以下:ide
解決辦法三種:
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
Invoking OPatch 10.2.0.1.0
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
--------------------------------------------------------------------------------
OPatch succeeded.
啓動數據庫、監聽和dbconsole
$ sqlplus / as sysdba
SQL> startup
$ lsnrctl start
$ emctl start dbconsole
若是有須要,還能夠刪除patch,刪除前先停庫
$ cd $ORACLE_BASE/patches/4612267
$ $ORACLE_HOME/OPatch/opatch rollback -id 4612267
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
…
RollbackSession removing interim patch '4612267' from inventory
The local system has been patched and can be restarted.
OPatch succeeded.
此時再執行上面的驗證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)
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
times(NULL) = -1825782405
times(NULL) = -1825782405
times(NULL) = -1825782405
times(NULL) = -1825782405
times(NULL) = -1825782405
times(NULL) = -1825782405
系統資源太高的真正緣由在於此!!
函數