11gOCP精解 之 01

jhon_lee發表於2012-09-22
Normal 0 7.8 磅 0 2 false false false EN-US ZH-CN X-NONE

Identify two situations in which you can use Data Recovery Advisor for recovery. (Choose two.)

A. The user has dropped an important table that needs to be recovered.

B. The database files are corrupted when the database is open.

C. You are not able to start up the database instance because the required database files are missing.

D. The archived log files are missing for which backup is not available.

Answer: B,C

Explanation:


Normal 0 7.8 磅 0 2 false false false EN-US ZH-CN X-NONE

Data Recovery Advisororacle 11g推出且歸屬於rman的一種新特性,它是Oracle 11g Database 所推出的一種故障解決工具, 具有自動化得故障檢測、故障定位、提出最優解決方案、按照使用者的需求執行解決方案等功能;通常應用在資料檔案腐壞或者磁碟上的永久資料丟失等極端環境中;透過提供一種集中式的自動的資料恢復工具,Data Recovery Advisor大大提高了資料庫的易管理和可靠性,同時可以縮減MTTRMean Time To Repair 平均恢復時間);

 

Data Recovery Advisor具有如下優於傳統恢復技術的特點:

1.    Data Recovery Advisor可以在資料庫程式發現錯誤前進行探測、分析、修復資料等操作,同時發錯警告資訊。預警資訊可以有效的遏制由於腐壞導致的損害

2.      Data Recovery Advisor 可以自動的分析失敗資訊,同時評估其影響,並且將報告傳送給使用者。這種自動化評估方式優於手動的錯誤統計方式,省時且高效

3.      以前,使用者必須手動的透過修復可能帶來的影響來確定修復選項,當遇到多種錯誤同時發生時,使用者必須手動的確定正確恢復順序。作為對比Data Recovery Advisor 可以自動化處理以上問題,既可以做出最好的恢復選項,又可以檢測在你的計算機環境中最可行方案

4.      執行一個資料恢復可能是複雜且易出錯的過程,當我們選擇Data Recovery Advisor來執行一個自動化的恢復時可以同時驗證其是否成功

 

實驗:

模擬錯誤:將system01.dbf 重名名

實驗前提:使用oracle11g資料庫,保證資料庫已經使用rman備份

實驗內容:

1、常用指令介紹

Data Recovery Advisor 使用如下命令進行管理LIST FAILURE, ADVISE FAILURE, REPAIR FAILURE, and CHANGE FAILURE

 

list檢視failure也可以包含多種子查詢相關指令的使用方法可以檢視官方文件,例如:

RMAN> LIST FAILURE ALL;   ···   Lists failures with all priorities and status OPEN.

RMAN> LIST FAILURE CRITICAL;  ···  Lists only critical failures with status OPEN.

RMAN> LIST FAILURE HIGH;  ···  Lists only failures with HIGH priority and status OPEN.

RMAN> LIST FAILURE LOW;   ···   Lists only failures with LOW priority with status OPEN.

RMAN> LIST FAILURE CLOSED;   ···         Lists only closed failures.

RMAN> LIST FAILURE  failureNumber;   ···    Specifies the failures by failure number.

RMAN> LIST FAILURE DETAIL; ···   Lists failures by expanding the consolidated failure. For example, if multiple block corruptions existed in a file, then specifying the DETAIL option would list each of the block corruption.

 

2、關閉資料庫重新命名system01.dbf檔案

SQL> shutdown immediate;

Database closed.

Database dismounted.

ORACLE instance shut down.

SQL>!mv /u01/app/oracle/oradata/oracle11g/system01.dbf /u01/app/oracle/oradata/oracle11g/system01.dbf_bk

 

3、開啟資料庫等待報錯

SQL> startup

ORACLE instance started.

 

Total System Global Area  422670336 bytes

Fixed Size                  1336960 bytes

Variable Size             318769536 bytes

Database Buffers           96468992 bytes

Redo Buffers                6094848 bytes

Database mounted.

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

ORA-01110: data file 1: '/u01/app/oracle/oradata/oracle11g/system01.dbf'

 

4、登陸rman檢視報錯

[oracle@oel11g ~]$ rman target /

 

Recovery Manager: Release 11.2.0.1.0 - Production on Wed Sep 5 21:12:48 2012

 

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

 

connected to target database: ORACLE11 (DBID=2483499420, not open)

  使用list failure檢視錯誤資訊

RMAN> list failure;

 

using target database control file instead of recovery catalog

List of Database Failures

=========================

 

Failure ID Priority Status    Time Detected Summary

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

102        CRITICAL OPEN      05-SEP-12     System datafile 1: '/u01/app/oracle/oradata/oracle11g/system01.dbf' is missing

 

5、可以進一步檢視更詳細的資訊

RMAN> list failure 102 detail;

 

List of Database Failures

=========================

 

Failure ID Priority Status    Time Detected Summary

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

102        CRITICAL OPEN      05-SEP-12     System datafile 1: '/u01/app/oracle/oradata/oracle11g/system01.dbf' is missing

  Impact: Database cannot be opened

 

6、使用advise命令令系統給出錯誤的處理建議

RMAN> advise failure;

 

List of Database Failures

=========================

 

Failure ID Priority Status    Time Detected Summary

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

102        CRITICAL OPEN      05-SEP-12     System datafile 1: '/u01/app/oracle/oradata/oracle11g/system01.dbf' is missing

  Impact: Database cannot be opened

 

analyzing automatic repair options; this may take some time

using channel ORA_DISK_1

analyzing automatic repair options complete

 

Mandatory Manual Actions

========================

no manual actions available

 

Optional Manual Actions

=======================

1. If file /u01/app/oracle/oradata/oracle11g/system01.dbf was unintentionally renamed or moved, restore it

 

Automated Repair Options

========================

Option Repair Description

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

1      Restore and recover datafile 1

  Strategy: The repair includes complete media recovery with no data loss

  Repair script. /u01/app/diag/rdbms/oracle11g/oracle11g/hm/reco_2411470321.hm

 

7、使用repair failure preview指令預覽修復情況且同時獲取恢復使用的指令

RMAN>  repair failure preview;

 

Strategy: The repair includes complete media recovery with no data loss

Repair script. /u01/app/diag/rdbms/oracle11g/oracle11g/hm/reco_2411470321.hm

 

contents of repair script.:

   # restore and recover datafile

   restore datafile 1;

   recover datafile 1;

 

8、使用repair failure恢復資料庫

中途會提示是否恢復錯誤,提示是否開啟資料庫,這裡選擇開啟

RMAN> repair failure;

 

Strategy: The repair includes complete media recovery with no data loss

Repair script. /u01/app/diag/rdbms/oracle11g/oracle11g/hm/reco_2411470321.hm

 

contents of repair script.:

   # restore and recover datafile

   restore datafile 1;

   recover datafile 1;

 

Do you really want to execute the above repair (enter YES or NO)? Yes

Starting restore at 05-SEP-12

using channel ORA_DISK_1

 

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/oracle11g/system01.dbf

channel ORA_DISK_1: reading from backup piece /u01/app/flash_recovery_area/ORACLE11G/backupset/2012_09_05/o1_mf_nnndf_TAG20120905T204753_84hwotbd_.bkp

channel ORA_DISK_1: piece handle=/u01/app/flash_recovery_area/ORACLE11G/backupset/2012_09_05/o1_mf_nnndf_TAG20120905T204753_84hwotbd_.bkp tag=TAG20120905T204753

channel ORA_DISK_1: restored backup piece 1

channel ORA_DISK_1: restore complete, elapsed time: 00:02:28

Finished restore at 05-SEP-12

 

Starting recover at 05-SEP-12

using channel ORA_DISK_1

 

starting media recovery

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

 

Finished recover at 05-SEP-12

repair failure complete

 

Do you want to open the database (enter YES or NO)? Yes

database opened

 

9、資料庫恢復後進行檢視是否恢復成功

 

[oracle@oel11g ~]$ sqlplus / as sysdba

 

SQL*Plus: Release 11.2.0.1.0 Production on Wed Sep 5 21:28:11 2012

 

Copyright (c) 1982, 2009, Oracle.  All rights reserved.

 

Connected to:

Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - Production

With the Partitioning, OLAP, Data Mining and Real Application Testing options

SQL> select name from v$dbfile;

 

NAME

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

/u01/app/oracle/oradata/oracle11g/users01.dbf

/u01/app/oracle/oradata/oracle11g/undotbs01.dbf

/u01/app/oracle/oradata/oracle11g/sysaux01.dbf

/u01/app/oracle/oradata/oracle11g/system01.dbf

/u01/app/oracle/oradata/oracle11g/example01.dbf

 

只有答案BC是資料丟失或損壞的選項,所以選擇B,C


                                                                                                    Thanks

                                                                                                      Onepiece

                                                                                                       2012-09-22

相關文章