通过海明老师的视频教程学习,针对各种类型文件丢失的恢复进行了简要小结。
一、SPFILE丢失
二、CONTROLFILE丢失
三、Redolog file丢失
四、datafile丢失
五、tablespace丢失
六、非catalog方式完全恢复
七、基于时间点的恢复
八、基于SCN的恢复
九、基于日志序列的恢复
一、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/,如需转载,请注明出处,否则将追究法律责任。
转载于:http://blog.itpub.net/10455206/viewspace-1031160/