当前位置: 首页 > 工具软件 > healthchecks > 使用案例 >

Running Health Checks Manually

白侯林
2023-12-01
Health Monitor provides two ways to run health checks manually:

By using the DBMS_HM PL/SQL package

By using the Enterprise Manager interface, found on the Checkers subpage of the Advisor Central page

Running Health Checks Using the DBMS_HM PL/SQL Package

The DBMS_HM procedure for running a health check is called RUN_CHECK. To call RUN_
CHECK, supply the name of the check and a name for the run, as follows:

BEGIN
DBMS_HM.RUN_CHECK('Dictionary Integrity Check', 'my_run');
END;
/

To obtain a list of health check names, run the following query:

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


Most health checks accept input parameters. You can view parameter names and
descriptions with the V$HM_CHECK_PARAM view. Some parameters are mandatory while
others are optional. If optional parameters are omitted, defaults are used. The
following query displays parameter information for all health checks:

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;

Input parameters are passed in the input_params argument as name/value pairs
separated by semicolons (;). The following example illustrates how to pass the
transaction ID as a parameter to the Transaction Integrity Check:

BEGIN
 DBMS_HM.RUN_CHECK (
 check_name => 'Transaction Integrity Check',
 run_name => 'my_run',
 input_params => 'TXN_ID=7.33.2');
END;
/

Viewing Reports Using DBMS_HM

You can view Health Monitor checker reports with the DBMS_HM package function GET_
RUN_REPORT. This function enables you to request HTML, XML, or text formatting. The
default format is text, as shown in the following SQL*Plus example:

SET LONG 100000
SET LONGCHUNKSIZE 1000
SET PAGESIZE 1000
SET LINESIZE 512
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:
 '/u01/app/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:
 '/u01/app/oracle/dbs/t_db1.f' is media corrupt
 Message : Object BMRTEST2 owned by SYS might be unavailable

Health Monitor Views

Instead of requesting a checker report, you can view the results of a specific checker
run by directly querying the ADR data from which reports are created. This data is
available through the views V$HM_RUN, V$HM_FINDING, and V$HM_RECOMMENDATION.

The following example queries the V$HM_RUN view to determine a history of checker
runs:

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 Ch
The next example queries the V$HM_FINDING view to obtain finding details for the
reactive data block check with RUN_ID 1061:
SELECT type, description FROM v$hm_finding WHERE run_id = 1061;
TYPE DESCRIPTION
------------- -----------------------------------------
FAILURE Block 64349 in datafile 1: '/u01/app/orac
 le/dbs/t_db1.f' is media corrupt
FAILURE Block 64351 in datafile 1: '/u01/app/orac
 le/dbs/t_db1.f' is media corrupt


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

转载于:http://blog.itpub.net/29802484/viewspace-2126685/

 类似资料:

相关阅读

相关文章

相关问答