日期:2014-05-16  浏览次数:20456 次

Oracle11G RMAN备份和恢复笔记(三)

? RMAN在各种情况下的恢复过程简述:

RMAN恢复
?口令文件丢失
??orapw file=orapwsid? password=pass entries=5
??
??? spfile丢失
??? 1. startup nomount;
??? 2. set dbid ...(407757042)
??? 3. restore spfile from autobackup;
?????? restore spfile from '备份路径.bkp';
??? 4.shutdown immediate;
??? 5.set dbid ..
??? 6.startup;
??
?controlfile丢失
??? 1.startup nomount;
??? 2.set dbid ..
??? 3.restore controlfile from autobackup;
??? 4.alter database mount;
??? 5.recover database;
??? 6.alter database open resetlogs;
?redolog file 丢失(SQL*PLUS)
??? 1.shutdown immediate;
??? 2.startup mount;
??? 3.recover database until cancel;(可选)
??? 4.alter database open resetlogs;
?
?datafile 丢失:
??1.sql 'alter database datafile 3 offline' ;
??2.restore datafile 3;
??3.recover datafile 3;
??4.sql 'alter database datafile 3 online';
?
?? tablespace 丢失:
??1.sql 'alter tablespace? users offline' ;
??? 或者sql 'alter tablespace? users offline immediate' ;
??2.restore tablespace users;
??3.recover tablespace users;
??4.sql 'alter tablespace users online';?
?
??
??
? 非catalog方式完全恢复案例:
??????? 1.startup nomount;
??2.restore controlfile from autobackup;
??3.alter database mount;
??4.restore database;
??5.recover database;(仅限于relog存在情况)
??或者
??? recover database until cancal;
??? 当redolog受损不能恢复或者没有redolog的时候,可以在pfile添加如下语句:
????*._allow_resetlogs_corruption='TRUE'
????
??7.alter database open resetlogs;
??
基于时间点的RMAN恢复
?run{
?? set until time "to_date('2011-09-05 15:00:00','yyyy-mm-dd hh24:mi:ss')";
?? restore database;
?? recover database;
?? alter database open resetlogs;
?}
?
备注:所有执行alter database open resetlogs;的不完全恢复,在恢复之后需要备份.

基于SCN号的RMAN恢复
?? 1.startup mount;
?? 2.restore database util scn 100000;
?? 3.recover database util scn 100000;
?? 4.alter database open resetlogs;
??
基于日志序列的恢复
?? 1.startup mount;
?? 2.restore database util sequence 100 thread 1;
?? 3.recover database util sequence 100 thread 1;
?? 4.alter database open resetlogs;
??
?select * from v$log;