【Q&A with explanations】OCP 1z0-053 QUESTION1:Data Recovery Advisor




  • OCP_1z0-053_QUESTION1

    【题目示意】
    此题考查有关于Data Recovery Advisor的相关知识。
    【解析】

    •  Data Recovery Advisor是oracle 11g推出且归属于rman的一种新特性,它是Oracle 11g Database 所推出的一种故障解决工具, 具有自动化得故障检测、故障定位、提出最优解决方案、按照用户的需求执行解决方案等功能;通常应用在数据文件腐坏或者磁盘上的永久数据丢失等极端环境中;通过提供一种集中式的自动的数据恢复工具,Data Recovery Advisor大大提高了数据库的易管理和可靠性,同时可以缩减MTTR(Mean Time To Repair 平均恢复时间);
    • Data Recovery Advisor自动诊断持久性(磁盘)数据故障,提出相应的修复选项并按照你的要求运行维修业务。
      Data Recovery Advisor可以用于primary databases、logical standby databases和snapshot standby databases(参考DG的相关内容)。Data Recovery Advisor包括以下功能:
      ▪ 故障诊断
      ▪ 故障影响评估
      ▪ 生成修复建议
      ▪ 修复的可行性检查
      ▪ 自动进行修复
      ▪ 验证数据的一致性和数据库的可恢复性
      ▪ 早期腐坏监测
      ▪ 集成的数据验证和修复
      注:Data Recovery Advisor只支持单实例数据库。不支持RAC数据库
    • 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<i>  failureNumber</i>;   ···    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文件

    SYS@ENMOEDU> shutdown IMMEDIATE
    DATABASE closed.
    DATABASE dismounted.
    ORACLE instance shut down.
    SYS@ENMOEDU> !mv /u01/app/oracle/oradata/ENMOEDU/system01.dbf /u01/app/oracle/oradata/ENMOEDU/system01.dbf.bk

    3.打开数据库等待报错

    SYS@ENMOEDU> startup
    ORACLE instance started.

    Total SYSTEM Global Area 835104768 bytes
    Fixed SIZE 2232960 bytes
    Variable SIZE 624954752 bytes
    DATABASE Buffers 201326592 bytes
    Redo Buffers 6590464 bytes
    DATABASE mounted.
    ORA-01157: cannot identify/LOCK data FILE 1 - see DBWR trace FILE
    ORA-01110: data FILE 1: '/u01/app/oracle/oradata/ENMOEDU/system01.dbf'

    4.登陆rman查看报错

    [oracle@ENMOEDU ~]$ rman target /

    Recovery Manager: RELEASE 11.2.0.3.0 - Production ON Tue Sep 3 10:51:59 2013

    Copyright (c) 1982, 2011, Oracle AND/OR its affiliates. ALL rights reserved.

    connected TO target DATABASE: ENMOEDU (DBID=81283409, 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
    ---------- -------- --------- ------------------- -------
    722 CRITICAL OPEN 2013-09-03 10:40:40 SYSTEM datafile 1: '/u01/app/oracle/oradata/ENMOEDU/system01.dbf' IS missing

    5.可以进一步查看更详细的信息

    RMAN> list failure 722 detail;

    List OF DATABASE Failures
    =========================

    Failure ID Priority Status TIME Detected Summary
    ---------- -------- --------- ------------------- -------
    722 CRITICAL OPEN 2013-09-03 10:40:40 SYSTEM datafile 1: '/u01/app/oracle/oradata/ENMOEDU/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
    ---------- -------- --------- ------------------- -------
    722 CRITICAL OPEN 2013-09-03 10:40:40 SYSTEM datafile 1: '/u01/app/oracle/oradata/ENMOEDU/system01.dbf' IS missing
    Impact: DATABASE cannot be opened

    analyzing automatic repair options; this may take some TIME
    allocated channel: ORA_DISK_1
    channel ORA_DISK_1: SID=136 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/ENMOEDU/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/oracle/diag/rdbms/enmoedu/ENMOEDU/hm/reco_2426369225.hm

    7.使用repair failure preview指令预览修复情况且同时获取恢复使用的指令

    RMAN> repair failure preview;

    Strategy: The repair includes complete media recovery WITH no data loss
    Repair script: /u01/app/oracle/diag/rdbms/enmoedu/ENMOEDU/hm/reco_2426369225.hm

    contents OF repair script:
    # restore AND recover datafile
    restore datafile 1;
    recover datafile 1;
    SQL 'alter database datafile 1 online';

    8.使用repair failure恢复数据库
    中途会提示是否恢复错误,提示是否打开数据库,这里选择打开

    RMAN> repair failure;

    Strategy: The repair includes complete media recovery WITH no data loss
    Repair script: /u01/app/oracle/diag/rdbms/enmoedu/ENMOEDU/hm/reco_2426369225.hm

    contents OF repair script:
    # restore AND recover datafile
    restore datafile 1;
    recover datafile 1;
    SQL 'alter database datafile 1 online';

    DO you really want TO EXECUTE the above repair (enter YES OR NO)? yes
    executing repair script

    Starting restore AT 2013-09-03 10:55:38
    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/ENMOEDU/system01.dbf
    channel ORA_DISK_1: reading FROM backup piece /u01/app/oracle/fast_recovery_area/ENMOEDU/backupset/2013_09_03/o1_mf_nnndf_TAG20130903T103040_92blglrj_.bkp
    channel ORA_DISK_1: piece handle=/u01/app/oracle/fast_recovery_area/ENMOEDU/backupset/2013_09_03/o1_mf_nnndf_TAG20130903T103040_92blglrj_.bkp tag=TAG20130903T103040
    channel ORA_DISK_1: restored backup piece 1
    channel ORA_DISK_1: restore complete, elapsed TIME: 00:01:05
    Finished restore AT 2013-09-03 10:56:44

    Starting recover AT 2013-09-03 10:56:44
    USING channel ORA_DISK_1

    starting media recovery
    media recovery complete, elapsed TIME: 00:00:02

    Finished recover AT 2013-09-03 10:56:47

    SQL statement: ALTER DATABASE datafile 1 ONLINE
    repair failure complete

    DO you want TO OPEN the DATABASE (enter YES OR NO)? yes
    DATABASE opened

    9.数据库恢复后进行查看是否恢复成功

    [oracle@ENMOEDU admin]$ sqlplus / AS sysdba

    SQL*Plus: RELEASE 11.2.0.3.0 Production ON Tue Sep 3 11:00:18 2013

    Copyright (c) 1982, 2011, Oracle. ALL rights reserved.

    Connected TO:
    Oracle DATABASE 11g Enterprise Edition RELEASE 11.2.0.3.0 - 64bit Production
    WITH the Partitioning, Automatic Storage Management, Oracle Label Security, OLAP,
    Data Mining AND REAL Application Testing options

    SYS@ENMOEDU> SELECT name FROM v$dbfile;

    NAME
    --------------------------------------------------------------------------------
    /u01/app/oracle/oradata/ENMOEDU/system01.dbf
    /u01/app/oracle/oradata/ENMOEDU/sysaux01.dbf
    /u01/app/oracle/oradata/ENMOEDU/undotbs01.dbf
    /u01/app/oracle/oradata/ENMOEDU/users01.dbf
    /u01/app/oracle/oradata/ENMOEDU/examples01.dbf

    6 ROWS selected.

    【小结】
    Data Recovery Advisor可以诊断出可能导致数据库实例崩溃的数据文件的丢失和损坏,通常是用在数据文件故障中,选项A和D均不会导致数据库崩溃,也不属于数据文件,选项B和C是数据文件丢失或损坏导致数据库实例出现问题,因此选择B和C。

    【答案】B,C



    Speak Your Mind

    *

    京ICP备14059771号-2