Oracle基于cancel的不完全恢复(2)

Total System Global Area  841162752 bytes
Fixed Size                  1339768 bytes
Variable Size            532680328 bytes
Database Buffers          301989888 bytes
Redo Buffers                5152768 bytes
Database mounted.
SYS@ORA11GR2>


5)RMAN还原数据库
RMAN> restore database;

Starting restore at 20-MAR-13
using target database control file instead of recovery catalog
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/ORA11GR2/system01.dbf
channel ORA_DISK_1: restoring datafile 00002 to /u01/app/oracle/oradata/ORA11GR2/sysaux01.dbf
channel ORA_DISK_1: restoring datafile 00003 to /u01/app/oracle/oradata/ORA11GR2/undotbs01.dbf
channel ORA_DISK_1: restoring datafile 00004 to /u01/app/oracle/oradata/ORA11GR2/users01.dbf
channel ORA_DISK_1: restoring datafile 00005 to /u01/app/oracle/oradata/ORA11GR2/example01.dbf
channel ORA_DISK_1: reading from backup piece /u01/app/FRA/ORA11GR2/backupset/2013_03_20/o1_mf_nnndf_TAG20130320T151949_8nlrrrfm_.bkp
channel ORA_DISK_1: piece handle=/u01/app/FRA/ORA11GR2/backupset/2013_03_20/o1_mf_nnndf_TAG20130320T151949_8nlrrrfm_.bkp tag=TAG20130320T151949
channel ORA_DISK_1: restored backup piece 1
channel ORA_DISK_1: restore complete, elapsed time: 00:03:26
Finished restore at 20-MAR-13

RMAN>


6)基于cancel恢复
SYS@ORA11GR2>recover database until cancel;
  --在sqlplus中完成

ORA-00279: change 883460 generated at 03/20/2013 15:19:50 needed for thread 1
ORA-00289: suggestion :
/u01/app/FRA/ORA11GR2/archivelog/2013_03_20/o1_mf_1_8_8nlrzy8w_.arc
ORA-00280: change 883460 for thread 1 is in sequence #8


Specify log: {<RET>=suggested | filename | AUTO | CANCEL}

--应用sequence #8为8,名字为o1_mf_1_8_8nlrzy8w_.arc的归档日志文件,直接按回车键

ORA-00279: change 884069 generated at 03/20/2013 15:23:42 needed for thread 1
ORA-00289: suggestion :
/u01/app/FRA/ORA11GR2/archivelog/2013_03_20/o1_mf_1_9_8nls091w_.arc
ORA-00280: change 884069 for thread 1 is in sequence #9
ORA-00278: log file
'/u01/app/FRA/ORA11GR2/archivelog/2013_03_20/o1_mf_1_8_8nlrzy8w_.arc' no longer
needed for this recovery


Specify log: {<RET>=suggested | filename | AUTO | CANCEL}

--应用sequence #9为9的这个归档日志文件,直接按回车键

ORA-00279: change 884101 generated at 03/20/2013 15:23:53 needed for thread 1
ORA-00289: suggestion :
/u01/app/FRA/ORA11GR2/archivelog/2013_03_20/o1_mf_1_10_8nls0os6_.arc
ORA-00280: change 884101 for thread 1 is in sequence #10
ORA-00278: log file
'/u01/app/FRA/ORA11GR2/archivelog/2013_03_20/o1_mf_1_9_8nls091w_.arc' no longer
needed for this recovery


Specify log: {<RET>=suggested | filename | AUTO | CANCEL}
cancel
  --手动输入cancel结束恢复,不管后面有没有可恢复文件,都会结束;
Media recovery cancelled.
SYS@ORA11GR2>
SYS@ORA11GR2>alter database open resetlogs;

Database altered.

SYS@ORA11GR2>


7)检查
SYS@ORA11GR2>select table_name,tablespace_name from dba_tables where owner='SCOTT' AND table_name LIKE 'T_';

TABLE_NAME                  TABLESPACE_NAME
------------------------- ------------------------------
T2                            USERS
T1                            USERS

SYS@ORA11GR2>
注 应用了两个归档日志,第三个归档日志cancel了,从结果中也可以看到,恢复以后的数据库中,只
 存在T1,T2两张表,它们俩的重做日志就在前两个归档中,T3表的所有重做条目都在第三个归档中,
 由于采取了cancel,所以,T3表并未恢复

还有一篇供参考

内容版权声明:除非注明,否则皆为本站原创文章。

转载注明出处:https://www.heiqu.com/01f60bd732727e96b5d37b51ee39afcb.html