ITPub博客

首页 > Linux操作系统 > Linux操作系统 > RMAN选择不同的Backupset不完全恢复

RMAN选择不同的Backupset不完全恢复

原创 Linux操作系统 作者:hoqingyuexiao 时间:2008-04-07 19:12:10 0 删除 编辑

本来想尝试做个简单的不完全恢复试验,于是先做了个全备,然后switch logfile,然后建了个表插入了几条数据,然后shutdown,删掉tablespace  users,删掉几个archive log,后startup。

显然是启动不成功的,然后很随意地用rman restore, recover。结果发现无法recover了!仔细想想原来在删除archive log的时候过了,多删除了几条,把备份之前的那些都删除了...不得已,只能硬着头皮想办法...

list backup之后发现以前还做过几次全备,找到救命稻草~于是尝试用之前的备份集来恢复:

RMAN> restore database from tag='TAG20080401T141118';

Starting restore at 2008-04-07 19:06:09

using channel ORA_DISK_1
using channel ORA_DISK_2
using channel ORA_DISK_3
channel ORA_DISK_1: starting datafile backupset restore
channel ORA_DISK_1: specifying datafile(s) to restore from backup set
restoring datafile 00005 to D:\OPT\ORACLE9I\PRODUCT\9.2.0\ORADATA\ORA92\INDX01.DBF
restoring datafile 00007 to D:\OPT\ORACLE9I\PRODUCT\9.2.0\ORADATA\ORA92\USERS01.DBF
restoring datafile 00008 to D:\OPT\ORACLE9I\PRODUCT\9.2.0\ORADATA\ORA92\XDB01.DBF
channel ORA_DISK_2: starting datafile backupset restore
channel ORA_DISK_2: specifying datafile(s) to restore from backup set
restoring datafile 00003 to D:\OPT\ORACLE9I\PRODUCT\9.2.0\ORADATA\ORA92\DRSYS01.DBF
restoring datafile 00006 to D:\OPT\ORACLE9I\PRODUCT\9.2.0\ORADATA\ORA92\TOOLS01.DBF
restoring datafile 00009 to D:\OPT\ORACLE9I\PRODUCT\9.2.0\ORADATA\ORA92\UNDO02.DBF
channel ORA_DISK_3: starting datafile backupset restore
channel ORA_DISK_3: specifying datafile(s) to restore from backup set
restoring datafile 00001 to D:\OPT\ORACLE9I\PRODUCT\9.2.0\ORADATA\ORA92\SYSTEM01.DBF
channel ORA_DISK_1: restored backup piece 1
piece handle=D:\ORA_BAK\RMAN\DF_ORA92_8_1_650902278.BAK tag=TAG20080401T141118 params=NULL
channel ORA_DISK_1: restore complete
channel ORA_DISK_2: restored backup piece 1
piece handle=D:\ORA_BAK\RMAN\DF_ORA92_9_1_650902278.BAK tag=TAG20080401T141118 params=NULL
channel ORA_DISK_2: restore complete
channel ORA_DISK_3: restored backup piece 1
piece handle=D:\ORA_BAK\RMAN\DF_ORA92_10_1_650902280.BAK tag=TAG20080401T141118 params=NULL
channel ORA_DISK_3: restore complete
channel ORA_DISK_1: starting datafile backupset restore
channel ORA_DISK_1: specifying datafile(s) to restore from backup set
restoring datafile 00002 to D:\OPT\ORACLE9I\PRODUCT\9.2.0\ORADATA\ORA92\TEST01.DBF
restoring datafile 00004 to D:\OPT\ORACLE9I\PRODUCT\9.2.0\ORADATA\ORA92\EXAMPLE01.DBF
channel ORA_DISK_1: restored backup piece 1
piece handle=D:\ORA_BAK\RMAN\DF_ORA92_11_1_650902285.BAK tag=TAG20080401T141118 params=NULL
channel ORA_DISK_1: restore complete
Finished restore at 2008-04-07 19:06:50

RMAN> recover database until sequence 20 thread 1;

Starting recover at 2008-04-07 19:07:43
using channel ORA_DISK_1
using channel ORA_DISK_2
using channel ORA_DISK_3

starting media recovery

archive log thread 1 sequence 15 is already on disk as file D:\OPT\ORACLE9I\ARCHIVELOG\ARC00015.001
archive log thread 1 sequence 16 is already on disk as file D:\OPT\ORACLE9I\ARCHIVELOG\ARC00016.001
archive log thread 1 sequence 18 is already on disk as file D:\OPT\ORACLE9I\ARCHIVELOG\ARC00018.001
Oracle Error:
ORA-01547: warning: RECOVER succeeded but OPEN RESETLOGS would get error below
ORA-01152: file 1 was not restored from a sufficiently old backup
ORA-01110: data file 1: 'D:\OPT\ORACLE9I\PRODUCT\9.2.0\ORADATA\ORA92\SYSTEM01.DBF'

RMAN-00571: ===========================================================
RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS ===============
RMAN-00571: ===========================================================
RMAN-03002: failure of recover command at 04/07/2008 19:07:45
RMAN-06053: unable to perform. media recovery because of missing log
RMAN-06025: no backup of log thread 1 seq 19 scn 1990923 found to restore
RMAN-06025: no backup of log thread 1 seq 17 scn 1957598 found to restore

RMAN> recover database until sequence 17 thread 1;

Starting recover at 2008-04-07 19:08:50
using channel ORA_DISK_1
using channel ORA_DISK_2
using channel ORA_DISK_3

starting media recovery

archive log thread 1 sequence 15 is already on disk as file D:\OPT\ORACLE9I\ARCHIVELOG\ARC00015.001
archive log thread 1 sequence 16 is already on disk as file D:\OPT\ORACLE9I\ARCHIVELOG\ARC00016.001
archive log filename=D:\OPT\ORACLE9I\ARCHIVELOG\ARC00015.001 thread=1 sequence=15
archive log filename=D:\OPT\ORACLE9I\ARCHIVELOG\ARC00016.001 thread=1 sequence=16
media recovery complete
Finished recover at 2008-04-07 19:08:52

RMAN> alter database open resetlogs;

database opened

RMAN>

RMAN>

RMAN> report schema;

Report of database schema
File K-bytes    Tablespace           RB segs Datafile Name
---- ---------- -------------------- ------- -------------------
1        337920 SYSTEM               ***     D:\OPT\ORACLE9I\PRODUCT\9.2.0\ORADATA\ORA92\SYSTEM01.DBF
2         10240 TEST                 ***     D:\OPT\ORACLE9I\PRODUCT\9.2.0\ORADATA\ORA92\TEST01.DBF
3         20480 DRSYS                ***     D:\OPT\ORACLE9I\PRODUCT\9.2.0\ORADATA\ORA92\DRSYS01.DBF
4        282240 EXAMPLE              ***     D:\OPT\ORACLE9I\PRODUCT\9.2.0\ORADATA\ORA92\EXAMPLE01.DBF
5         25600 INDX                 ***     D:\OPT\ORACLE9I\PRODUCT\9.2.0\ORADATA\ORA92\INDX01.DBF
6        102400 TOOLS                ***     D:\OPT\ORACLE9I\PRODUCT\9.2.0\ORADATA\ORA92\TOOLS01.DBF
7         25600 USERS                ***     D:\OPT\ORACLE9I\PRODUCT\9.2.0\ORADATA\ORA92\USERS01.DBF
8         39040 XDB                  ***     D:\OPT\ORACLE9I\PRODUCT\9.2.0\ORADATA\ORA92\XDB01.DBF
9         15360 UNDO2                ***     D:\OPT\ORACLE9I\PRODUCT\9.2.0\ORADATA\ORA92\UNDO02.DBF

经过测试可以正常使用,只是丢失了部分数据。警示:以后不管是实验还是其他,一定要小心在小心啊:)

来自 “ ITPUB博客 ” ,链接:http://blog.itpub.net/9765498/viewspace-231088/,如需转载,请注明出处,否则将追究法律责任。

请登录后发表评论 登录
全部评论

注册时间:2008-02-25

  • 博文量
    36
  • 访问量
    105948