SQL Jobs Agent

I have two separate questions on JOBs.

  1. I have a job that is scheduled at 12 am daily. Recently, it has been running more than 24 hours. If it is still running and the next cycle comes, does it also stop or does it wait until the running job completes and then starts. What exactly happens on OVERLAP of the SAME job?

  2. Is it possible to setup a job where once it completes, it IMMEDIATELY runs again. How would I do this?

Thanks

  1. why is this job running for 24+ hours. Therein lies your issue.
  2. Schedule it to run every 5 minutes?

But both of your questions imply another major issue you are facing. Instead of providing you a solution that puts a band-aid on a deep wound, please expound on the issue you are facing that might require open heart surgery.

1 Like

If the scheduled start time of a job is passed - the job will be scheduled for the next scheduled start time. So if the job is scheduled to run at 12am and the current execution finishes at 00:00:00.003 then the job will be scheduled the following day.

There is no 'continuous' schedule available in SQL Server - if you need a job to execute continuously then you would create the code with an infinite loop so it executes the expected code and then repeats.

Note: for something like that I would definitely code a mechanism to stop the execution as well as code to disable the job. You might also consider a separate 'monitor' job that executes every xx minutes - which checks a table to determine if the job should be stopped, disabled, enabled, etc... and takes appropriate action (for example, if the job is supposed to be enabled and running - but is not - enabled the job and start it).

But - I would address the problem instead of the symptom...

1 Like

I agree with yosiasz and Jeff that the issue needs to be addressed which I have been looking into. I was curious on those questions as I was going through the debugging process.

Thanks