0

I have a rebuild index job that is set to run every night. The job used to run fine, but last night for some reason the SQL Server Agent Job was stopped. The rebuild index job was running on 9 different databases and it used to take less than 2 minutes, but it stopped all of a sudden last night with an error in the last step.

Here is error message:

The job was stopped prior to completion by User [User_name]. The job was invoked by Schedule 37 (daily).

Executed as User: User-Name. The step was cancelled (stopped) as the result of a stop job request.

I checked on SQL Server logs, there are no error messages. Where can I find exact root cause of job stopped?

Any suggestions?

2

The user stopped the job, probably because it was running long.

That is not an error message, it is telling you what happened.

Contact the user and ask them why the stopped the job.

  • No, job ran less than 2 mins and user is SQL service account.. There is any chance service account stopped job ? How to check this? – CR241 Jan 17 at 19:03
  • 2
    Someone logging in under the service account would be one possibility. Who has access to that account's credentials? Or is there another job that issues a stop command? – LowlyDBA Jan 17 at 20:21
  • @CR241 to LowlyDBA's second point see this answer You know the service account stopped the job, what you don't know is how or why. – James Jenkins Jan 18 at 11:32
0

Looking into the error message, the job was triggered to stop automatically by SQL Server Agent through sp_stop_job (sp to stop execution of the job).

Executed as User: User-Name. The step was cancelled (stopped) as the result of a stop job request.

This might be requested within the job to cancel the job if is not completed within certain time or has WAITED too long. Please check the history of the job to see how long was taken.

  • I am not sure this is a good answer. The comments under the existing answer indicate the job only ran two minutes. Also LowlyDBA is suggesting to look for another job that stopped it the first. To the best of my knowledge there is no way inside of a job to stop it for long run times, you have to have a second job that checks if the first is still running and stop it. If you have a way, you should post and answer at SQL Server job timeout – James Jenkins Apr 12 at 13:15

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.