Chinaunix首页 | 论坛 | 博客
  • 博客访问: 847688
  • 博文数量: 72
  • 博客积分: 0
  • 博客等级: 民兵
  • 技术积分: 435
  • 用 户 组: 普通用户
  • 注册时间: 2013-04-27 20:07
个人简介

郭一军,网名guoyJoe,尖峰在线培训创始人、Oracle OCM、ITPUB论坛Oracle认证版版主、2013最佳精华贴、Senior DBA、Oracle OCT、 ACOUG MEMBER、CSDN 认证专家、RHCE、在线技术分享的倡导者和实践者。 http://www.jianfengedu.com http://jianfengedu.taobao.com

文章分类
文章存档

2014年(72)

分类: Oracle

2014-06-19 10:37:24

转载请注明出处:http://blog.csdn.net/guoyjoe/article/details/11818529


正确答案:AD

            数据库恢复顾问(DRA)是一个诊断和修复数据库问题的工具。共有两个界面:RMAN可执行程序和Enteprise Manger。DRA能够生成脚本来修复数据文件和(在某些境下)控制文件受到的损坏:它不提供有关服务器参数文件和联机重做日志文件问题的建议。DRA依赖于自动诊断知识库(Automatic DiagnosticRepository,ADR)和Health Monitor。虽然DBA不使用HealthMonitor和DRA时会采用相同的诊断和修复方法,但Health Monitor 收集信息和DRA给出建议的过程更快捷,发生错误的概率更低。

1丶      Health Monitor 和DRA

           Health Monitor是一组检查,会在特定错误条件出现时自动运行,也可以根据DAR的指示以手功方式运行。检查结果不存储在数据库,而存储在文件系统中。其原因在于,一些错误的性质决定了数据库不再可用:因此,需要一个外部知识库来存储Health Monitor的结果。该知识库就是自动诊断知识库(AutomaticDiagnostic Repository,ADR),位于Diganostic_dest实例参数指定的目录中。

2丶      DRA的功能和局限性

    只有实例处于nomount模式或更高模式时,DRA才能奏效。如果初始化文件存在问题,它就起不到帮助作用。在nomount模式中,它可以诊断控制文件的问题,并通过使用现有的有效副本(如果不存在,就尝试从备份集(如果存在)中提取一个副本)生成用来还原的脚本。一旦数据库进入mount模式,DRA就可以诊断有关数据文件缺失或受损的问题,以及联机日志文件组丢失的问题,并生成修复脚本。

             当前版本的DRA仅支持单实例数据库。如果RAC数据库由于故障而失败,就可以在单实例模式中加模它,使用DRA修复损坏的内容,然后关闭它并在RAC模式中重新打开。此技可能无法修复在一个实例本地发生的损坏。DRA不能使用备用数据库的块和文件来修复主数据库的故障,也不能修复备用数据库的故障。

 

考点:DRA只能用于单实例数据库的环境。它不能用于RAC集群数据库,也不能用于Data Guard备用数据库。

 

3丶一个实验,使用ADR诊断问题并提出建议,将数据库引发一个问题,然后使用DRA予以报告。

 (1) 在oracle的sys用户下启动RMAN

[oracle@mydb ~]$ rman target /

Recovery Manager: Release 11.2.0.3.0 - Production on Wed Sep 18 17:08:36 2013

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

connected to target database: OCM (DBID=2206937749)

 (2) 确认存在SYSAUX表空间的全部完整备分:

RMAN> list backup of tablespace sysaux;


List of Backup Sets
===================


BS Key  Type LV Size       Device Type Elapsed Time Completion Time
------- ---- -- ---------- ----------- ------------ ---------------
17      Full    1.22G      DISK        00:00:58     18-SEP-13      
        BP Key: 17   Status: AVAILABLE  Compressed: NO  Tag: TAG20130918T171810
        Piece Name: /backup/rman/0nok63mi_1_1
  List of Datafiles in backup set 17
  File LV Type Ckp SCN    Ckp Time  Name
  ---- -- ---- ---------- --------- ----
  2       Full 3077276    18-SEP-13 /u01/app/oracle/oradata/ocm/sysaux01.dbf

      如果没有返回至少一个full类型的备份集,就创建一个:

Backup as bakcupset tablespace sysaux;

(3)关闭实例并退出rman

RMAN> shutdown immediate;

database closed
database dismounted
Oracle instance shut down

RMAN> exit


Recovery Manager complete.

(4)  使用操作系统实用程序,删除在步骤(2)中列出的sysaux表空间的数据文件。如果使用Windows就必须停止实例在其下的Windows服务,以便在执行删除前释放Windows文件块。

[oracle@mydb ~]$ rm -rf /u01/app/oracle/oradata/ocm/sysaux01.dbf

(5)   使用SQL*Plus连接到数据库,并试着启动:

idle> conn  / as sysdba
Connected to an idle instance.
idle> startup
ORACLE instance started.

Total System Global Area  839282688 bytes
Fixed Size                  2233000 bytes
Variable Size             562040152 bytes
Database Buffers          268435456 bytes
Redo Buffers                6574080 bytes
Database mounted.
ORA-01157: cannot identify/lock data file 2 - see DBWR trace file
ORA-01110: data file 2: \'/u01/app/oracle/oradata/ocm/sysaux01.dbf\'

      这将在启动到MOUNT模式,并出现有关丢失文件的错误。如果使用Windows,确保已经启动了服务。

(6)像步骤(1)那样,启动RMAN可执行程序并连接。

[oracle@mydb ~]$ rman target  /

Recovery Manager: Release 11.2.0.3.0 - Production on Wed Sep 18 17:25:43 2013

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

connected to target database: OCM (DBID=2206937749, not open)

(7)诊断问题,列出当前的所有故障:

     将返回一条消息,指出丢失一个或多个非系统数据文件时产生的影响。

RMAN> list failure;

using target database control file instead of recovery catalog
List of Database Failures
=========================

Failure ID Priority Status    Time Detected Summary
---------- -------- --------- ------------- -------
2002       HIGH     OPEN      18-SEP-13     One or more non-system datafiles are missing

(8)生成有关故障的建议:

RMAN> advise failure;

List of Database Failures
=========================

Failure ID Priority Status    Time Detected Summary
---------- -------- --------- ------------- -------
2002       HIGH     OPEN      18-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=10 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/ocm/sysaux01.dbf was unintentionally renamed or moved, restore it

Automated Repair Options
========================
Option Repair Description
------ ------------------
1      Restore and recover datafile 2  
  Strategy: The repair includes complete media recovery with no data loss
  Repair script: /u01/app/oracle/diag/rdbms/ocm/ocm/hm/reco_2271988430.hm
  

          这将建议你还原和恢复数据文件,并成修复脚本。使用任意操作系统编辑器打开脚本,并研究其内容。第一条建议,系统管理员犯下的一些错误导致了问题,问题可以手功修复。此后是一个有关还原和恢复的自动修复建议。这是RMAN脚本形式。脚本内容如下:

# restore and recover datafile
   restore datafile 2;
   recover datafile 2;

   要运行脚本,将使用以下命令:

RMAN> repair failure;

Strategy: The repair includes complete media recovery with no data loss
Repair script: /u01/app/oracle/diag/rdbms/ocm/ocm/hm/reco_2271988430.hm

contents of repair script:
   # restore and recover datafile
   restore datafile 2;
   recover datafile 2;
   sql \'alter database datafile 2 online\';

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

Starting restore at 18-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 00002 to /u01/app/oracle/oradata/ocm/sysaux01.dbf
channel ORA_DISK_1: reading from backup piece /backup/rman/0nok63mi_1_1
channel ORA_DISK_1: piece handle=/backup/rman/0nok63mi_1_1 tag=TAG20130918T171810
channel ORA_DISK_1: restored backup piece 1
channel ORA_DISK_1: restore complete, elapsed time: 00:00:25
Finished restore at 18-SEP-13

Starting recover at 18-SEP-13
using channel ORA_DISK_1

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

Finished recover at 18-SEP-13

sql statement: alter database datafile 2 online
repair failure complete

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

      然后打开数据库。

      提示:DRA可以运行,但你通常可以做得更好。例如,在执行还原和恢复前,DRA不生成通过打开数据库将停机时间最小化的脚本。

使用Database control连接到受损数据库,始终有一个名为Perform Recovery的按钮。如下图所示。Information部分显示存在一个故障,并因此加载了数据库。Advise And Recover按钮将启动一个向导,此向导列出故障的详细信息,生成修复脚本,然后将其作为作业提交给Eterprise Manager作业系统,最后提示打开数据库。



考点:

        如果不首先要求DRA列出故障,则DRA不会发生成任何建议。对于最近一次列出之后发生的任何故障或修复的任何故障,DRA不提供任何建议。


    DRA可以生成脚,以还原丢失或受损控制文件副本,重新生成丢失的联机日志文组,并还原或恢复丢失或受损的数据文件。如果多重日志文件组的成员受损,它将不会采取任何操作。

 


QQ:252803295

技术交流QQ群:
DSI&Core Search  Ⅰ 群:127149411(2000人技术群:未满)
DSI&Core Search  Ⅱ 群:177089463(1000人技术群:未满)
DSI&Core Search  Ⅲ 群:284596437(500人技术群:未满)
DSI&Core Search  Ⅳ 群:192136702(500人技术群:未满)
DSI&Core Search  Ⅴ 群:285030382(500人闲聊群:未满)


MAIL:dbathink@hotmail.com

BLOG: http://blog.csdn.net/guoyjoe

WEIBO:

ITPUB: http://www.itpub.net/space-uid-28460966.html

OCM:   


阅读(1046) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~