Set up a SQL Server database alert (Windows)
Applies to: SQL Server
You can use Performance Monitor to create an alert that is raised when a Performance Monitor counter reaches a threshold value. In response to the alert, Performance Monitor can launch an application, such as a custom application written to handle the alert condition. For example, you can create an alert that is raised when the number of deadlocks exceeds a specific value.
Alerts also can be defined by using SQL Server Management Studio and SQL Server Agent. For more information, see Alerts.
Create a data collector set for a performance counter alert
Open Performance Monitor, and expand Data Collector Sets.
Right-click User Defined, and select New > Data Collector Set.
Give the new set a custom name, select the Create manually (Advanced) radio button, and select Next.
Select the Performance Counter Alert radio button, then select Next.
On the Which performance counters would you like to monitor? page, select Add to add a counter to the alert.
Select a counter from the Available counters list.
To add the counter to the alert, select Add. You can continue to add counters, or you can select OK to return to the dialog box for the new alert.
In the new alert dialog box, select either Over or Under in the Alert when list. Then enter a threshold value in Limit.
The alert is generated when the value for the counter is more than or less than the threshold value (depending on whether you selected Over or Under).
(Optional) Choose the account you want to run this alert as, using the Run as option.
Select the Open properties for this data collector set radio button, and choose Finish.
On the Schedule tab, set the start and stop schedule for the alert scan.
Set up a SQL Server database alert with the data collector
To modify the actions you can perform against an alert, you must open the data collector that was created in your new data collector set.
Navigate to the new data collector set you created, and double-click the data collector object in the detail pane. In this example, the name is
DataCollector01
, and it has a Type ofAlert
.On the Alert Task tab, set actions to occur every time the alert is triggered.
On the Alert Action tab, check the Log an entry in the application event log box.
On the Alerts tab, you can set the sampling frequency with the Sample interval and Units boxes.