zoukankan      html  css  js  c++  java
  • OCP-1Z0-052-V8.02-91题

    91. View the Exhibit to examine the error that occurred during the database startup.

    You opened an RMAN session for the database. To repair the failure, you executed the following
    command as the first RMAN command:
    RMAN>REPAIR FAILURE;
    Which statement describes the consequence of this command?
    A.The command performs the recovery and closes the failure.
    B.The command only displays the advice and the RMAN script required for recovery.
    C.The command executes the RMAN script to repair the failure and remove the entry from the Automatic
    Diagnostic Repository (ADR).
    D.The command produces an error because the ADVISE FAILURE command was not executed before
    the REPAIR FAILURE command.

    答案解析:

    1、首先来看下各个文件的位置。

     

    sys@TEST0910> select FILE_ID,FILE_NAME,TABLESPACE_NAME from dba_data_files;
     
       FILE_ID FILE_NAME                                          TABLESPACE_NAME
    ---------- -------------------------------------------------- ------------------------------
             4 /u01/app/oracle/oradata/test0910/users01.dbf       USERS
             3 /u01/app/oracle/oradata/test0910/undotbs01.dbf     UNDOTBS1
             2 /u01/app/oracle/oradata/test0910/sysaux01.dbf      SYSAUX
             1 /u01/app/oracle/oradata/test0910/system01.dbf      SYSTEM
             5 /u01/app/oracle/oradata/test0910/example01.dbf     EXAMPLE

    2、先用rman备份users表空间,用作恢复。

    RMAN> backup tablespace users;
     
    Starting backup at 13-SEP-13
    using target database control file instead of recovery catalog
    allocated channel: ORA_DISK_1
    channel ORA_DISK_1: SID=67 device type=DISK
    channel ORA_DISK_1: starting full datafile backup set
    channel ORA_DISK_1: specifying datafile(s) in backup set
    input datafile file number=00004 name=/u01/app/oracle/oradata/test0910/users01.dbf
    channel ORA_DISK_1: starting piece 1 at 13-SEP-13
    channel ORA_DISK_1: finished piece 1 at 13-SEP-13
    piece handle=/u01/app/oracle/fast_recovery_area/TEST0910/backupset/2013_09_13/o1_mf_nnndf_TAG20130913T111426_936byprm_.bkp tag=TAG20130913T111426 comment=NONE
    channel ORA_DISK_1: backup set complete, elapsed time: 00:00:15
    Finished backup at 13-SEP-13

    3、操作系统删除users.dbf文件

    [oracle@rtest ~]$ rm -rf /u01/app/oracle/oradata/test0910/users01.dbf
    [oracle@rtest ~]$ ls /u01/app/oracle/oradata/test0910/users01.dbf
    ls: /u01/app/oracle/oradata/test0910/users01.dbf: No such file or directory
     
     
    4、shutdown abort模拟数据库宕机并startup,发现错误与题目一样
    sys@TEST0910> shutdown abort;
    ORACLE instance shut down.
    sys@TEST0910> startup
    ORACLE instance started.
     
    Total System Global Area 2505338880 bytes
    Fixed Size                  2230952 bytes
    Variable Size             553649496 bytes
    Database Buffers         1929379840 bytes
    Redo Buffers               20078592 bytes
    Database mounted.
    ORA-01157: cannot identify/lock data file 4 - see DBWR trace file
    ORA-01110: data file 4: '/u01/app/oracle/oradata/test0910/users01.dbf'
     
     
    5、进入rman,修复失败。
    RMAN> repair failure ;
     
    using target database control file instead of recovery catalog
    RMAN-00571: ===========================================================
    RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS ===============
    RMAN-00571: ===========================================================
    RMAN-03002: failure of repair command at 09/13/2013 11:20:04
    RMAN-06954: REPAIR command must be preceded by ADVISE command in same session
     

    在试图没有进行advise failure命令时使用repair failure,则报错。

    主要原因为:在repair failure之前,要先运行advise failure,让rman给出修复的建议,并给出修复的脚本,之后再运行repair failure

    6、按照提示,进行advise命令。

    RMAN> advise failure;
     
    RMAN-00571: ===========================================================
    RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS ===============
    RMAN-00571: ===========================================================
    RMAN-03002: failure of advise command at 09/13/2013 11:20:59
    RMAN-07211: failure option not specified
     
    为什么也报错呢?原因为在advise failure之前,要先运行list failure,列出所要修复的错误,所以先list failure。
     
    7、运行LIST-->ADVISE-->REPAIR 命令
     
    RMAN> list failure;
     
    List of Database Failures
    =========================
     
    Failure ID Priority Status    Time Detected Summary
    ---------- -------- --------- ------------- -------
    122        HIGH     OPEN      13-SEP-13     One or more non-system datafiles are missing
     
     
     
    RMAN> advise failure;
     
    List of Database Failures
    =========================
     
    Failure ID Priority Status    Time Detected Summary
    ---------- -------- --------- ------------- -------
    122        HIGH     OPEN      13-SEP-13     One or more non-system datafiles are missing
     
    analyzing automatic repair options; this may take some time
    allocated channel: ORA_DISK_1
    channel ORA_DISK_1: SID=189 device type=DISK
    analyzing automatic repair options complete
     
    Mandatory Manual Actions
    ========================
    no manual actions available
     
    Optional Manual Actions
    =======================
    1. If file /u01/app/oracle/oradata/test0910/users01.dbf was unintentionally renamed or moved, restore it
     
    Automated Repair Options
    ========================
    Option Repair Description
    ------ ------------------
    1      Restore and recover datafile 4 
      Strategy: The repair includes complete media recovery with no data loss
      Repair script: /u01/app/oracle/diag/rdbms/test0910/test0910/hm/reco_3910127882.hm
     

    advise failure命令对记录在自动诊断信息库中的所有故障给出建议。默认时,此命令只列出具有critical或high优先级的那些故障。除了产生所有输入故障的摘要外,此命令还对每个故障提供一个建议修复选项。通常,advise  failure命令同时给出自动和手动修复选项。在advisefailure命令输出结束时,RMAN生成一个脚本,列出建议的修复选项的细节。如果你想自己进行修复,可以直接使用这个脚本,或者对它进行修改。

     
    RMAN> repair failure;
     
    Strategy: The repair includes complete media recovery with no data loss
    Repair script: /u01/app/oracle/diag/rdbms/test0910/test0910/hm/reco_3910127882.hm
     
    contents of repair script:
       # restore and recover datafile
       restore datafile 4;
       recover datafile 4;
       sql 'alter database datafile 4 online';
     
    Do you really want to execute the above repair (enter YES or NO)? Y
    executing repair script
     
    Starting restore at 13-SEP-13
    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 00004 to /u01/app/oracle/oradata/test0910/users01.dbf
    channel ORA_DISK_1: reading from backup piece /u01/app/oracle/fast_recovery_area/TEST0910/backupset/2013_09_13/o1_mf_nnndf_TAG20130913T111426_936byprm_.bkp
    channel ORA_DISK_1: piece handle=/u01/app/oracle/fast_recovery_area/TEST0910/backupset/2013_09_13/o1_mf_nnndf_TAG20130913T111426_936byprm_.bkp tag=TAG20130913T111426
    channel ORA_DISK_1: restored backup piece 1
    channel ORA_DISK_1: restore complete, elapsed time: 00:00:15
    Finished restore at 13-SEP-13
     
    Starting recover at 13-SEP-13
    using channel ORA_DISK_1
     
    starting media recovery
    media recovery complete, elapsed time: 00:00:09
     
    Finished recover at 13-SEP-13
     
    sql statement: alter database datafile 4 online
    repair failure complete
     
    Do you want to open the database (enter YES or NO)? YES
    database opened
     
     
    利用advise failure 命令提供的建议,repaire failure根据建议恢复错误。
  • 相关阅读:
    C# 规格说明书
    C#学习笔记----复习笔记
    C#学习笔记-stream,win8.1开发小记
    C#学习笔记-Win8.1 store app winform开发小记
    C#学习笔记:linq和xml
    C#第六周--关于正则表达式应用,delegates关键字
    C#第六课---struct,interface
    C#第五课--继承和多态
    开发了一款小程序
    「CSS Warning 2」icon 的做法
  • 原文地址:https://www.cnblogs.com/hzcya1995/p/13317267.html
Copyright © 2011-2022 走看看