V13.02 1Z0-053 330题实验解析

在OCP考试中,1Z0-053中有一道题如下:


330.What will be the end result of this set of RMAN commands?

shutdown abort

startup mount

restore datafile 4 until time ,,09/30/2008:15:00:00;

recover datafile 4 until time ,,09/29/2008:15:00:00;

alter database open resetlogs;

A. Datafile 4 will be recovered until 9/30/2008 at 15:00 and the database will open.

B. The restore command will fail.

C. The recover command will fail.

D. The alter database open resetlogs command will fail.

E. All these commands will fail because they must be in the confines of a run block.

Answer: D

解析:

The commands will run without error until you attempt to open the database. At that time, the alter database open resetlogs command will fail. This will be because datafile 4 and the rest of the database will be inconsistent with each other and Oracle does not allow this. If you are going to restore and recover an Oracle database using point-in-time recovery, you must do so with the entire database.


正在复习的时候有些困惑,找了好多人求助,都未能解决,在考试中庆幸没碰到它,下面我将进行试验,对这道题进行验证。

分两次进行验证,此次使用10g版本,下次采用11g。


下面先搭建环境: 

13:05:22 SYS@ prod>archive log list

Database log mode              Archive Mode

Automatic archival             Enabled

Archive destination            /disk1/arch1

Oldest online log sequence     17

Next log sequence to archive   19

Current log sequence           19

 

进行一次全备份

RMAN> run {

2> shutdown immediate;                                                                                                                   

3> startup mount;                                                                                                                        

4> allocate channel c1 type disk;                                                                                                        

5> allocate channel c2 type disk;                                                                                                        

6> backup database format '/disk1/prod/%d_%s.bak';                                                                                  

7> alter database open;                                                                                                                  

8> }

 

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     272629760 bytes

 

Fixed Size                     1218944 bytes

Variable Size                 71304832 bytes

Database Buffers             197132288 bytes

Redo Buffers                   2973696 bytes

 

allocated channel: c1

channel c1: sid=157 devtype=DISK

 

allocated channel: c2

channel c2: sid=155 devtype=DISK

 

Starting backup at 09-OCT-14

channel c1: starting full datafile backupset

channel c1: specifying datafile(s) in backupset

input datafile fno=00003 name=/u01/app/oracle/oradata/prod/sysaux01.dbf

input datafile fno=00006 name=/u01/app/oracle/oradata/prod/test1.dbf

input datafile fno=00002 name=/u01/app/oracle/oradata/prod/undotbs01.dbf

input datafile fno=00005 name=/u01/app/oracle/oradata/prod/example01.dbf

channel c1: starting piece 1 at 09-OCT-14

channel c2: starting full datafile backupset

channel c2: specifying datafile(s) in backupset

input datafile fno=00001 name=/u01/app/oracle/oradata/prod/system01.dbf

input datafile fno=00007 name=/u01/app/oracle/oradata/prod/tbs1.dbf

input datafile fno=00008 name=/u01/app/oracle/oradata/prod/test3.dbf

input datafile fno=00004 name=/u01/app/oracle/oradata/prod/users01.dbf

channel c2: starting piece 1 at 09-OCT-14

channel c2: finished piece 1 at 09-OCT-14

piece handle=/disk1/prod/PROD_382.bak tag=TAG20141009T133113 comment=NONE

channel c2: backup set complete, elapsed time: 00:00:35

channel c1: finished piece 1 at 09-OCT-14

piece handle=/disk1/prod/PROD_381.bak tag=TAG20141009T133113 comment=NONE

channel c1: backup set complete, elapsed time: 00:00:51

Finished backup at 09-OCT-14

 

Starting Control File and SPFILE Autobackup at 09-OCT-14

piece handle=/disk1/recovery/PROD/autobackup/2014_10_09/o1_mf_s_860506247_b3d7go05_.bkp comment=NONE

Finished Control File and SPFILE Autobackup at 09-OCT-14

 

database opened

released channel: c1

released channel: c2

 

模拟业务进行,切几次日志,并记录一个中间时间,当做恢复的时间点。

13:32:55 SYS@ prod>alter system switch logfile;

 

System altered.

 

Elapsed: 00:00:00.07

 

根据题意进行环境模拟:

14:07:42 SYS@ prod>shutdown abort

ORACLE instance shut down.

14:07:51 SYS@ prod>startup mount

ORACLE instance started.

 

Total System Global Area  272629760 bytes

Fixed Size                  1218944 bytes

Variable Size              71304832 bytes

Database Buffers          197132288 bytes

Redo Buffers                2973696 bytes

Database mounted.

 

转储数据文件4,并指定时间。

RMAN> run{

2> set until time "to_date('2014-10-09 13:30:00','yyyy-mm-dd hh24:mi:ss')";

3> restore datafile 4 ;

4> }

 

executing command: SET until clause

using target database control file instead of recovery catalog

 

Starting restore at 09-OCT-14

allocated channel: ORA_DISK_1

channel ORA_DISK_1: sid=158 devtype=DISK

 

channel ORA_DISK_1: starting datafile backupset restore

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

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

channel ORA_DISK_1: reading from backup piece /disk1/prod/PROD_379.bak

channel ORA_DISK_1: restored backup piece 1

piece handle=/disk1/prod/PROD_379.bak tag=TAG20141009T131452

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

Finished restore at 09-OCT-14

 

恢复数据文件,并将指定时间提前到restore的时间之前。

RMAN> run{

2> set until time "to_date('2014-10-09 13:20:00','yyyy-mm-dd hh24:mi:ss')";

3> recover datafile 4 ;

4> }

 

executing command: SET until clause

 

Starting recover at 09-OCT-14

using channel ORA_DISK_1

 

starting media recovery

 

archive log thread 1 sequence 19 is already on disk as file /disk1/arch1/arch_1_19_797613178.log

archive log thread 1 sequence 20 is already on disk as file /disk1/arch1/arch_1_20_797613178.log

archive log thread 1 sequence 21 is already on disk as file /disk1/arch1/arch_1_21_797613178.log

archive log thread 1 sequence 22 is already on disk as file /disk1/arch1/arch_1_22_797613178.log

archive log thread 1 sequence 23 is already on disk as file /disk1/arch1/arch_1_23_797613178.log

……

archive log thread 1 sequence 32 is already on disk as file /disk1/arch1/arch_1_32_797613178.log

archive log thread 1 sequence 33 is already on disk as file /disk1/arch1/arch_1_33_797613178.log

archive log thread 1 sequence 34 is already on disk as file /disk1/arch1/arch_1_34_797613178.log

archive log thread 1 sequence 35 is already on disk as file /disk1/arch1/arch_1_35_797613178.log

archive log thread 1 sequence 36 is already on disk as file /disk1/arch1/arch_1_36_797613178.log

archive log thread 1 sequence 37 is already on disk as file /disk1/arch1/arch_1_37_797613178.log

archive log filename=/disk1/arch1/arch_1_19_797613178.log thread=1 sequence=19

archive log filename=/disk1/arch1/arch_1_20_797613178.log thread=1 sequence=20

archive log filename=/disk1/arch1/arch_1_21_797613178.log thread=1 sequence=21

archive log filename=/disk1/arch1/arch_1_22_797613178.log thread=1 sequence=22

archive log filename=/disk1/arch1/arch_1_23_797613178.log thread=1 sequence=23

archive log filename=/disk1/arch1/arch_1_24_797613178.log thread=1 sequence=24

archive log filename=/disk1/arch1/arch_1_25_797613178.log thread=1 sequence=25

archive log filename=/disk1/arch1/arch_1_26_797613178.log thread=1 sequence=26

archive log filename=/disk1/arch1/arch_1_27_797613178.log thread=1 sequence=27

……

archive log filename=/disk1/arch1/arch_1_76_797613178.log thread=1 sequence=76

archive log filename=/disk1/arch1/arch_1_77_797613178.log thread=1 sequence=77

archive log filename=/disk1/arch1/arch_1_78_797613178.log thread=1 sequence=78

archive log filename=/disk1/arch1/arch_1_79_797613178.log thread=1 sequence=79

archive log filename=/disk1/arch1/arch_1_80_797613178.log thread=1 sequence=80

archive log filename=/disk1/arch1/arch_1_81_797613178.log thread=1 sequence=81

archive log filename=/disk1/arch1/arch_1_82_797613178.log thread=1 sequence=82

archive log filename=/disk1/arch1/arch_1_83_797613178.log thread=1 sequence=83

archive log filename=/disk1/arch1/arch_1_84_797613178.log thread=1 sequence=84

media recovery complete, elapsed time: 00:00:02

Finished recover at 09-OCT-14

 

使用resetlogs开库:

RMAN> alter database open resetlogs;

 

RMAN-00571: ===========================================================

RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS ===============

RMAN-00571: ===========================================================

RMAN-03002: failure of alter db command at 10/09/2014 14:30:54

ORA-01139: RESETLOGS option only valid after an incomplete database recovery

 

发现报错。从recover过程中可以看到,进行了完全恢复,所以不能使用resetlogs进行开库。答案D正确。

再次进行一次实验,这次将RUN代码块中的datafile改为database,开库提示必须用open resetlogs选项,开库成功。

总结:shutdown abort后,不能针对某一个数据文件进行恢复,使用基于时间点的恢复只能用于全数据库,开库使用open resetlogs。



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

转载于:http://blog.itpub.net/29949829/viewspace-1293572/

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值