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

  1. Open Performance Monitor, and expand Data Collector Sets.

  2. Right-click User Defined, and select New > Data Collector Set.

  3. Give the new set a custom name, select the Create manually (Advanced) radio button, and select Next.

  4. Select the Performance Counter Alert radio button, then select Next.

  5. On the Which performance counters would you like to monitor? page, select Add to add a counter to the alert.

  6. Select a counter from the Available counters list.

  7. 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.

  8. 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).

  9. (Optional) Choose the account you want to run this alert as, using the Run as option.

  10. Select the Open properties for this data collector set radio button, and choose Finish.

  11. 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.

  1. 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 of Alert.

  2. On the Alert Task tab, set actions to occur every time the alert is triggered.

  3. On the Alert Action tab, check the Log an entry in the application event log box.

  4. On the Alerts tab, you can set the sampling frequency with the Sample interval and Units boxes.