1. 程式人生 > >OCP-1Z0-053-V12 02-86題

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

答案解析:

AC必錯,應該資料檔案毀壞,不能直接開啟資料庫。

BDE都可,資料庫重啟後,發現數據檔案損壞是在mount階段,故不需要再mount一下,如果必須要mount,只能先shutdown;

並且E在mount階段offline資料檔案有點多此一舉,D最為合適。

此題答案應為D

題中:使用rman恢復目錄正常備份資料庫,在維護任務重新啟動資料庫的情況下,users表空間的檔案損壞,不能開啟。

通過以下實驗,可以看出正確的順序為432.

實驗驗證:

刪除資料檔案

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

[email protected]> 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

[email protected]> 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

[email protected]> shutdown abort

ORACLE instance shut down.

重新啟動時,發現報錯。此時資料庫為mount狀態。

[email protected]> 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來開啟資料庫。

[[email protected] ~]$ 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

[email protected]> alter database open;

Database altered.

[email protected]> 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答案

[email protected]> 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'

[email protected]> shutdown immediate;

ORA-01109: database not open

Database dismounted.

ORACLE instance shut down.

[email protected]> 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.

[[email protected] ~]$ 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答案

[email protected]> 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'

[email protected]> alter database datafile 4 offline;

Database altered.

[email protected]> alter database open;

Database altered.

[email protected]> 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'

[[email protected] ~]$ 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

[email protected]> select * from scott.dept;

    DEPTNO DNAME          LOC

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

        10 ACCOUNTING     NEW YORK

        20 RESEARCH       DALLAS

        30 SALES          CHICAGO

        40 OPERATIONS     BOSTON