控制檔案丟失的RMAN恢復
1. 做一次RMAN的資料庫全備
C:>rman target /
Recovery Manager: Release 10.2.0.1.0 - Production on 星期一 8月 27 13:58:37 2007
Copyright (c) 1982, 2005, Oracle. All rights reserved.
connected to target database: ALEX (DBID=1906837469)
RMAN> run{
2> allocate channel c1 type disk;
3> backup full tag 'FullBackup' format 'd:ora_bakALEX_%U.dbf' database include current controlfile;
4> sql 'alter system archive log current';
5> release channel c1;
6> }
released channel: ORA_DISK_1
allocated channel: c1
channel c1: sid=142 devtype=DISK
Starting backup at 27-8月 -07
channel c1: starting full datafile backupset
channel c1: specifying datafile(s) in backupset
input datafile fno=00001 name=D:ORACLEPRODUCT10.2.0ORADATAALEXSYSTEM01.DBF
input datafile fno=00003 name=D:ORACLEPRODUCT10.2.0ORADATAALEXSYSAUX01.DBF
input datafile fno=00002 name=D:ORACLEPRODUCT10.2.0ORADATAALEXUNDOTBS01.DBF
input datafile fno=00004 name=D:ORACLEPRODUCT10.2.0ORADATAALEXUSERS01.DBF
channel c1: starting piece 1 at 27-8月 -07
channel c1: finished piece 1 at 27-8月 -07
piece handle=D:ORA_BAKALEX_03IQEJ1A_1_1.DBF tag=FULLBACKUP comment=NONE
channel c1: backup set complete, elapsed time: 00:00:56
channel c1: starting full datafile backupset
channel c1: specifying datafile(s) in backupset
including current control file in backupset
including current SPFILE in backupset
channel c1: starting piece 1 at 27-8月 -07
channel c1: finished piece 1 at 27-8月 -07
piece handle=D:ORA_BAKALEX_04IQEJ32_1_1.DBF tag=FULLBACKUP comment=NONE
channel c1: backup set complete, elapsed time: 00:00:03
Finished backup at 27-8月 -07
sql statement: alter system archive log current
released channel: c1
2. 關閉資料庫
SQL> shutdown immediate
Database closed.
Database dismounted.
ORACLE instance shut down.
3. 刪除所有的資料檔案和控制檔案
4. unmount資料庫
SQL> startup force nomount;
ORACLE instance started.
Total System Global Area 167772160 bytes
Fixed Size 1247900 bytes
Variable Size 67110244 bytes
Database Buffers 96468992 bytes
Redo Buffers 2945024 bytes
5. 呼叫dbms_backup_restore包恢復控制檔案(RMAN直接呼叫該包)
SQL> DECLARE
2 devtype varchar2(256);
3 done boolean;
4 BEGIN
5 --分配一個device channel ,因為使用的作業系統檔案,所以這裡為空,如果是從磁帶上恢復要用"sbt_tape"
6 devtype:=sys.dbms_backup_restore.deviceAllocate(type=>'',ident=>'T1');
7 --開始restore
8 sys.dbms_backup_restore.restoreSetDatafile;
9 --指出待恢復檔案目標儲存位置
10 sys.dbms_backup_restore.restoreControlfileTo(cfname=>'D:oracleproduct10.2.0oradataalexControl01.ctl');
11 --從哪個備份片中恢復
12 sys.dbms_backup_restore.restoreBackupPiece(done=>done,handle=>'D:ora_bakALEX_04IQEJ32_1_1.DBF', params=>null);
13 sys.dbms_backup_restore.deviceDeallocate;
14 END;
15 /
PL/SQL procedure successfully completed.
6. 呼叫dbms_backup_restore包恢復資料檔案
SQL> DECLARE
2 devtype varchar2(256);
3 done boolean;
4 BEGIN
5 devtype:=sys.dbms_backup_restore.deviceAllocate (type=>'',ident=>'T1');
6 sys.dbms_backup_restore.restoreSetDatafile;
7 sys.dbms_backup_restore.restoreDatafileTo(dfnumber=>00001,toname=>'D:oracleproduct10.2.0oradataalexSYSTEM01.DBF');
8 sys.dbms_backup_restore.restoreDatafileTo(dfnumber=>00002,toname=>'D:oracleproduct10.2.0oradataalexUNDOTBS01.DBF');
9 sys.dbms_backup_restore.restoreDatafileTo(dfnumber=>00003,toname=>'D:oracleproduct10.2.0oradataalexSYSAUX01.DBF');
10 sys.dbms_backup_restore.restoreDatafileTo(dfnumber=>00004,toname=>'D:oracleproduct10.2.0oradataalexUSERS01.DBF');
11 sys.dbms_backup_restore.restoreBackupPiece(done=>done,handle=>'d:ora_bakALEX_03IQEJ1A_1_1.DBF', params=>null);
12 sys.dbms_backup_restore.deviceDeallocate;
13 END;
14 /
PL/SQL procedure successfully completed.
7. 介質恢復資料庫,要求resetlogs
SQL> startup mount force
ORACLE instance started.
Total System Global Area 167772160 bytes
Fixed Size 1247900 bytes
Variable Size 67110244 bytes
Database Buffers 96468992 bytes
Redo Buffers 2945024 bytes
Database mounted.
SQL> recover database using backup controlfile until cancel ;
ORA-00279: change 547460 generated at 08/27/2007 14:03:23 needed for thread 1
ORA-00289: suggestion : D:ORACLEPRODUCT10.2.0ORADATAALEXARCHIVEARC00003_0631720033.001
ORA-00280: change 547460 for thread 1 is in sequence #3
Specify log: {
cancel
Media recovery cancelled.
SQL> alter database open resetlogs;
Database altered.
SQL> select instance_name,status from v$instance;
INSTANCE_NAME STATUS
---------------- ------------
alex OPEN
8. 做一次全備
9. 小結:控制檔案必須分開備份,RMAN備份的日誌也很重要
來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/7319461/viewspace-966374/,如需轉載,請註明出處,否則將追究法律責任。
相關文章
- rman恢復--丟失控制檔案的恢復
- 控制檔案丟失恢復
- 【控制檔案丟失恢復】
- 恢復丟失的控制檔案
- 只有rman備份集,控制檔案丟失的恢復
- RMAN - "丟失控制檔案的恢復"
- 控制檔案全部丟失的恢復
- 控制檔案部分丟失的恢復
- 控制檔案丟失恢復(二)
- 控制檔案全部丟失恢復
- 探索ORACLE之RMAN_07 控制檔案丟失恢復Oracle
- RMAN恢復案例:無恢復目錄,丟失全部資料檔案、控制檔案、日誌檔案恢復
- RMAN恢復案例:丟失全部資料檔案恢復
- RMAN完全恢復丟失的資料檔案
- rman備份丟失控制檔案恢復
- 丟失全部控制檔案後從RMAN備份集中恢復示例
- 當前控制檔案全部丟失恢復
- rman恢復:資料檔案丟失,控制檔案丟失,聯機日誌檔案丟失(非當前使用與當前使用)
- RMAN恢復案例:丟失非系統資料檔案恢復
- rman恢復--歸檔模式有備份,丟失資料檔案的恢復模式
- rman恢復--歸檔模式無備份,丟失資料檔案的恢復模式
- rman 恢復---歸檔丟失and資料檔案損壞
- 全部控制檔案丟失後的完全恢復(轉)
- 【rman 備份與恢復】恢復丟失所有的控制檔案
- 模擬控制檔案丟失進行恢復。
- 恢復案例:無歸檔,掉電,控制檔案全部丟失恢復
- 恢復之丟失全部控制檔案以及備份中的控制檔案
- 恢復案例:無歸檔,丟失全部控制檔案、日誌檔案恢復案例
- 【備份恢復】 丟失一個控制檔案 之恢復操作
- RMAN恢復控制檔案
- 利用rman做資料檔案丟失的恢復實驗
- 引數檔案控制檔案和資料檔案丟失的恢復
- 【恢復】Redo日誌檔案丟失的恢復
- 資料檔案丟失的恢復
- Oracle Password檔案丟失的恢復Oracle
- 非歸檔無備份下控制檔案丟失的恢復
- RMAN基於備份控制檔案恢復失敗
- 【備份恢復】丟失所有控制檔案,利用RMAN進行恢復操作