ORACLE:Health Monitor

转载之:http://space.itpub.net/9466564/viewspace-609039

1. Health Monitor简介
    Health Monitor是11g里新增加的特性,用于数据库的各层和各个组建的诊断检查。例如可以检查:文件损坏、物理逻辑块损坏、redo和undo故障、数据字典损坏等。HM可以根据检查的结果产生一个报表,并提供解决问题的建议。
   1.1 运行方式:
    1). Reactive
         Fault diagnosability infrastructure能自动响应严重的错误(critical error)。
     2). Manually
         可以通过DBMS_HM系统包或 Enterprise Manager来手工运行HM。

    1.2 运行模式
      1). DB-ONLINE
      2). DB-OFFLINE
      所有HM都能在online模式下运行,只有Redo Integrity Check 和 DB Structure Integrity Check能在offline模式下运行。
    
2. HM的类型
    见附件详细说明
    也可以通过视图来查询:
   SQL> SELECT name FROM v$hm_check WHERE internal_check='N';
     NAME
     ----------------------------------------------------------------
     DB Structure Integrity Check
     Data Block Integrity Check
     Redo Integrity Check
     Transaction Integrity Check
     Undo Segment Integrity Check
     Dictionary Integrity Check

3. 手工运行HM
   3.1 通过DBMS_HM系统包
     例如:
     BEGIN
         DBMS_HM.RUN_CHECK('Dictionary Integrity Check', 'my_run');
     END;

     该程序允许有输入参数,可以通过如下方式查找:
    SQL>SELECT c.name check_name, p.name parameter_name, p.type,p.default_value, p.description
               FROM v$hm_check_param p, v$hm_check c
               WHERE p.check_id = c.id and c.internal_check = 'N'
               ORDER BY c.name;

      带参数实例:
     BEGIN
         DBMS_HM.RUN_CHECK (
         check_name => 'Transaction Integrity Check',
         run_name => 'my_run',
         input_params => 'TXN_ID=7.33.2');
     END;
    
    3.2 通过OEM允许
          Advisor Central -》Checkers -》 Run

4. 查看HM报表
   4.1 通过DBMS_HM系统包
     实例:
   SQL>
SET LONG 100000
   SQL>SET LONGCHUNKSIZE 1000
   SQL>SET PAGESIZE 1000
   SQL>SET LINESIZE 512
   SQL>SELECT DBMS_HM.GET_RUN_REPORT('HM_RUN_1061')  FROM    DUAL;
     DBMS_HM.GET_RUN_REPORT('HM_RUN_1061')
    -----------------------------------------------------------------------
     Run Name                     : HM_RUN_1061
     Run Id                       : 1061
     Check Name                   : Data Block Integrity Check
     Mode                         : REACTIVE
     Status                       : COMPLETED
     Start Time                   : 2007-05-12 22:11:02.032292 -07:00
     End Time                     : 2007-05-12 22:11:20.835135 -07:00
     Error Encountered            : 0
     Source Incident Id           : 7418
     Number of Incidents Created  : 0
    
    Input Paramters for the Run
     BLC_DF_NUM=1
     BLC_BL_NUM=64349
    
    Run Findings And Recommendations
     Finding
     Finding Name  : Media Block Corruption
     Finding ID    : 1065
     Type          : FAILURE
     Status        : OPEN
     Priority      : HIGH
     Message       : Block 64349 in datafile 1:
                   '/ade/sfogel_emdb/oracle/dbs/t_db1.f' is media corrupt
     Message       : Object BMRTEST1 owned by SYS might be unavailable
     Finding
     Finding Name  : Media Block Corruption
     Finding ID    : 1071
     Type          : FAILURE
     Status        : OPEN
     Priority      : HIGH
     Message       : Block 64351 in datafile 1:
                   '/ade/sfogel_emdb/oracle/dbs/t_db1.f' is media corrupt
     Message       : Object BMRTEST2 owned by SYS might be unavailable

    4.2 通过ADRCI查看
    adrci> show hm_run
   
    ADR Home = /u01/app/oracle/diag/rdbms/orcl/orcl:
    *************************************************************************
   
    **********************************************************
    HM RUN RECORD 1
    **********************************************************
       RUN_ID                        1
       RUN_NAME                      liang
       CHECK_NAME                    Dictionary Integrity Check
       NAME_ID                       24
       MODE                          0
       START_TIME                    2009-07-13 17:31:46.436329 +08:00
       RESUME_TIME                   <NULL>
       END_TIME                      2009-07-13 17:31:58.773625 +08:00
       MODIFIED_TIME                 2009-07-13 17:31:58.773625 +08:00
       TIMEOUT                       0
       FLAGS                         0
       STATUS                        5
       SRC_INCIDENT_ID               0
       NUM_INCIDENTS                 0
       ERR_NUMBER                    0
       REPORT_FILE                   <NULL>
    1 rows fetched
   
   adrci> create report hm_run liang
    adrci> show report hm_run liang
    <?xml version="1.0" encoding="US-ASCII"?>
    <HM-REPORT REPORT_ID="liang">
        <TITLE>HM Report: liang</TITLE>
        <RUN_INFO>
            <CHECK_NAME>Dictionary Integrity Check</CHECK_NAME>
            <RUN_ID>1</RUN_ID>
            <RUN_NAME>liang</RUN_NAME>
            <RUN_MODE>MANUAL</RUN_MODE>
            <RUN_STATUS>COMPLETED</RUN_STATUS>
            <RUN_ERROR_NUM>0</RUN_ERROR_NUM>
            <SOURCE_INCIDENT_ID>0</SOURCE_INCIDENT_ID>
            <NUM_INCIDENTS_CREATED>0</NUM_INCIDENTS_CREATED>
            <RUN_START_TIME>2009-07-13 17:31:46.436329 +08:00</RUN_START_TIME>
            <RUN_END_TIME>2009-07-13 17:31:58.773625 +08:00</RUN_END_TIME>
        </RUN_INFO>
        <RUN_PARAMETERS>
            <RUN_PARAMETER>TABLE_NAME=ALL_CORE_TABLES</RUN_PARAMETER>
            <RUN_PARAMETER>CHECK_MASK=ALL</RUN_PARAMETER>
        </RUN_PARAMETERS>
        <RUN-FINDINGS/>
   4.3 通过OEM
          Advisor Central -》Checkers-》Runs -》View Report

5. HM视图
    除了可以创建一个checker报表外,还可以在ADR里直接查看已经产生的报表。可查看的视图有:
   
V$HM_RUN,V$HM_FINDING, andV$HM_RECOMMENDATION.
     例如:
    SQL>

SELECT run_id, name, check_name, run_mode, src_incident FROM v$hm_run;

RUN_ID NAME CHECK_NAME RUN_MODE SRC_INCIDENT
---------- ------------ ---------------------------------- -------- ------------
1 HM_RUN_1 DB Structure Integrity Check REACTIVE 0
101 HM_RUN_101 Transaction Integrity Check REACTIVE 6073
121 TXNCHK Transaction Integrity Check MANUAL 0
181 HMR_tab$ Dictionary Integrity Check MANUAL 0
.
.
.
981 Proct_ts$ Dictionary Integrity Check MANUAL 0
1041 HM_RUN_1041 DB Structure Integrity Check REACTIVE 0
1061 HM_RUN_1061 Data Block Integrity Check REACTIVE 7418


SQL> SELECT type, description FROM v$hm_finding WHERE run_id = 1061;
TYPE DESCRIPTION
------------- -----------------------------------------
FAILURE Block 64349 in datafile 1: '/ade/sfogel_e
mdb/oracle/dbs/t_db1.f' is media corrupt

FAILURE Block 64351 in datafile 1: '/ade/sfogel_e
mdb/oracle/dbs/t_db1.f' is media corrupt


 

Types of Health Checks

Types of Health Checks

Health Check Parameters Reference 01

Health Check Parameters Reference 01

Health Check Parameters Reference 02

Health Check Parameters Reference 02


评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值