生產環境資料庫恢復一例

husthxd發表於2004-09-28

恢復過程如下......


現場情況:startup nomout/mount出現ora-600錯誤。警告日誌檔案沒有具體的錯誤資訊。初步估計是spfile的問題,用create spfile from pfile=‘’後,資料庫可以mount,開啟的時候出現回滾表空間資料檔案需要恢復的錯誤,斷定資料檔案損壞,用alter database 把資料檔案offline drop,開啟資料庫,用exp對業務使用者做邏輯備份,exp過程中出現其中一張表不能export的錯誤,原因是需要讀損壞的資料檔案,經查驗後該表是附件表,資料不是特別重要,而且現場有430號的exp備份,故跳過該表繼續進行exp

備份完畢後,在資料庫open狀態下,新建undo表空間,用alter system 把回滾表空間切換到該表空間上;shutdownstartup資料庫,想把原來的回滾表空間用drop tablespace來清掉的時候,出現回滾段有活動事務的錯誤,諮詢oracle支援,據oracle工程師的說法,需要新建資料庫並把原來的業務資料重新import到資料庫中。於是重建資料庫,建立與原來資料庫使用者一致的使用者名稱,用imp的使用者模式把原業務資料重新imp到新資料庫中。附件表資料用430號的備份來匯入。

修改中介軟體伺服器資料來源的sid,指向新資料庫,並測試透過。最後開啟業務應用,確認應用可以連線資料庫,操作一切正常,恢復完成。

 

附件1

執行指令碼

create spfile from pfile=’’;

startup mount;

alter database datafile ‘’ offline drop;

alter database open;

-- 此時進行exp

create undo tablespace undo_tbs datafile ‘’ size 500m;

alter system set undo_tablespace = undo_tbs scope = both;

shutdown immediate;

startup;

drop tablespace undotbs1 including contents and datafiles;

-- 出錯!只能重建資料庫並匯入

-- 新建資料庫,並用imp匯入業務使用者資料

 

附件2

oracle支援工程師提出的解決方案

 

When the undo tablespace corrupted, there are some active transaction on the undo segment.Since the data file of the undo tablespace have been lost and you have no any backup of them, you have to do a full export of the current database and then create a new database, import the data back into the new database.

You'd better do backup and run the database in archive mode, this can help avoid losting data and recover fast.

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

相關文章