Oracle數(shù)據(jù)庫(kù)rman恢復(fù)之system表空間恢復(fù)詳解
Oracle數(shù)據(jù)庫(kù)rman恢復(fù)之system表空間恢復(fù)是本文我們主要要介紹的內(nèi)容,system表空間存放著數(shù)據(jù)字典的信息。當(dāng)數(shù)據(jù)庫(kù)處于open狀態(tài),如果system表空間所對(duì)應(yīng)的數(shù)據(jù)文件出現(xiàn)介質(zhì)失敗,那么當(dāng)在其數(shù)據(jù)文件上執(zhí)行I/O操作時(shí),數(shù)據(jù)庫(kù)會(huì)自動(dòng)關(guān)閉;當(dāng)數(shù)據(jù)庫(kù)處于關(guān)閉狀態(tài)時(shí),如果system表空間所對(duì)應(yīng)的數(shù)據(jù)文件出現(xiàn)介質(zhì)失敗,數(shù)據(jù)庫(kù)將不能打開(kāi)。恢復(fù)system表空間必須在mount狀態(tài)下進(jìn)行。
示例一:system表空間的數(shù)據(jù)文件被誤刪除備份數(shù)據(jù)庫(kù)。
刪除system表空間對(duì)應(yīng)的數(shù)據(jù)文件。啟動(dòng)數(shù)據(jù)庫(kù)到mount狀態(tài)。使用restore datafile轉(zhuǎn)儲(chǔ)數(shù)據(jù)文件,并使用recover datafile命令應(yīng)用歸檔日志,***使用alter database open打開(kāi)數(shù)據(jù)庫(kù)。
--備份數(shù)據(jù)庫(kù)(略)
--刪除system表空間對(duì)應(yīng)的數(shù)據(jù)文件
- RMAN> host rm $ORACLE_BASE/product/10.2.0/oradatabak/system01.dbf
- RMAN> startup
- connected to target database (not started)
- Oracle instance started
- database mounted
- RMAN-00571: ===========================================================
- RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS ===============
- RMAN-00571: ===========================================================
- RMAN-03002: failure of startup command at 08/22/2011 21:56:39
- ORA-01157: cannot identify/lock data file 1 - see DBWR trace file
- ORA-01110: data file 1: '/oracle/10g/oracle/product/10.2.0/oradatabak/system01.dbf'
- SQL> select file#,error from v$recover_file;
- FILE# ERROR
- ---------- -----------------------------------------------------------------
- 1 FILE NOT FOUND
- SQL> select file#,name from v$datafile where file#=1;
- FILE# NAME
- ---------- ------------------------------------------------------------------------------------------------------------------------
- 1 /oracle/10g/oracle/product/10.2.0/oradatabak/system01.dbf
--啟動(dòng)數(shù)據(jù)庫(kù)到mount狀態(tài)并進(jìn)行恢復(fù)
- RMAN> run {
- 2> startup force mount;
- 3> restore datafile 1;
- 4> recover datafile 1;
- 5> sql 'alter database open';
- 6> }
示例二:system表空間數(shù)據(jù)文件所在磁盤(pán)出現(xiàn)故障
備份數(shù)據(jù)庫(kù)(略)刪除system表空間對(duì)應(yīng)的數(shù)據(jù)文件。啟動(dòng)數(shù)據(jù)庫(kù)到mount狀態(tài)。在restore database之前,執(zhí)行set newname為數(shù)據(jù)文件指定新的位置。在restore database之后,執(zhí)行switch datafile改變控制文件中數(shù)據(jù)文件位置和名稱(chēng)。之后通過(guò)執(zhí)行recover database應(yīng)用歸檔日志。***執(zhí)行alter database open打開(kāi)數(shù)據(jù)庫(kù)。
--備份數(shù)據(jù)庫(kù)(略)
--刪除system表空間對(duì)應(yīng)的數(shù)據(jù)文件
- RMAN> host 'rm /oracle/10g/oracle/product/10.2.0/oradatabak/system01.dbf'
- 2> ;
--啟動(dòng)數(shù)據(jù)庫(kù)到mount狀態(tài)并進(jìn)行恢復(fù)(為數(shù)據(jù)文件指定新位置,轉(zhuǎn)儲(chǔ)數(shù)據(jù)文件,恢復(fù)數(shù)據(jù)文件,打開(kāi)數(shù)據(jù)庫(kù))
- RMAN> run {
- 2> startup force mount;
- 3> set newname for datafile 1 to '/oracle/10g/oracle/product/10.2.0/oradata/oralife/system01.dbf';
- 4> restore datafile 1;
- 5> switch datafile 1;
- 6> recover datafile 1;
- 7> sql 'alter database open';
- 8> }
關(guān)于Oracle數(shù)據(jù)庫(kù)rman恢復(fù)之system表空間恢復(fù)的相關(guān)知識(shí)就介紹到這里了,希望本次的介紹能夠?qū)δ兴斋@!
【編輯推薦】






