144 DBMS_SERVER_ALERT
The DBMS_SERVER_ALERT package enables you to configure the Oracle Database server to issue an alert when a threshold for a specified server metric has been violated. You can configure both warning and critical thresholds for a large number of predefined metrics.
               
If a warning threshold is reached, the server generates a severity level 5 alert. If a critical threshold is reached, the server generates a severity level 1 alert.
The chapter contains the following topics:
144.1 DBMS_SERVER_ALERT Security Model
The user needs DBA or IMP_FULL_DATABASE roles to use the DBMS_SERVER_ALERT package.
                  
144.2 DBMS_SERVER_ALERT Object Types
You qualify the metric by an individual object for the listed object types.
Table 144-1 Object Types Defined as Constants
| Constant | Description | 
|---|---|
| 
 | Metrics collected on the system level for each instance. | 
| 
 | Metrics collected on the file level. These are used for  | 
| 
 | Metrics collected on the service level. Currently  | 
| 
 | Metrics collected on the tablespace level. Note: Dictionary managed tablespaces are not supported. | 
| 
 | Metrics collected on wait event class level. Currently supported metrics are  | 
| 
 | Metrics collected on the session level. Currently only  | 
| 
 | Refers to a group of metrics ( | 
144.3 DBMS_SERVER_ALERT Relational Operators
You can specify a relational comparison operator to determine whether or not a given metric's value violates the threshold setting. The server supports the following operators.
Table 144-2 Relational Operators Defined as Constants
| Constant | Description | 
|---|---|
| 
 | A metric value matching an entry in a list of threshold values is considered a violation. | 
| 
 | The metric value is not compared to the threshold value, and no alerts are generated. Use this operator to disable alerts for a metric. | 
| 
 | A metric value equal to the threshold value is considered a violation. | 
| 
 | A metric value greater than or equal to the threshold value is considered a violation. | 
| 
 | A metric value greater than the threshold value is considered a violation. | 
| 
 | A metric value less than or equal to the threshold value is considered a violation. | 
| 
 | A metric value less than the threshold value is considered a violation. | 
| 
 | A metric value not equal to the threshold value is considered a violation. | 
144.4 DBMS_SERVER_ALERT Supported Metrics
These metrics are supported. All internal metric names are supplied as package constants.
Table 144-3 List of Supported Metrics
| Metric Name (Internal) | Metric Name (External) | Units | 
|---|---|---|
| 
 | Average File Read Time | Microseconds | 
| 
 | Average File Write Time | Microseconds | 
| 
 | Average Number of Users Waiting on a Class of Wait Events | Count of sessions | 
| 
 | Number of Users blocked by some Session | Number of Users | 
| 
 | Branch Node Splits (for each second) | Splits for each Second | 
| 
 | Branch Node Splits (for each transaction) | Splits for each Transaction | 
| 
 | Buffer Cache Hit (%) | % of cache accesses | 
| 
 | Consistent Changes (for each second) | Changes for each Second | 
| 
 | Consistent Changes (for each transaction) | Changes for each Transaction | 
| 
 | Consistent Gets (for each second) | Gets for each Second | 
| 
 | Consistent Gets (for each transaction) | Gets for each Transaction | 
| 
 | CR Blocks Created (for each second) | Blocks for each Second | 
| 
 | CR Blocks Created (for each transaction) | Blocks for each Transaction | 
| 
 | CR Undo Records Applied (for each second) | Records for each Second | 
| 
 | CR Undo Records Applied (for each transaction) | Records for each Transaction | 
| 
 | Cursor Cache Hit (%) | % of soft parses | 
| 
 | Database Wait Time (%) | % of all database time | 
| 
 | Database CPU Time (%) | % of all database time | 
| 
 | DB Block Gets (for each second) | Gets for each Second | 
| 
 | DB Block Gets (for each transaction) | Gets for each Transaction | 
| 
 | Percent of Database Time Spent Waiting on a Class of Wait Events | % of Database Time | 
| 
 | DBWR Checkpoints (for each second) | Checkpoints for each Second | 
| 
 | Sorts to Disk (for each second) | Sorts for each Second | 
| 
 | Sorts to Disk (for each transaction) | Sorts for each Transaction | 
| 
 | Elapsed time for each user call for each service | Microseconds for each call | 
| 
 | Enqueue Deadlocks (for each second) | Deadlocks for each Second | 
| 
 | Enqueue Deadlocks (for each transaction) | Deadlocks for each Transaction | 
| 
 | Enqueue Requests (for each second) | Requests for each Second | 
| 
 | Enqueue Requests (for each transaction) | Requests for each Transaction | 
| 
 | Enqueue Timeouts (for each second) | Timeouts for each Second | 
| 
 | Enqueue Timeouts (for each transaction) | Timeouts for each Transaction | 
| 
 | Enqueue Waits (for each second) | Waits for each Second | 
| 
 | Enqueue Waits (for each transaction) | Waits for each Transaction | 
| 
 | Executes Performed Without Parsing | % of all executes | 
| 
 | Fast Full Index Scans (for each second) | Scans for each Second | 
| 
 | Fast Full Index Scans (for each transaction) | Scans for each Transaction | 
| 
 | Global Cache CR Request | Milliseconds | 
| 
 | Global Cache Current Request | Milliseconds | 
| 
 | Global Cache Blocks Corrupt | Blocks | 
| 
 | Global Cache Blocks Lost | Blocks | 
| 
 | Hard Parses (for each second) | Parses for each Second | 
| 
 | Hard Parses (for each transaction) | Parses for each Transaction | 
| 
 | Leaf Node Splits (for each second) | Splits for each Second | 
| 
 | Leaf Node Splits (for each transaction) | Splits for each Transaction | 
| 
 | Library Cache Hit (%) | % of cache accesses | 
| 
 | Library Cache Miss (%) | % of cache accesses | 
| 
 | Current Number of Logons | Number of Logons | 
| 
 | Cumulative Logons (for each second) | Logons for each Second | 
| 
 | Cumulative Logons (for each transaction) | Logons for each Transaction | 
| 
 | Scans on Long Tables (for each second) | Scans for each Second | 
| 
 | Scans on Long Tables (for each transaction) | Scans for each Transaction | 
| 
 | Cumulative Open Cursors (for each second) | Cursors for each Second | 
| 
 | Sorts in Memory (%) | % of sorts | 
| 
 | Network Bytes, for each second | Bytes for each Second | 
| 
 | Current Number of Cursors | Number of Cursors | 
| 
 | Cumulative Open Cursors (for each transaction) | Cursors for each Transaction | 
| 
 | Operating System Scheduler CPU Wait (by time) | Microseconds | 
| 
 | Parse Failures (for each second) | Parses for each Second | 
| 
 | Parse Failures (for each transaction) | Parses for each Transaction | 
| 
 | PGA Cache Hit (%) | % bytes processed in PGA | 
| 
 | Physical Design Wait (by session count) | Count of sessions | 
| 
 | Physical Reads (for each second) | Reads for each Second | 
| 
 | Physical Reads (for each transaction) | Reads for each Transaction | 
| 
 | Physical Writes (for each second) | Writes for each Second | 
| 
 | Physical Writes (for each transaction) | Writes for each Transaction | 
| 
 | Direct Physical Reads (for each second) | Reads for each Second | 
| 
 | Direct Physical Reads (for each transaction) | Reads for each Transaction | 
| 
 | Direct Physical Writes (for each second) | Writes for each Second | 
| 
 | Direct Physical Writes (for each transaction) | Writes for each Transaction | 
| 
 | Direct LOB Physical Reads (for each second) | Reads for each Second | 
| 
 | Direct LOB Physical Reads (for each transaction) | Reads for each Transaction | 
| 
 | Direct LOB Physical Writes (for each second) | Writes for each Second | 
| 
 | Direct LOB Physical Writes (for each transaction) | Writes for each Transaction | 
| 
 | Process Limit Usage (%) | % of maximum value | 
| 
 | Downgraded Parallel Operations (for each second) | Operations for each Second | 
| 
 | Downgraded to 25% and more (for each second) | Operations for each Second | 
| 
 | Downgraded to 50% and more (for each second) | Operations for each Second | 
| 
 | Downgraded to 75% and more (for each second) | Operations for each Second | 
| 
 | Downgraded to serial (for each second) | Operations for each Second | 
| 
 | Rollback Undo Records Applied (for each second) | Records for each Second | 
| 
 | Rollback Undo Records Applied (for each transaction) | Records for each Transaction | 
| 
 | Redo Log Allocation Hit | % of redo allocations | 
| 
 | Redo Generated (for each second) | Redo Bytes for each Second | 
| 
 | Redo Generated (for each transaction) | Redo Bytes for each Transaction | 
| 
 | Redo Writes (for each second) | Writes for each Second | 
| 
 | Redo Writes (for each transaction) | Writes for each Transaction | 
| 
 | Recursive Calls (for each second) | Calls for each Second | 
| 
 | Recursive Calls (for each transaction) | Calls for each Transaction | 
| 
 | Response (for each transaction) | Seconds for each Transaction | 
| 
 | Rows Processed for each Sort | Rows for each Sort | 
| 
 | Session Logical Reads (for each second) | Reads for each Second | 
| 
 | Session Logical Reads (for each transaction) | Reads for each Transaction | 
| 
 | Database CPU (for each second) | Microseconds for each Second | 
| 
 | Database CPU (for each transaction) | Microseconds for each Transaction | 
| 
 | Session Limit Usage (%) | % of maximum value | 
| 
 | Shared Pool Free(%) | % of shared pool | 
| 
 | Soft Parse (%) | % of all parses | 
| 
 | Service Response (for each execution) | Seconds | 
| 
 | Tablespace space usage | % full | 
| 
 | Tablespace bytes space usage | Kilobytes free | 
| 
 | Total Table Scans (for each second) | Scans for each Second | 
| 
 | Total Table Scans (for each transaction) | Scans for each Transaction | 
| 
 | Total Index Scans (for each second) | Scans for each Second | 
| 
 | Total Index Scans (for each transaction) | Scans for each Transaction | 
| 
 | Total Parses (for each second) | Parses for each Second | 
| 
 | Total Parses (for each transaction) | Parses for each Transaction | 
| 
 | User Commits (for each second) | Commits for each Second | 
| 
 | User Commits (for each transaction) | Commits for each Transaction | 
| 
 | User Rollbacks (for each second) | Rollbacks for each Second | 
| 
 | User Rollbacks (for each transaction) | Rollbacks for each Transaction | 
| 
 | User Calls (for each second) | Calls for each Second | 
| 
 | User Calls (for each transaction) | Calls for each Transaction | 
| 
 | User Calls (%) | % of all calls | 
| 
 | User Limit Usage (%) | % of maximum value | 
| 
 | Average IO response time (for a WRC client) | Milliseconds | 
| 
 | Percentage of replay threads on CPU (for a WRC client) | % of total replay threads | 
| 
 | Percentage of replay threads doing IOs (for a WRC client) | % of total replay threads | 
144.5 Summary of DBMS_SERVER_ALERT Subprograms
This table lists the DBMS_SERVER_ALERT subprograms and briefly describes them.
                  
Table 144-4 DBMS_SERVER_ALERT Package Subprograms
| Subprogram | Description | 
|---|---|
| Expands alert messages | |
| Gets the current threshold settings for a specified metric | |
| Sets the warning and critical thresholds for a specified metric | 
144.5.1 EXPAND_MESSAGE Function
This function expands alert messages.
Syntax
DBMS_SERVER_ALERT.EXPAND_MESSAGE( user_language IN VARCHAR2, message_id IN NUMBER, argument_1 IN VARCHAR2, argument_2 IN VARCHAR2, argument_3 IN VARCHAR2, argument_4 IN VARCHAR2, argument_5 IN VARCHAR2) RETURN VARCHAR2;
Parameters
Table 144-5 EXPAND_MESSAGE Function Parameters
| Parameter | Description | 
|---|---|
| 
 | The language of the current session. | 
| 
 | Id of the alert message | 
| 
 | The first argument in the alert message. | 
| 
 | The second argument in the alert message. | 
| 
 | The third argument in the alert message. | 
| 
 | The fourth argument in the alert message. | 
| 
 | The fifth argument in the alert message. | 
144.5.2 GET_THRESHOLD Procedure
This procedure gets the current threshold settings for the specified metric.
Syntax
DBMS_SERVER_ALERT.GET_THRESHOLD( metrics_id IN BINARY_INTEGER, warning_operator OUT BINARY_INTEGER, warning_value OUT VARCHAR2, critical_operator OUT BINARY_INTEGER, critical_value OUT VARCHAR2, observation_period OUT BINARY_INTEGER, consecutive_occurrences OUT BINARY_INTEGER, instance_name IN VARCHAR2, object_type IN BINARY_INTEGER, object_name IN VARCHAR2);
Parameters
Table 144-6 GET_THRESHOLD Procedure Parameters
| Parameter | Description | 
|---|---|
| 
 | The internal name of the metric. See "Supported Metrics". | 
| 
 | The operator for the compa3ring the actual value with the warning threshold. | 
| 
 | The warning threshold value. | 
| 
 | The operator for the comparing the actual value with the critical threshold. | 
| 
 | The critical threshold value. | 
| 
 | The period at which the metric values are computed and verified against the threshold setting. | 
| 
 | The number of observation periods the metric value should violate the threshold value before the alert is issued. | 
| 
 | The name of the instance for which the threshold is set. This is  | 
| 
 | Either  | 
| 
 | The name of the object. | 
Usage Notes
Note that this subprogram does not check if the value of the instance_name parameter is meaningful or valid. 
                        
144.5.3 SET_THRESHOLD Procedure
This procedure sets the warning and critical thresholds for a specified metric.
Syntax
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);
Parameters
Table 144-7 SET_THRESHOLD Procedure Parameters
| Parameter | Description | 
|---|---|
| 
 | The internal name of the metric. See "Supported Metrics". | 
| 
 | The operator for the comparing the actual value with the warning threshold (such as  | 
| 
 | The warning threshold value. This is  | 
| 
 | The operator for the comparing the actual value with the critical threshold. See "Relational Operators". | 
| 
 | The critical threshold value. This is  | 
| 
 | The period at which the metric values are computed and verified against the threshold setting. The valid range is 1 to 60 minutes. | 
| 
 | The number of observation periods the metric value should violate the threshold value before the alert is issued. | 
| 
 | The name of the instance for which the threshold is set. This is  | 
| 
 | See "Object Types". | 
| 
 | The name of the object. This is  | 
Usage Notes
Note that this subprogram does not check if the value of the instance_name parameter is meaningful or valid. Passing a name that does not identify a valid instance will result in a threshold that is not used by any by any instance although the threshold setting will be visible in the DBA_THRESHOLDS view. The exception is the lower-case string 'database_wide' which is semantically equivalent to passing NULL for the instance name, the latter being the preferred usage.