Need a logic to query a sql job

  • Hi Guys,

    I have several Jobs running with different schedule. For example one sql job runs every 15 mins. As we are busy with our daily jobs sometime with any means this job gets disabled it will not be running and we are unaware of the fact that the job is disabled. So, it has been couple of times that we got the job is not running after 2 days. So, to alert us with this fact that the job is disabled we want to automate a process to have a check job job that will basically check whether or not the job is running or not. How can I do this ? I may not require that it should tell me that at the regular 15 min it is not running but I may want that if the job is not running for an hour or two than it provides me an alert so that somebody or me can go and check the server and see whats going on.. If it is disabled than enable or find the reason of why it is disabled and so on...

    Can you guys help me with this?? Will appreciate it..

    Thanks.

  • You can query the msdb.dbo.sysjobactivity table.

  • Hi,

    hmm..I think the script from this topic didn't help you 🙂

    What was the problem with it?

    Regards

  • HI SSC,

    Actually I wanted to check for several servers and several jobs. The code you shared with me helped for only one job.

    Thanks,

  • Hi,

    to check more than one job you could read the job names from a table. Or you could define the jobs to check in the script and check one after the other.

    To monitor more than one server you could implement this script on each of this servers 🙂

    To have an overview over your running (or not running) jobs you could use Idera's sql job manager => Here

    I hope this helps.

Viewing 5 posts - 1 through 4 (of 4 total)

You must be logged in to reply to this topic. Login to reply