ORACLE ADR 不能直接執行repair failure,需要先執行advice failure,生成修復腳本



正確答案:D

 

一、模擬上題的錯誤:

1、刪除4號文件

[html] view plain copy
  1. [oracle@mydb ~]$ cd /u01/app/oracle/oradata/ocm/  
  2. [oracle@mydb ocm]$ rm -rf users01.dbf  

2、數據庫宕機

[html] view plain copy
  1. sys@OCM> shutdown abort;  
  2. ORACLE instance shut down.  

3、啓動數據庫報錯,與上題報錯一樣

[html] view plain copy
  1. sys@OCM> startup  
  2. ORACLE instance started.  
  3.   
  4. Total System Global Area  839282688 bytes  
  5. Fixed Size                  2233000 bytes  
  6. Variable Size             583011672 bytes  
  7. Database Buffers          247463936 bytes  
  8. Redo Buffers                6574080 bytes  
  9. Database mounted.  
  10. ORA-01157: cannot identify/lock data file 4 - see DBWR trace file  
  11. ORA-01110: data file 4: '/u01/app/oracle/oradata/ocm/users01.dbf'  

4、如果試圖在沒有執行advise failure命令時使用repair failure命令,將出現如下錯誤:

[html] view plain copy
  1. [oracle@mydb ~]$ rman target /  
  2. RMAN> repair failure;  
  3.   
  4. using target database control file instead of recovery catalog  
  5. RMAN-00571: ===========================================================  
  6. RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS ===============  
  7. RMAN-00571: ===========================================================  
  8. RMAN-03002: failure of repair command at 09/01/2013 23:15:16  
  9. RMAN-06954: REPAIR command must be preceded by ADVISE command in same session  

   主要原因是:在運行repairfailure之前,要先運行advise failure,讓rman列出錯誤,並且生成修復腳本,之後運行repair failure修復錯誤。

一、正確的恢復的過程如下:

1、      啓動RMAN客戶機,並使用前一節介紹的數據庫修復命令來解決丟失數據問題,我們從list failure命令開始:

[html] view plain copy
  1. RMAN> list failure;  
  2.   
  3. List of Database Failures  
  4. =========================  
  5.   
  6. Failure ID Priority Status    Time Detected Summary  
  7. ---------- -------- --------- ------------- -------  
  8. 2002       HIGH     OPEN      01-SEP-13     One or more non-system datafiles are missing  


2、advisefailure命令對記錄在自動診斷信息庫中的所有故障給出建議。默認時,此命令只列出具有critical或high優先級的那些故障。除了產生所有輸入故障的摘要外,此命令還對每個故障提供一個建議修復選項。通常,advise failure命令同時給出自動和手動修復選項。在advisefailure命令輸出結束時,RMAN生成一個腳本,列出建議的修復選項的細節。如果你想自己進行修復,可以直接使用這個腳本,或者對它進行修改。

  

[html] view plain copy
  1. RMAN> advise failure;  
  2.   
  3. List of Database Failures  
  4. =========================  
  5.   
  6. Failure ID Priority Status    Time Detected Summary  
  7. ---------- -------- --------- ------------- -------  
  8. 2002       HIGH     OPEN      01-SEP-13     One or more non-system datafiles are missing  
  9.   
  10. analyzing automatic repair options; this may take some time  
  11. allocated channel: ORA_DISK_1  
  12. channel ORA_DISK_1: SID=10 device type=DISK  
  13. analyzing automatic repair options complete  
  14.   
  15. Mandatory Manual Actions  
  16. ========================  
  17. no manual actions available  
  18.   
  19. Optional Manual Actions  
  20. =======================  
  21. 1. If file /u01/app/oracle/oradata/ocm/users01.dbf was unintentionally renamed or moved, restore it  
  22.   
  23. Automated Repair Options  
  24. ========================  
  25. Option Repair Description  
  26. ------ ------------------  
  27. 1      Restore and recover datafile 4    
  28.   Strategy: The repair includes complete media recovery with no data loss  
  29.   Repair script: /u01/app/oracle/diag/rdbms/ocm/ocm/hm/reco_3275375759.hm  

3、利用advise failure命令提供的建議,epair  failure根據建議修復錯誤。

[html] view plain copy
  1. RMAN> repair failure;  
  2.   
  3. Strategy: The repair includes complete media recovery with no data loss  
  4. Repair script: /u01/app/oracle/diag/rdbms/ocm/ocm/hm/reco_3275375759.hm  
  5.   
  6. contents of repair script:  
  7.    # restore and recover datafile  
  8.    restore datafile 4;  
  9.    recover datafile 4;  
  10.    sql 'alter database datafile 4 online';  
  11.   
  12. Do you really want to execute the above repair (enter YES or NO)? Y  
  13. executing repair script  
  14.   
  15. Starting restore at 01-SEP-13  
  16. using channel ORA_DISK_1  
  17.   
  18. channel ORA_DISK_1: starting datafile backup set restore  
  19. channel ORA_DISK_1: specifying datafile(s) to restore from backup set  
  20. channel ORA_DISK_1: restoring datafile 00004 to /u01/app/oracle/oradata/ocm/users01.dbf  
  21. channel ORA_DISK_1: reading from backup piece /u01/app/oracle/product/11.2.0/dbs/0uoiptgq_1_1  
  22. channel ORA_DISK_1: piece handle=/u01/app/oracle/product/11.2.0/dbs/0uoiptgq_1_1 tag=TAG20130901T230250  
  23. channel ORA_DISK_1: restored backup piece 1  
  24. channel ORA_DISK_1: restore complete, elapsed time: 00:00:03  
  25. Finished restore at 01-SEP-13  
  26.   
  27. Starting recover at 01-SEP-13  
  28. using channel ORA_DISK_1  
  29.   
  30. starting media recovery  
  31. media recovery complete, elapsed time: 00:00:01  
  32.   
  33. Finished recover at 01-SEP-13  
  34.   
  35. sql statement: alter database datafile 4 online  
  36. repair failure complete  
  37.   
  38. Do you want to open the database (enter YES or NO)? Y  
  39. database opened  
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章