OCP-1Z0-053-V12.02-86题

86.Your production database is running in archivelog mode and you are using recovery manager (RMAN)

with recovery catalog to perform the database backup at regular intervals. When you attempt to restart the

database instance after a regular maintenance task on Sunday, the database fails to open displaying the

message that the data file belonging to the users tablespace are corrupted.

The steps to recover the damaged data files are follows:

1. Mount the database

2. Open the database

3. Recover the data file

4. Restore the data file

5. Make the data file offline

6. Make the data file online

Which option identifies the correct sequence that you must use to recover the data files?

A. 2, 4, 3

B. 1, 4, 3, 2

C. 2, 5, 4, 3, 6

D. 5, 2, 4, 3, 6

E. 1, 5, 4, 3, 6, 2

Answer: E

答案解析:

参考:http://blog.csdn.net/rlhua/article/details/12346829


AC必错,应该数据文件毁坏,不能直接打开数据库。

BDE都可,数据库重启后,发现数据文件损坏是在mount阶段,故不需要再mount一下,如果必须要mount,只能先shutdown;

并且E在mount阶段offline数据文件有点多此一举,D最为合适。

此题答案应为D


题中:使用rman恢复目录正常备份数据库,在维护任务重新启动数据库的情况下,users表空间的文件损坏,不能打开。

通过以下实验,可以看出正确的顺序为432.

实验验证:

删除数据文件

[oracle@rtest ~]$ rm -f /u01/app/oracle/oradata/test1107/users01.dbf


sys@TEST1107> select * from scott.dept;

select * from scott.emp

                    *

ERROR at line 1:

ORA-01116: error in opening database file 4

ORA-01110: data file 4: '/u01/app/oracle/oradata/test1107/users01.dbf'

ORA-27041: unable to open file

Linux-x86_64 Error: 2: No such file or directory

Additional information: 3



sys@TEST1107> shutdown immediate;

ORA-01116: error in opening database file 4

ORA-01110: data file 4: '/u01/app/oracle/oradata/test1107/users01.dbf'

ORA-27041: unable to open file

Linux-x86_64 Error: 2: No such file or directory

Additional information: 3

sys@TEST1107> shutdown abort

ORACLE instance shut down.


重新启动时,发现报错。此时数据库为mount状态。

sys@TEST1107> startup

ORACLE instance started.


Total System Global Area 1252663296 bytes

Fixed Size                  2227944 bytes

Variable Size            1006633240 bytes

Database Buffers          234881024 bytes

Redo Buffers                8921088 bytes

Database mounted.

ORA-01157: cannot identify/lock data file 4 - see DBWR trace file

ORA-01110: data file 4: '/u01/app/oracle/oradata/test1107/users01.dbf'


直接使用rman来restore和recover,然后在使用rman或者sqlplus来打开数据库。

[oracle@rtest ~]$ rman target /


Recovery Manager: Release 11.2.0.3.0 - Production on Tue Dec 24 09:18:51 2013


Copyright (c) 1982, 2011, Oracle and/or its affiliates.  All rights reserved.


connected to target database: TEST1107 (DBID=2336818266, not open)


RMAN> restore datafile 4;


Starting restore at 24-DEC-13

using target database control file instead of recovery catalog

allocated channel: ORA_DISK_1

channel ORA_DISK_1: SID=221 device type=DISK

allocated channel: ORA_DISK_2

channel ORA_DISK_2: SID=189 device type=DISK

allocated channel: ORA_DISK_3

channel ORA_DISK_3: SID=33 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 00004 to /u01/app/oracle/oradata/test1107/users01.dbf

channel ORA_DISK_1: reading from backup piece /u01/app/oracle/fast_recovery_area/TEST1107/backupset/2013_12_24/o1_mf_nnndf_TAG20131224T090841_9cm5cf76_.bkp

channel ORA_DISK_1: piece handle=/u01/app/oracle/fast_recovery_area/TEST1107/backupset/2013_12_24/o1_mf_nnndf_TAG20131224T090841_9cm5cf76_.bkp tag=TAG20131224T090841

channel ORA_DISK_1: restored backup piece 1

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

Finished restore at 24-DEC-13


RMAN> recover datafile 4;


Starting recover at 24-DEC-13

using channel ORA_DISK_1

using channel ORA_DISK_2

using channel ORA_DISK_3


starting media recovery

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


Finished recover at 24-DEC-13




sys@TEST1107> alter database open;


Database altered.


sys@TEST1107> select * from scott.dept;


    DEPTNO DNAME          LOC

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

        10 ACCOUNTING     NEW YORK

        20 RESEARCH       DALLAS

        30 SALES          CHICAGO

        40 OPERATIONS     BOSTON




第二种情况:重启时数据文件4有问题,然后关闭数据库,mount数据库,然后使用rman来restore和recover,最后打开数据库。顺序为1432 B答案

sys@TEST1107> startup

ORACLE instance started.


Total System Global Area 1252663296 bytes

Fixed Size                  2227944 bytes

Variable Size            1006633240 bytes

Database Buffers          234881024 bytes

Redo Buffers                8921088 bytes

Database mounted.

ORA-01157: cannot identify/lock data file 4 - see DBWR trace file

ORA-01110: data file 4: '/u01/app/oracle/oradata/test1107/users01.dbf'



sys@TEST1107> shutdown immediate;

ORA-01109: database not open



Database dismounted.

ORACLE instance shut down.

sys@TEST1107> startup mount;

ORACLE instance started.


Total System Global Area 1252663296 bytes

Fixed Size                  2227944 bytes

Variable Size            1006633240 bytes

Database Buffers          234881024 bytes

Redo Buffers                8921088 bytes

Database mounted.


[oracle@rtest ~]$ rman target /


Recovery Manager: Release 11.2.0.3.0 - Production on Tue Dec 24 09:32:17 2013


Copyright (c) 1982, 2011, Oracle and/or its affiliates.  All rights reserved.


connected to target database: TEST1107 (DBID=2336818266, not open)


RMAN> restore datafile 4;


Starting restore at 24-DEC-13

using target database control file instead of recovery catalog

allocated channel: ORA_DISK_1

channel ORA_DISK_1: SID=189 device type=DISK

allocated channel: ORA_DISK_2

channel ORA_DISK_2: SID=221 device type=DISK

allocated channel: ORA_DISK_3

channel ORA_DISK_3: SID=3 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 00004 to /u01/app/oracle/oradata/test1107/users01.dbf

channel ORA_DISK_1: reading from backup piece /u01/app/oracle/fast_recovery_area/TEST1107/backupset/2013_12_24/o1_mf_nnndf_TAG20131224T090841_9cm5cf76_.bkp

channel ORA_DISK_1: piece handle=/u01/app/oracle/fast_recovery_area/TEST1107/backupset/2013_12_24/o1_mf_nnndf_TAG20131224T090841_9cm5cf76_.bkp tag=TAG20131224T090841

channel ORA_DISK_1: restored backup piece 1

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

Finished restore at 24-DEC-13


RMAN> recover datafile 4;


Starting recover at 24-DEC-13

using channel ORA_DISK_1

using channel ORA_DISK_2

using channel ORA_DISK_3


starting media recovery

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


Finished recover at 24-DEC-13


RMAN> alter database open;


database opened

 

第三种情况:重启后发现报错,先offline,再打开数据库,然后在用rman restore和recover,online数据文件。顺序为52436 D答案

sys@TEST1107> startup

ORACLE instance started.


Total System Global Area 1252663296 bytes

Fixed Size                  2227944 bytes

Variable Size            1006633240 bytes

Database Buffers          234881024 bytes

Redo Buffers                8921088 bytes

Database mounted.

ORA-01157: cannot identify/lock data file 4 - see DBWR trace file

ORA-01110: data file 4: '/u01/app/oracle/oradata/test1107/users01.dbf'



sys@TEST1107> alter database datafile 4 offline;


Database altered.


sys@TEST1107> alter database open;


Database altered.


sys@TEST1107> select * from scott.dept;

select * from scott.dept

                    *

ERROR at line 1:

ORA-00376: file 4 cannot be read at this time

ORA-01110: data file 4: '/u01/app/oracle/oradata/test1107/users01.dbf'


[oracle@rtest ~]$ rman target /


Recovery Manager: Release 11.2.0.3.0 - Production on Tue Dec 24 10:06:13 2013


Copyright (c) 1982, 2011, Oracle and/or its affiliates.  All rights reserved.


connected to target database: TEST1107 (DBID=2336818266)


RMAN> restore datafile 4;


Starting restore at 24-DEC-13

using target database control file instead of recovery catalog

allocated channel: ORA_DISK_1

channel ORA_DISK_1: SID=192 device type=DISK

allocated channel: ORA_DISK_2

channel ORA_DISK_2: SID=221 device type=DISK

allocated channel: ORA_DISK_3

channel ORA_DISK_3: SID=6 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 00004 to /u01/app/oracle/oradata/test1107/users01.dbf

channel ORA_DISK_1: reading from backup piece /u01/app/oracle/fast_recovery_area/TEST1107/backupset/2013_12_24/o1_mf_nnndf_TAG20131224T090841_9cm5cf76_.bkp

channel ORA_DISK_1: piece handle=/u01/app/oracle/fast_recovery_area/TEST1107/backupset/2013_12_24/o1_mf_nnndf_TAG20131224T090841_9cm5cf76_.bkp tag=TAG20131224T090841

channel ORA_DISK_1: restored backup piece 1

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

Finished restore at 24-DEC-13


RMAN> recover datafile 4;


Starting recover at 24-DEC-13

using channel ORA_DISK_1

using channel ORA_DISK_2

using channel ORA_DISK_3


starting media recovery


archived log for thread 1 with sequence 437 is already on disk as file /u01/rmanbak/d1/1_437_830778999.dbf

archived log for thread 1 with sequence 438 is already on disk as file /u01/rmanbak/d1/1_438_830778999.dbf

archived log for thread 1 with sequence 439 is already on disk as file /u01/rmanbak/d1/1_439_830778999.dbf

archived log file name=/u01/rmanbak/d1/1_437_830778999.dbf thread=1 sequence=437

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

Finished recover at 24-DEC-13


RMAN> sql 'alter database datafile 4 online';


sql statement: alter database datafile 4 online



sys@TEST1107> select * from scott.dept;


    DEPTNO DNAME          LOC

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

        10 ACCOUNTING     NEW YORK

        20 RESEARCH       DALLAS

        30 SALES          CHICAGO

        40 OPERATIONS     BOSTON





原文地址:https://www.cnblogs.com/hzcya1995/p/13317065.html