ITPub博客

首页 > 数据库 > Oracle > Health Monitor简介

Health Monitor简介

原创 Oracle 作者:gholay 时间:2014-03-23 09:38:10 0 删除 编辑

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                  
       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                  
    1 rows fetched
   
   adrci> create report hm_run liang
    adrci> show report hm_run liang
   
   
        HM Report: liang
       
            Dictionary Integrity Check
            1
            liang
            MANUAL
            COMPLETED
            0
            0
            0
            2009-07-13 17:31:46.436329 +08:00
            2009-07-13 17:31:58.773625 +08:00
       

       
            TABLE_NAME=ALL_CORE_TABLES
            CHECK_MASK=ALL
       

       
   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

来自 “ ITPUB博客 ” ,链接:http://blog.itpub.net/29196873/viewspace-1127549/,如需转载,请注明出处,否则将追究法律责任。

上一篇: 转移表空间到ASM
请登录后发表评论 登录
全部评论

注册时间:2013-12-28

  • 博文量
    82
  • 访问量
    651512