总结:
1. 创建和删除度量都是使用DBMS_SERVER_ALERT.SET_THRESHOLD
2. 度量信息记录在dba_thresholds视图中
3. 度量值超过阀值时的预警信息记录在dba_outstanding_alerts视图中
4. 度量值超过阀值时多久后会记录在dba_outstanding_alerts,主要是看observation_period和consecutive_occurrences。(例如, 如果每 5 分钟收集一次度量值, 而“发生次数”设置为 6, 则在触发预警之前, 度量值 (连续收集的) 必须保持高于阈值状态 30 分钟。)
5. dba_outstanding_alerts中记录多久会消失,只有度量值降低到阀值以下后,再需要经历observation_period长度的时间后就会消失(observation_period其实就是系统产生一个job多长时间去扫描一次度量值)
6. 怎么定时按observation_period频率去获取度量信息,应该是一个系统自动生成的scheduler来实现的
7. dba_outstanding_alerts视图中产生新的信息后并不会出现在alert文件中,当然删除旧信息后也不会出现在alert文件中
8. 当然实际中这个功能基本很少使用,主要是因为不清楚当度量值达到报警阀值时是如何触发相关报警时的动作(不知是用什么包来操作的),只能通过OEM来配置触发报警时调用一些OS等命令
EM\可用性\相关链接\度量和策略设置\度量阀值
EM \主目录\预警
最主要的三个对象dbms_server_alert.set_threshold、dba_thresholds、dba_outstanding_alerts
其他一些对象基本没有用:dba_alert_history、DBA_HIST_SYSMETRIC_HISTORY、DBA_HIST_METRIC_NAME、V$METRIC_HISTORY
DBMS_SERVER_ALERT.SET_THRESHOLD(
metrics_id IN BINARY_INTEGER,
warning_operator IN BINARY_INTEGER,
warning_value IN VARCHAR2,
critical_operator IN BINARY_INTEGER,
critical_value IN VARCHAR2,
observation_period IN BINARY_INTEGER,
consecutive_occurrences IN BINARY_INTEGER,
instance_name IN VARCHAR2,
object_type IN BINARY_INTEGER,
object_name IN VARCHAR2);
observation_period
The period at which the metric values are computed and verified against the threshold setting. The valid range is 1 to 60 minutes.
consecutive_occurrences
The number of observation periods the metric value should violate the threshold value before the alert is issued.
consecutive_occurrences即“发生次数”:决定了在触发预警之前收集的度量值必须保持高于阈值状态的时段。例如, 如果每 5 分钟收集一次度量值, 而“发生次数”设置为 6, 则在触发预警之前, 度量值 (连续收集的) 必须保持高于阈值状态 30 分钟。
instance_name
The name of the instance for which the threshold is set. This is NULL for database-wide alerts.
例子
对表空间TEST6创建一个度量,超过30%警告,超过50%严重,每1分钟收集一次,只连续收集一次发现达到阀值就够了
BEGIN
dbms_server_alert.set_threshold
(dbms_server_alert.tablespace_pct_full,
dbms_server_alert.operator_ge, 30,
dbms_server_alert.operator_ge, 50,
1,
1,
NULL,
dbms_server_alert.object_type_tablespace, 'TEST6');
END;
之后在dba_thresholds视图中会出现OBJECT_NAME='TEST6'的信息
再开始不停往T101表空间对应的数据文件中插入数据,当达到阀值后,dba_outstanding_alerts视图中即会出现OBJECT_NAME='TEST6'的信息
删除度量,只需要要将warning_operator ,warning_value,critical_operator,critical_value 四个参数值置为NULL即可
BEGIN
dbms_server_alert.set_threshold
(dbms_server_alert.tablespace_pct_full,
null, null,
null, null,
1,
1,
NULL,
dbms_server_alert.object_type_tablespace, 'TEST6');
END;
来自 “ ITPUB博客 ” ,链接:http://blog.itpub.net/30126024/viewspace-1976639/,如需转载,请注明出处,否则将追究法律责任。
转载于:http://blog.itpub.net/30126024/viewspace-1976639/