question

mehta.parth09 avatar image
mehta.parth09 asked

Trigger a mail when SQL job stuck/hung

Hello, Is there any script in SQL server which trigger a mail notification when SQL job or any step in the job gets stuck/hung? Like we can define threshold of 60 minute for each step of job and when it exceed so mail notification should send to DBAs to check. Please help me to get this done.
sql servertriggerjobnotificationsql server agent
1 comment
10 |1200 characters needed characters left characters exceeded

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

you'll probably need a separate job (or scheduled task in the OS) to check job duration and send the appropriate alert if the job or step has exceeded a certain threshold and is still running
2 Likes 2 ·

1 Answer

· Write an Answer
ThomasRushton avatar image
ThomasRushton answered
Some monitoring tools will also do this for you... *cough* [Redgate SQL Monitor][1], for example *cough*. Or you could look at the article "[SQL Overview V - Monitoring long-running jobs][2]" from David Bird's series on SSC. [1]: http://www.red-gate.com/products/dba/sql-monitor/ [2]: http://www.sqlservercentral.com/articles/Monitoring/69649/
10 |1200 characters needed characters left characters exceeded

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Write an Answer

Hint: Notify or tag a user in this post by typing @username.

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.