實驗操作環境:
作業系統:Red Hat Enterprise Linux ES release 4 (Nahant Update 6)
資料庫 : Oracle Database 10g Release 10.2.0.4.0 – Production 32bit
今晚使用shutdown immediate(其實是執行stop_oracle.sh腳本關閉資料庫,如下所示)關閉資料庫的時候,
在另外一個會話中使用tail -20f 指令檢視告警日志的輸出,結果發現資料庫等待了很長時間都沒有正常關閉,hang住在下面地方:
Active call for process 11121 user 'oracle' program 'oracle@get-orasvr02 (S000)'
Active call for process 7162 user 'oracle' program 'oracle@get-orasvr02 (S011)'
截圖如下

這時解決辦法是找出hang住的程序并殺掉(當時操作沒有截圖,也沒有儲存輸出資訊),因為有些session無法被pmon程序清理,導緻資料庫無法順利關閉,需要手工殺掉程序。首先使用ps 和grep找到這兩個程序。
[ oracle@get-orasvr02 bdump]$ ps -ef | grep oracle | grep S000
[ oracle@get-orasvr02 bdump]$ ps -ef | grep oracle | grep S011
然後使用kill -9 processesid殺掉這兩個程序即可,殺掉這兩個程序後,從告警日志裡面看到裡面跳到關閉dispatcher 。如下所示:
Oracle的官方文檔介紹、解釋如下
The database is waiting for pmon to clean up processes, but pmon is unable to
immediate or normal to hang. Killing them allows pmon to clean up and release
the associated Oracle processes and resources.
What resources are we talking about?
1) Any non committed transactions must be rolled back
2) Any temporary space (sort segments / lobs / session temporary tables) must be freed
3) The session itself and any associated memory consumed by the session.
4) Internal locks / enqueues must be cleaned up
Often Oracle (SMON or PMON depending on whether Shared Server is used) will wait for the OS to terminate the process(es) associated with the session. If the OS never returns, or fails to terminate them, then the instance shutdown will hang with this message (Shutdown Waiting for Active Calls to Complete)
結果解決上面問題後,本以為可以順利關閉資料庫,結果又hang住了,告警日志資訊提示為
SHUTDOWN: Active processes prevent shutdown operation
出現這個錯誤原因:
因為我大概如下的操作導緻:
[oracle@gsp-orasvr02 scripts]$ sqlplus / as sysdba
...........
SQL> !
[oracle@get-orasvr02 ~]$
..... (執行了一些shell 指令)
然後又使用了sqlplus啟動登入了資料庫,然後做shutdown immediate操作,這時導緻shutdown immediate被hang住。
解決辦法:退出目前的會話,回到原始會話,并重新連接配接,就可以正常的關閉資料庫了
本文轉自xiaocao1314051CTO部落格,原文連結:http://blog.51cto.com/xiaocao13140/1932951 ,如需轉載請自行聯系原作者