中斷ORACLE資料庫關閉程序導致錯誤案例

2021-09-06 17:27:35 字數 4423 閱讀 4804

昨晚下班的時候,我準備關閉本機的虛擬機器上的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

於是我在另外乙個視窗裡面檢視了一下告警日誌檔案,發現資料庫已經關閉了一些程序。大體情況如下所示

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

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

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 。 謹記於心。

關閉Oracle資料庫

注 其中wmsp 是資料庫個體名稱 gcs 及wms 共享同一 個體 wmsp 目前這伺服器的 oracle 只有一資料庫個體 set oracle sid wmsp 指定現在連線資料庫個體 sqlplus as sysdba 使用sqlplus 應用程式以 sysdba 資料庫系統管理員 帳戶登入...

Oracle資料庫的開啟與關閉 後台程序

資料庫啟動 startup nomount 建立並啟動例項 startup mount 建立例項並裝載資料庫 startup open 建立例項 裝載資料庫 開啟資料庫 startup 預設為startup open 資料庫關閉 shutdown normal 不允許新使用者連線到資料庫,不允許已連...

ORACLE資料庫啟動與關閉

leolin備註 windows系統下,sid為orcl的服務oracleserviceorcl啟動命令為 d oracle product 10.1.0 db 1 bin oracle.exe orcl,所以orcl資料庫已經為open狀態。1 shutdown normal 正常方式關閉資料庫。...