alerts

了解数据库的日常操作,有助于我们提前发现可能会发生的问题
1.Server-Generated Alerts
Alerts are automatically generated when a problem occurs or when data does not
match expected values for metrics, such as the following:
■ Physical Reads Per Second
■ User Commits Per Second
■ SQL Service Response Time



You can view and change threshold settings for the server alert metrics using the SET_THRESHOLD<wbr> and GET_THRESHOLD<wbr> procedures of the DBMS_SERVER_ALERTS <wbr><br> PL/SQL package.<br> The DBMS_AQ and DBMS_AQADM packages provide procedures for accessing and reading alert messages in the alert queue.<br><br><br> 1.Setting Threshold Levels<br><wbr>set thresholds with the SET_THRESHOLD<wbr> procedure for CPU time for each user call for an instance:<br><br> DBMS_SERVER_ALERT.SET_THRESHOLD(<br><wbr>DBMS_SERVER_ALERT.CPU_TIME_PER_CALL, DBMS_SERVER_ALERT.OPERATOR_GE, '8000',<br><wbr>DBMS_SERVER_ALERT.OPERATOR_GE, '10000', 1, 2, 'inst1',<br><wbr>DBMS_SERVER_ALERT.OBJECT_TYPE_SERVICE, 'main.regress.rdbms.dev.us.oracle.com');<br><br> In this example, a warning alert is issued when CPU time exceeds 8000 microseconds for each user call and a critical alert<wbr> is issued when CPU time exceeds 10,000 microseconds for each user call. The arguments include:<br><br><br> ■ CPU_TIME_PER_CALL specifies the metric identifier. For a list of support metrics, see<wbr> Oracle Database PL/SQL Packages and Types Reference.<br><br> ■ The observation period is set to 1 minute. This period specifies the number of minutes that the condition must deviate from the threshold value before the alert is issued.<br><br> ■ The number of consecutive occurrences is set to 2. This number specifies how<br> many times the metric value must violate the threshold values before the alert is generated.<br><br> ■ The name of the instance is set to<wbr> inst1.<br><br> ■ The constant<wbr> DBMS_ALERT.OBJECT_TYPE_SERVICE specifies the object type on<br> which the threshold is set. In this example, the service name ismain.regress.rdbms.dev.us.oracle.com .<br><br><br><br> 2.Retrieving Threshold Information<br> For example:<br> DECLARE<br><wbr>warning_operator<wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr> BINARY_INTEGER;<br><wbr>warning_value<wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr> VARCHAR2(60);<br><wbr>critical_operator<wbr><wbr><wbr><wbr><wbr><wbr><wbr> BINARY_INTEGER;<br><wbr>critical_value<wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr> VARCHAR2(60);<br><wbr>observation_period<wbr><wbr><wbr><wbr><wbr><wbr> BINARY_INTEGER;<br><wbr>consecutive_occurrences<wbr> BINARY_INTEGER;<br> BEGIN<br><wbr>DBMS_SERVER_ALERT.GET_THRESHOLD(<br><wbr>DBMS_SERVER_ALERT.CPU_TIME_PER_CALL, warning_operator, warning_value,<br><wbr><wbr><wbr> critical_operator, critical_value, observation_period,<br><wbr><wbr><wbr> consecutive_occurrences, 'inst1',<br><wbr>DBMS_SERVER_ALERT.OBJECT_TYPE_SERVICE, 'main.regress.rdbms.dev.us.oracle.com');<br><wbr>DBMS_OUTPUT.PUT_LINE('Warning operator:<wbr><wbr><wbr><wbr><wbr><wbr> ' || warning_operator);<br><wbr>DBMS_OUTPUT.PUT_LINE('Warning value:<wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr> ' || warning_value);<br><wbr>DBMS_OUTPUT.PUT_LINE('Critical operator:<wbr><wbr><wbr><wbr><wbr> ' || critical_operator);<br><wbr>DBMS_OUTPUT.PUT_LINE('Critical value:<wbr><wbr><wbr><wbr><wbr><wbr><wbr><wbr> ' || critical_value);<wbr><wbr><wbr><wbr><br><wbr>DBMS_OUTPUT.PUT_LINE('Observation_period:<wbr><wbr><wbr><wbr> ' || observation_period);<br><wbr>DBMS_OUTPUT.PUT_LINE('Consecutive occurrences:' || consecutive_occurrences);<br> END;<br> /<br><br> 我们也可以查找特定的阀值的信息&lt;DBA_THRESHOLDS&gt;<br><br> SELECT metrics_name, warning_value, critical_value, consecutive_occurrences<br><wbr><wbr> FROM DBA_THRESHOLDS<br><wbr><wbr> WHERE metrics_name LIKE '%CPU Time%';<br><br><br> Viewing Alert Data<br> The following dictionary views provide information about server alerts:<br> ■ DBA_THRESHOLDS lists the threshold settings defined for the instance.<br> ■ DBA_OUTSTANDING_ALERTS describes the outstanding<wbr> alerts in the database.<br> ■ DBA_ALERT_HISTORY lists a history of alerts that have been cleared.<br> ■ V$ALERT_TYPES<wbr> provides information such as group and type for each alert.<br> ■ V$METRICNAME contains the names, identifiers, and other information about the system metrics.<br> ■ V$METRIC<wbr> and V$METRIC_HISTORY<wbr> views contain system-lev el metric values in<br> memory.<br><br></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr></wbr>
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值