September 05, 2010

Email Alerts when something goes wrong with SQL Server




Here’s how to configure your SQL Server to send alert notifications when something goes wrong.

Step 1: Define an Operator. Open SQL Server Management Studio (SSMS) 2008 > Expand SQL Server Agent Node > Right click on Operators > New Operator > Enter a Name of the operator in the Name section. Provide an E-mail address, Net send address, or Pager address or all the three the operator.

For this example, I am using only the E-mail address as shown below. Click OK.

image

Step 2: Let’s now define a new alert. This alert could be based on an error code or severity, or SQL Server performance or WMI event alert.

Right click the Alerts folder > New Alert > define an alert name > choose ‘SQL Server Event alert’ as the alert type > choose ‘all databases’ and in the severity, choose 011 – to raise an error when a specified database object is not found'

image

Select the Response tab now > check the ‘Notify operators’ checkbox and select Admin from the operator list with the Email option.

image

Click OK and an alert has been set. You should be receiving emails now whenever a query fails because of a missing database object. Make sure you have set up SQL Server Database Mail for the email to work.


Did you like this post?
kick it on DotNetKicks.com
subscribe via rss subscribe via e-mail
print this post follow me on twitter


About The Author

Suprotim Agarwal, ASP.NET Architecture MVP works as an Architect Consultant and provides consultancy on how to design and develop Web applications.

Suprotim is also the founder and primary contributor to DevCurry, DotNetCurry and SQLServerCurry. He has also written an EBook 51 Recipes using jQuery with ASP.NET Controls.

Follow him on twitter @suprotimagarwal

 
  Feedback:

comments

1 Response to "Email Alerts when something goes wrong with SQL Server"
  1. Maritey H said...
    September 5, 2010 at 10:00 PM

    bravo! I always wanted to do something like this can you also show how to do database mail?

 

Copyright © 2009-2014 All Rights Reserved for SQLServerCurry.com by Suprotim Agarwal | Terms and Conditions