Lokasi ngalangkungan proxy:   [ UP ]  
[Ngawartoskeun bug]   [Panyetelan cookie]                
Skip to content

Latest commit

 

History

History
167 lines (101 loc) · 9.01 KB

File metadata and controls

167 lines (101 loc) · 9.01 KB
title Alerts
ms.prod sql
ms.prod_service sql-tools
ms.technology ssms
ms.topic conceptual
helpviewer_keywords
SQL Server Agent alerts, event types
SQL Server Agent alerts, names
alerts [SQL Server], performance conditions
alerts [SQL Server], about alerts
WMI event responses [SQL Server Agent alerts]
events [WMI]
performance condition alerts [SQL Server Agent]
alerts [SQL Server], event types
SQL Server Agent alerts, performance conditions
SQL Server Agent alerts, about alerts
alerts [SQL Server], names
ms.assetid 3f57d0f0-4781-46ec-82cd-b751dc5affef
author markingmyname
ms.author maghan
ms.reviewer
ms.custom seo-lt-2019
ms.date 01/19/2017
monikerRange = azuresqldb-mi-current || >= sql-server-2016 || = sqlallproducts-allversions

Alerts

[!INCLUDE SQL Server]

Important

On Azure SQL Database Managed Instance, most, but not all SQL Server Agent features are currently supported. See Azure SQL Database Managed Instance T-SQL differences from SQL Server for details.

Events are generated by [!INCLUDEssNoVersion] and entered into the [!INCLUDEmsCoName] Windows application log. [!INCLUDEssNoVersion] Agent reads the application log and compares events written there to alerts that you have defined. When [!INCLUDEssNoVersion] Agent finds a match, it fires an alert, which is an automated response to an event. In addition to monitoring [!INCLUDEssNoVersion] events, [!INCLUDEssNoVersion] Agent can also monitor performance conditions and Windows Management Instrumentation (WMI) events.

To define an alert, you specify:

  • The name of the alert.

  • The event or performance condition that triggers the alert.

  • The action that [!INCLUDEssNoVersion] Agent takes in response to the event or performance condition.

Naming an Alert

Every alert must have a name. Alert names must be unique within the instance of [!INCLUDEssNoVersion] and can be no longer than 128 characters.

Selecting an Event Type

An alert responds to an event of a specific type. Alerts respond to the following event types:

The type of the event determines the parameters that you use to specify the precise event.

Specifying a SQL Server Event

You can specify an alert to occur in response to one or more events. Use the following parameters to specify the events that trigger an alert:

  • Error number

    [!INCLUDEssNoVersion] Agent fires an alert when a specific error occurs. For example, you might specify error number 2571 to respond to unauthorized attempts to invoke Database Console Commands (DBCC).

  • Severity level

    [!INCLUDEssNoVersion] Agent fires an alert when any error of the specific severity occurs. For example, you might specify a severity level of 15 to respond to syntax errors in Transact-SQL statements.

  • Database

    [!INCLUDEssNoVersion] Agent fires an alert only when the event occurs in a particular database. This option applies in addition to the error number or severity level. For example, if an instance contains one database that is used for production and one database that is used for reporting, you can define an alert that responds to syntax errors in the production database only.

  • Event text

    [!INCLUDEssNoVersion] Agent fires an alert when the specified event contains a particular text string in the event message. For example, you might define an alert that responds to messages that contain the name of a particular table or a particular constraint.

Selecting a Performance Condition

You can specify an alert to occur in response to a particular performance condition. In this case, you specify the performance counter to monitor, a threshold for the alert, and the behavior that the counter must show if the alert is to occur. To set a performance condition, you must define the following items on the [!INCLUDEssNoVersion] Agent General page of the New Alert or the Alert Properties dialog box:

  • Object

    The object is the area of performance to be monitored.

  • Counter

    A counter is an attribute of the area to be monitored.

  • Instance

    The [!INCLUDEssNoVersion] instance defines the specific instance (if any) of the attribute to be monitored.

  • Alert if counter and Value

    The threshold for the alert and the behavior that produces the alert. The threshold is a number. The behavior is one of the following: falls below, becomes equal to, or rises above a number specified for Value. The Value is a number that describes the performance condition counter. For example, to set an alert to occur for the performance object SQLServer:Locks when the Lock Wait Time exceeds 30 minutes, you would choose rises above and specify 30 as the value.

    As another example, you might specify that an alert occurs for the performance object SQLServer:Transactions when the free space in tempdb falls below 1000 KB. To set this, you would choose the counter Free space in tempdb (KB), falls below,and a Value of 1000.

    [!NOTE]
    Performance data is sampled periodically, which can lead to a small delay (a few seconds) between the threshold being reached and the occurrence of the performance alert.

    [!NOTE]
    An Event log variable that stores the server name is limited to 32 characters. Therefore if the combined size of your host name and instance name is greater than 32 characters, you may get the following error:

Warning,[466] Failed to copy server name LONGNAMESQLSERV\LONGINSTANCENAME while generating performance counter alerts.

Selecting a WMI Event

You can specify that an alert occur in response to a particular WMI event. To select a WMI event, you must define the following on the [!INCLUDEssNoVersion] Agent General page of the New Alert or the Alert Properties dialog box:

  • Namespace

    [!INCLUDEssNoVersion] Agent registers as a WMI client to the WMI namespace that is provided to query for events.

  • Query

    [!INCLUDEssNoVersion] Agent uses the Windows Management Instrumentation Query Language (WQL) statement provided to identify the specific event.

Following are links to common tasks:

To create an alert based on a message number

To create an alert based on severity levels

To create an alert based on a WMI event

To define the response to an alert

To create a user-defined event error message

To modify a user-defined event error message

To delete a user-defined event error message

To disable or reactivate an alert

See Also

sp_update_alert (Transact-SQL)