Alerting When SQL Agent Jobs Fail

John Shaulis has a script to send out e-mail alerts on SQL Agent job failures:

Here we have a T-SQL statement that we can either create as a stored procedure or just run as T-SQL in a job step. It looks back over the last 10 minutes and looks for job failures. I would recommend scheduling this T-SQL to run every 5 minutes, you will get duplicate entries for a short period of time, but ideally, you shouldn’t get any failures anyway right? Plus once you’re notified, you can turn this off while you work on it or you can specify in the where clause to remove this job until fixed.

Click through for the script and do read the instructions.

Related Posts

SQL Server Agent Security

Claudio Silva explains how you can provide secure access to manage SQL Agent jobs: It is common having services accounts that are job owners so they can run within the proper context. In my humble opinion, this starts to be a little strange when it comes to modifying the agent job. It means that the […]

Read More

Automated Alert Emails

Max Vernon shows how you can use the SQL Server Agent to send automated e-mails on alerts: SQL Server Agent provides a great mechanism for sending alerts via email in response to various events. Once you’ve setup Database Mail, and configured a SQL Server Agent Operator, you should add alerts for severe errors that affect the […]

Read More

1 Comment

  • Jason on 2019-06-15

    The concept sounds good but I’m curious why the notification for the job itself wouldn’t just be used. I can see this as a backup if a notification hasn’t been set up or maybe to avoid notification setup all together. Thank you for the article.

Comments are closed

Categories

June 2019
MTWTFSS
« May Jul »
 12
3456789
10111213141516
17181920212223
24252627282930