昨晚下班的時候,我准備關閉本機的虛擬機上的ORACLE數據庫後准備下班,但是由於我SecureCRT開了多個窗口,結果一不小心,疏忽之下在一個生產服務器上執行了shutdown immediate命令,大概過了6到7秒,發現該命令還沒有響應,我才發現我這個命令執行錯了服務器。一驚之下,想都沒有想直接CTRL+C想中斷這個操作。 如下所示:
SQL> shutdown immeidate;
SP2-0717: illegal SHUTDOWN option
SQL> shutdown immediate;
^C^C^C^C^C
ORA-01013: user requested cancel of current operation
於是我在另外一個窗口裡面查看了一下告警日志文件,發現數據庫已經關閉了一些進程。大體情況如下所示
tail -40f alert_SCM2.log
Wed Aug 6 17:54:37 2014
ARCH shutting down
ARC8: Archival stopped
Wed Aug 6 17:54:42 2014
ARCH shutting down
ARC7: Archival stopped
Wed Aug 6 17:54:47 2014
ARCH shutting down
ARC6: Archival stopped
Wed Aug 6 17:54:52 2014
ARCH shutting down
ARC5: Archival stopped
Wed Aug 6 17:54:57 2014
ARCH shutting down
ARC4: Archival stopped
Wed Aug 6 17:55:05 2014
CLOSE: Error 1013 during database close
Wed Aug 6 17:55:05 2014
SMON: enabling cache recovery
SMON: enabling tx recovery
Wed Aug 6 17:55:05 2014
ORA-1013 signalled during: ALTER DATABASE CLOSE NORMAL...
Wed Aug 6 17:55:07 2014
ARCH shutting down
ARC2: Archival stopped
Wed Aug 6 17:55:12 2014
ARCH shutting down
ARC1: Archival stopped
Wed Aug 6 17:55:17 2014
ARC3: Becoming the heartbeat ARCH
ARC3: Archiving disabled
ARCH shutting down
ARC3: Archival stopped
Wed Aug 6 17:55:17 2014
ARCH shutting down
Wed Aug 6 17:55:17 2014
ARC0: Archival stopped
Wed Aug 6 17:55:18 2014
Thread 1 closed at log sequence 97562
Successful close of redo thread 1
^C
於是立馬查看數據庫的狀態,看看是否正常,結果如下所示,出現了ORA-00604、ORA-00376、ORA-01110等錯誤。
SQL> SQL> SQL> select status from v$instance;
select status from v$instance
*
ERROR at line 1:
ORA-00604: error occurred at recursive SQL level 2
ORA-00376: file 1 cannot be read at this time
ORA-01110: data file 1: '/u01/oradata/SCM2/system01.dbf'
一驚之下,立馬退出了會話,重新登錄後(當時不怎麼冷靜,慌忙之下已經不談定了)
sqlplus / as sysdba
SQL*Plus: Release 10.2.0.4.0 - Production on Wed Aug 6 17:57:11 2014
Copyright (c) 1982, 2007, Oracle. All Rights Reserved.
Connected.
SQL> select status from v$instacne;
select status from v$instacne
*
ERROR at line 1:
ORA-01012: not logged on
SQL> shutdown immdeiate;
SP2-0717: illegal SHUTDOWN option
SQL> exit
Disconnected
SQL> shutdwon immeidiate;
SP2-0734: unknown command beginning "shutdwon i..." - rest of line ignored.
SQL> shutdown immediate;
ORA-24324: service handle not initialized
ORA-24323: value not allowed
ORA-01089: immediate shutdown in progress - no operations are permitted
此時告警日志裡面有大量的這類錯誤。
無奈之下,我只能使用shutdown abort命令了,這時候我反而冷靜下來。但是居然報ORA-01031: insufficient privileges 錯誤,立馬退出然後重新登錄後,將數據庫關閉然後重新啟動。
SQL> shutdown abort
ORA-01031: insufficient privileges
sqlplus / as sysdba
SQL*Plus: Release 10.2.0.4.0 - Production on Wed Aug 6 18:15:00 2014
Copyright (c) 1982, 2007, Oracle. All Rights Reserved.
Connected.
SQL> shutdown abort
ORACLE instance shut down.
SQL> startup
ORACLE instance started.
Total System Global Area 7516192768 bytes
Fixed Size 2095640 bytes
Variable Size 5167384040 bytes
Database Buffers 2298478592 bytes
Redo Buffers 48234496 bytes
Database mounted.
Database opened.
SQL> exit
重新啟動後,監控告警日志,發現沒有異常出現,逐個檢查後發現沒有什麼問題,一顆懸著的心才淡定下來。不過還是要總結一下:這是一次低級失誤,也是印象比較深的一次失誤,我之所以要記錄下來,一來這也是一個案例,二來要自己謹記於心。整個過程中,發現自己一直不冷靜、不談定。其實本來已經shutdown了數據庫,那應該先冷靜分析一下,到底是等數據庫關閉後重新啟動,還是中斷這個進程。 本身ORACLE數據庫已經關閉了一些進程,如果此時中斷shutdown 進程,明顯是個不明智的決定。錯誤的決策導致後面一系列問題的出現,典型的修為不夠! 老大給我的郵件叫我下次應該 relax, calm down and be careful 。 謹記於心。
你這些顯示的文件夾路徑有沒有在物理磁盤上創建呢?還有就是你用init.ora文件創建的pfile裡需要修改幾個地方,例如數據庫名,添加控制文件等。
另外建議你改變一下語言,這樣錯誤容易看懂。
alter session set nls_language=american;
shutdown abort 強制關閉
再 startup # 自動進行實例恢復
正常登陸