How does one fix a stuck Azure Elastic Job Agent?

Viewed 843

Azure Elastic Job Agent is not executing jobs. When looking at the Agent on the Azure Portal, the status of the Agent shows as "Updating".

Is there a way to cancel the update, or to restart the agent, so that the jobs run as normal again?

We noticed that the jobs haven't been executing. When we went to check the executions, there were no job executions for about 7 days.

When we tried manual execution of a jobs (using the jobs.sp_start_job stored procedure), lifecycle column stays as Created and (Im not sure if the following is relevant, but its populates in the successful executions) does not have the target_type, target_id, target_server_name, target_database_name. Tried different jobs to see if the problem is related to the job, this did not yield success.

When cancelling one of the manually triggered jobs, using jobs.sp_stop_job, it does not update the portal (to indicate that it was cancelled), nor does it update the is_active status in the job_executions table. I had to manually delete the records from the table.

Checking the job status

SELECT TOP 1000 * FROM jobs.job_executions 
WHERE job_name = 'SomeJobName' 
ORDER BY start_time DESC 

Manually starting a job EXEC [jobs].[sp_start_job] 'SomeJobName'

Manully stopping the job EXEC [jobs].[sp_stop_job] @job_execution_id = 'C27EAF7B-DEC4-4081-86B2-94B560B838FA'

I need the jobs to run automatically again. Im not sure if the "Updating" status that Im seeing on the portal is the reason or if there is some other issue causing this.

2 Answers

We just had something similar - this question helped point me to noticing the "Updating" status. Given all of the job configuration is held with the database and not the agent itself (and that it was on one of our test environments), I deleted and re-created the Job Agent. This did the trick and the jobs all kicked off.

Asked Microsoft. They had made changes that caused this issue. Hence the updating status. They then fixed it and the jobs started working again.

Related