Click here to monitor SSC
SQLServerCentral is supported by Red Gate Software Ltd.
Log in  ::  Register  ::  Not logged in

Get your favorite SSC scripts directly in SSMS with the free SQL Scripts addin. Search for scripts directly from SSMS, and instantly access any saved scripts in your SSC briefcase from the favorites tab.
Download now (direct download link)

Runaway Job Management

By Mark Marinovic,

I support quite a few third-party applications, many of which install Database Maintenance jobs of their own (e.g. purging, populating, etc.) Once in awhile these jobs interfere with day-to-day activities or my normal DBA maintenance jobs.

The repetitive task of finding the answer to "Why is XXX so slow today?", or "Why is the reindex taking so long this weekend?" usually involves checking to see if these third-party jobs are running/runaway/stuck. Normally, the job is killed by an administrator and life goes on.

Having laid that out, I wanted a way to be alerted or automatically take an action on my behalf so that I could retain my precious Corona time.

The code I provided will either send an Alert to the specified SQL Operator ('Alert'), or stop the job ('Kill') depending on what argument is set. This code can be altered to be placed directly within a "Governer" job, or you can make it into a Stored Procedure on a database of your choosing within the instance and call it for multiple jobs.

Logic can also be added to take other actions of your choosing. Hope you enjoy this as it's saved me quite a bit of time in the past year!


Total article views: 791 | Views in the last 30 days: 3
Related Articles

Failover Alerts

Failover Alerts


How to create Custom Alert.

custom alert.


SQL Alert question

SQL Alert question


Alert when no witness

When creating an alert


SQL Pager alerts

SQL Pager alerts

sql jobs    

Join the most active online SQL Server Community

SQL knowledge, delivered daily, free:

Email address:  

You make SSC a better place

As a member of SQLServerCentral, you get free access to loads of fresh content: thousands of articles and SQL scripts, a library of free eBooks, a weekly database news roundup, a great Q & A platform… And it’s our huge, buzzing community of SQL Server Professionals that makes it such a success.

Join us!

Steve Jones

Already a member? Jump in:

Email address:   Password:   Remember me: Forgotten your password?
Steve Jones