停庫前執行alter system checkpoint 很重要!

531968912發表於2016-09-22
近期幾次停一個庫遷檔案時, 發現srvctl stop instance xxx 停庫後, 遷完檔案在open時報
SQL> alter database open;
alter database open
*
ERROR at line 1:
ORA-01122: database file 113 failed verification check
ORA-01110: data file 113: '+DATA2/isddw/datafile/isdh36m201006032.30232.732834105'
ORA-01207: file is more recent than control file - old control file


檢查沒有發現diskgroup有disk offline(以前遇到過有disk offline時,也報類似的錯, online後recover成功),沒有發現有datafile offline
嘗試了以下幾個方法均不行:
1) 直接recover database noparallel
2)嘗試逐個使用單個的控制檔案
3)嘗試將所有節點的asm instance停掉,只啟動節點1的asm, 再open
4)嘗試alter system check datafiles;
5) alter database recover datafile 113 ?
6)recover database using backup controlfile;
(controle_files引數仍是當前的控制檔案) 發現不能自動尋找online redolog

7) 最後recreate control file解決,具體步驟見重建控制
. alter database backup controfile to trace
. 修改trc, 重建controfile file
. 執行recover database noparallel; auto
. open db
. 重建temp tbs, redo log file







這個錯誤是因cache中的資訊沒有及時寫入controlfile導致, 避免的方法是在每次停庫前,對DB作一次checkpoint, 即
ALTER SYSTEM CHECKPOINT;


要注意的是alter system switch logfile; 也會觸發checkpoint,但只會對執行sql的那個節點,不會對RAC中的所有節點
 

checkpoint_clause

Specify CHECKPOINT to explicitly force Oracle Database to perform. a checkpoint, ensuring that all changes made by committed transactions are written to datafiles on disk. You can specify this clause only when your instance has the database open. Oracle Database does not return control to you until the checkpoint is complete.

GLOBAL In an Oracle Real Application Clusters (RAC) environment, this setting causes Oracle Database to perform. a checkpoint for all instances that have opened the database. This is the default.

LOCAL In an Oracle RAC environment, this setting causes Oracle Database to perform. a checkpoint only for the thread of redo log file groups for the instance from which you issue the statement.

Forcing a Checkpoint: Example The following statement forces a checkpoint:

ALTER SYSTEM CHECKPOINT;
 

來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/25462274/viewspace-2125328/,如需轉載,請註明出處,否則將追究法律責任。

相關文章