恢復案例:歸檔模式下丟失非系統表空間資料檔案的恢復

blue_prince發表於2005-01-06
             恢復案例:歸檔模式下丟失非系統表空間資料檔案的恢復
1、建立測試表、歸檔日誌並關閉資料庫:
SQL> create table t(a int) tablespace xue;
SQL> insert into  t values(1);
SQL> commit;
SQL> alter system switch logfile;
SQL> shutdown immediate[@more@]

2、模擬資料檔案丟失:刪除兩個非系統資料檔案:
SQL> host del d:oracleoradataxuexue01.dbf
SQL> host del d:oracleoradataxueusers01.dbf
3、啟動資料庫,報錯:
SQL> startup
ORACLE 例程已經啟動。
Total System Global Area   24680476 bytes
Fixed Size                    75804 bytes
Variable Size               7749632 bytes
Database Buffers           16777216 bytes
Redo Buffers                  77824 bytes
資料庫裝載完畢。
ORA-01157: ????/?????? 3 - ??? DBWR ????
ORA-01110: ???? 3: 'D:ORACLEORADATAXUEUSERS01.DBF'
4、檢視恢復檔案狀態:
SQL> select * from v$recover_file;
     FILE# ONLINE  ERROR                   CHANGE# TIME
---------- ------- -------------------- ---------- ----------
         3 ONLINE  FILE NOT FOUND                0
         6 ONLINE  FILE NOT FOUND                0
5、將損壞的資料檔案離線並開啟資料庫:
SQL> alter database datafile 3 offline;
SQL> alter database datafile 6 offline;
SQL> alter database open;
資料庫已更改。
6、複製熱備的資料檔案,對丟失的資料檔案進行復原:
SQL> host copy f:dbusers01.dbf d:oracleoradataxue
SQL> host copy f:dbxue01.dbf d:oracleoradataxue
可以看到資料檔案已還原:
SQL> select * from v$recover_file;

     FILE# ONLINE  ERROR                   CHANGE# TIME
---------- ------- -------------------- ---------- ----------
         3 OFFLINE                         2024404 25-7?  -04
         6 OFFLINE                         2024410 25-7?  -04
7、對丟失的資料檔案進行恢復:
SQL> recover datafile 3
ORA-00279: ?? 2024404 (? 07/25/2004 16:04:43 ??) ???? 1 ????
ORA-00289: ??: D:ORACLEORADATAXUEARCHIVEXUET001S00006.ARC
ORA-00280: ?? 2024404 ???? 1 ???? # 6 ???
指定日誌: {=suggested | filename | AUTO | CANCEL}
auto
已應用的日誌。
完成介質恢復。
SQL> recover datafile 6
ORA-00279: ?? 2024410 (? 07/25/2004 16:05:04 ??) ???? 1
ORA-00289: ??: D:ORACLEORADATAXUEARCHIVEXUET001S00
ORA-00280: ?? 2024410 ???? 1 ???? # 6 ???
指定日誌: {=suggested | filename | AUTO | CANCEL}
auto
已應用的日誌。
完成介質恢復。
8、將離線的資料檔案聯機,驗證恢復:
SQL> alter database datafile 3 online;
SQL> alter database datafile 6 online;
SQL> select * from t;

         A
----------
         1

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

相關文章