RMAN學習小結1:不完全恢復

franklynzhou發表於2010-02-06

透過海明老師的影片教程學習,針對各種型別檔案丟失的恢復進行了簡要小結。

一、SPFILE丟失

二、CONTROLFILE丟失
三、Redolog file丟失

四、datafile丟失

五、tablespace丟失
六、非catalog方式完全恢復
七、基於時間點的恢復

八、基於SCN的恢復
九、基於日誌序列的恢復

[@more@]

一、SPFILE丟失

RMAN> Startup nomount;
RMAN> set dbid nnn;
RMAN> restore spfile from autobackup; --可能會失敗,找不到autobackup備份集,指定檔案即可。
RMAN> shutdown immediate;
RMAN> set dbid nnn;
RMAN> startup;


二、CONTROLFILE丟失

RMAN> Startup nomount;
RMAN> restore controlfile from autobackup;
RMAN> alter database mount;
RMAN> alter database open resetlogs;

RMAN-00571: ===========================================================
RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS ===============
RMAN-00571: ===========================================================
RMAN-03002: failure of alter db command at 02/06/2010 15:57:51
ORA-01194: file 1 needs more recovery to be consistent
ORA-01110: data file 1: '/home/oracle/oracle/product/10.2.0/oradata/orcl/system01.dbf'

RMAN> recover database;

Starting recover at 06-FEB-10
using channel ORA_DISK_1

starting media recovery

archive log thread 1 sequence 1 is already on disk as file

/home/oracle/oracle/product/10.2.0/db_1/flash_recovery_area/ORCL/archivelog/2010_02_06/o1_mf_1_1_5pt5736c_

.arc
archive log thread 1 sequence 2 is already on disk as file

/home/oracle/oracle/product/10.2.0/oradata/orcl/redo01.log
archive log

filename=/home/oracle/oracle/product/10.2.0/db_1/flash_recovery_area/ORCL/archivelog/2010_02_06/o1_mf_1_1_

5pt5736c_.arc thread=1 sequence=1
archive log filename=/home/oracle/oracle/product/10.2.0/oradata/orcl/redo01.log thread=1 sequence=2
media recovery complete, elapsed time: 00:00:04
Finished recover at 06-FEB-10

RMAN> alter database open;

RMAN-00571: ===========================================================
RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS ===============
RMAN-00571: ===========================================================
RMAN-03002: failure of alter db command at 02/06/2010 15:58:24
ORA-01589: must use RESETLOGS or NORESETLOGS option for database open

RMAN> alter database open resetlogs;

database opened


三、Redolog file丟失

SQL> shutdown immediate
ORACLE instance shut down.
SQL> startup mount;
ORACLE instance started.

Total System Global Area 285212672 bytes
Fixed Size 1218992 bytes
Variable Size 109053520 bytes
Database Buffers 171966464 bytes
Redo Buffers 2973696 bytes
Database mounted.
SQL> recover database until cancel;
Media recovery complete.
SQL> alter database open resetlogs;

Database altered.

SQL>

四、datafile丟失

RMAN> sql "alter datafile 4 offline";
RMAN> restore datafile 4;
RMAN> recover datafile 4;
RMAN> sql "alter datafile 4 online";
RMAN>

五、tablespace丟失

RMAN> sql "alter tablespace users offline";
RMAN> restore tablespace users;
RMAN> recover tablespace users;
RMAN> sql "alter tablespace users online";
RMAN>

六、非catalog方式完全恢復

RMAN> startup nomount;
RMAN> restore controlfile from autobackup;
RMAN> alter database mount;
RMAN> restore database;
RMAN> recover database;
RMAN> alter database open resetlogs;
RMAN>


七、基於時間點的恢復

RMAN> startup mount;
RMAN> run{
RMAN> set until time "to_date('2010-02-06 13:00:00','yyyy-mm-dd hh24:mi:ss')";
RMAN> restore database;
RMAN> recover database;
RMAN> alter database open resetlogs;
RMAN> }
RMAN>

八、基於SCN的恢復

RMAN> startup mount;
RMAN> restore database until SCN 1000;
RMAN> recover database until SCN 1000;
RMAN> alter database open resetlogs;
RMAN>
也可以用方法七的語法


九、基於日誌序列的恢復

RMAN> startup mount;
RMAN> restore database until sequence 100 thread 1;
RMAN> recover database until sequence 100 thread 1;
RMAN> alter database open resetlogs;
RMAN>

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

相關文章