解決Linux下sqlplus無響應的三種方法
Oracle數(shù)據(jù)庫的sqlplus無響應掛起處理,網(wǎng)上查看資料得知是oracle的bug引起的,事實上只要Linux x86主機運行天數(shù)是24.8的倍數(shù)都有可能引發(fā)該bug,因為time()函數(shù)值為null,造成無限死循環(huán),從而耗盡cpu。接下來我們介紹一下解決辦法。
解決辦法三種:
1) 重啟主機;
2) 打patch set,如升級到10.2.0.4;
3) 對該bug單獨打臨時patch 4612267。
第一種方法沒有徹底解決問題,以后照舊;第二種方法,升級時間長,且要求停庫很久,當前生產(chǎn)環(huán)境暫不適合;
參考文檔:
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
我采取的是第三種方法,打補丁包的方式。而且據(jù)oracle官方文檔說明,oracle11已經(jīng)修復該問題。
下面是pache 4612267補丁包的安裝及驗證方法:
先停監(jiān)聽、dbconsole和數(shù)據(jù)庫
- $ lsnrctl stop
- $ emctl stop dbconsole
- $ sqlplus / as sysdba
- SQL> shutdown immediate
注意:dbconsole是在已經(jīng)裝了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.
啟動數(shù)據(jù)庫、監(jiān)聽和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.
此時再執(zhí)行上面的驗證patch命令就會發(fā)現(xiàn)該patch已經(jīng)刪除了。
注:
- 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.--死循環(huán)中
- times(NULL) = -1825782405
- times(NULL) = -1825782405
- times(NULL) = -1825782405
- times(NULL) = -1825782405
- times(NULL) = -1825782405
- times(NULL) = -1825782405
- times(NULL) = -1825782405
關于Linux下sqlplus沒有反應的問題就介紹到這里了,希望通過本次的介紹能夠帶給您一些收獲!
【編輯推薦】


2022-08-19 11:17:09
2009-06-23 10:45:18
2010-11-16 16:11:28
2022-11-18 15:09:29




