RMAN深入解析之--Incarnation应用(不完全恢复)(一)

2014-11-24 17:17:49 · 作者: · 浏览: 0

案例环境:


当在做Media Recover的不完全恢复时,通过resetlogs打开库,则Incarnation(数据库对应物)表示这个数据库的特定的逻辑生存期。当作为DBA可能面临这样的还原:需要使用上次执行resetlogs命令打开数据库前生成的一个备份来进行还原数据库,或者可能需要还原到执行上一个resetlogs命令之前的时间点。


RMAN深入解析之--Incarnation应用(不完全恢复)


如图所示: 数据库的还原线路图


--------------------------------------------------------------------------------


--------------------------------------------------------------------------------


案例1:(不完全恢复1)


1、table被误删除,进行不完全恢复


17:12:11 SYS@ prod>select current_scn from v$database;


CURRENT_SCN


-----------


2123790



17:12:24 SYS@ prod>conn scott/tiger


Connected.


17:12:43 SCOTT@ prod>select count(*) from emp1;


COUNT(*)


----------


28


Elapsed: 00:00:00.05


17:12:53 SCOTT@ prod>delete from emp1;


28 rows deleted.


Elapsed: 00:00:00.08


17:13:12 SCOTT@ prod>commit;


Commit complete.


Elapsed: 00:00:00.04


17:13:17 SCOTT@ prod>insert into emp1 select * from emp where empno=7788;


1 row created.


Elapsed: 00:00:00.04


17:13:28 SCOTT@ prod>update emp set empno=9999 where empno=7788;


1 row updated.


Elapsed: 00:00:00.03


17:13:43 SCOTT@ prod>commit;


Commit complete.


Elapsed: 00:00:00.04


17:13:45 SCOTT@ prod>select * from emp1;


EMPNO ENAME JOB MGR HIREDATE SAL COMM DEPTNO


---------- ---------- --------- ---------- --------- ---------- ---------- ----------


7788 SCOTT ANALYST 7566 19-APR-87 3000 20


Elapsed: 00:00:00.02



2、执行不完全恢复


RMAN> run {


2> set until scn 2123790;


3> shutdown immediate;


4> startup mount;


5> restore database;


6> recover database;


7> alter database open resetlogs;


8> sql'alter system switch logfile';


9> }


executing command: SET until clause


using target database control file instead of recovery catalog


database closed


database dismounted


Oracle instance shut down


connected to target database (not started)


Oracle instance started


database mounted


Total System Global Area 835104768 bytes


Fixed Size 2217952 bytes


Variable Size 775948320 bytes


Database Buffers 54525952 bytes


Redo Buffers 2412544 bytes


Starting restore at 15-JUL-14


allocated channel: ORA_DISK_1


channel ORA_DISK_1: SID=18 device type=DISK


channel ORA_DISK_1: starting datafile backup set restore


channel ORA_DISK_1: specifying datafile(s) to restore from backup set


channel ORA_DISK_1: restoring datafile 00001 to /u01/app/oracle/oradata/prod/system01.dbf


channel ORA_DISK_1: restoring datafile 00002 to /u01/app/oracle/oradata/prod/sysaux01.dbf


channel ORA_DISK_1: restoring datafile 00003 to /u01/app/oracle/oradata/prod/undotbs1.dbf


channel ORA_DISK_1: restoring datafile 00004 to /u01/app/oracle/oradata/prod/users01.dbf


channel ORA_DISK_1: restoring datafile 00005 to /u01/app/oracle/oradata/prod/example01.dbf


channel ORA_DISK_1: restoring datafile 00006 to /u01/app/oracle/oradata/prod/tbs1.dbf


channel ORA_DISK_1: restoring datafile 00007 to /u01/app/oracle/oradata/prod/undotbs2.dbf


channel ORA_DISK_1: restoring datafile 00008 to /u01/app/oracle/oradata/prod/perftbs01.dbf


channel ORA_DISK_1: reading from backup piece /u01/app/oracle/product/11.2.0/db_1/dbs/0lpcfu61_1_1


channel ORA_DISK_1: piece handle=/u01/app/oracle/product/11.2.0/db_1/dbs/0lpcfu61_1_1 tag=TAG20140703T171545


channel ORA_DISK_1: restored backup piece 1


channel ORA_DISK_1: restore complete, elapsed time: 00:01:16


Finished restore at 15-JUL-14


Starting recover at 15-JUL-14


using channel ORA_DISK_1


starting m