Search code examples
sqlsql-serverjobssql-server-agent

SQL Server Agent Job Is Idle - Duration Still Increasing


I have a SQL Agent Job that shows as idle in the Activity Monitor but the time duration keeps increasing.

The job seems to have stopped as I've tried stopping it manually and SQL advises the job isn't running.

SysJobActivity doesn't have a stop_execution_date for the job

The job has 5 steps and the last step didn't complete - the server rebooted during the execution of this step.

Is the job ok to leave in it's current state? The duration will forever keep increasing.

Thanks

Job History

Activity Monitor

Job History - Updated


Solution

  • After the comments and viewing the screenshots I think I know what is going on:

    • The job duration is reported by what is in the msdb..sysjobhistory
    • The reboot during the job caused a problem (perhaps the power was killed to the box so it couldn't log properly?) so the job never really failed or finished and not properly recorded into the sysjobhistory.
    • It's not showing up in sp_who which means it is NOT running

    I suspect it's probably OK to leave the job just 'running' forever. But I would suggest clearing that up so some other poor DBA isn't scratching his head. You could:

    • Manually edit the msdb..sysjobhistory which is scary and I wouldn't.
    • I bet start and stop the job and now it will report OK
    • Delete the job and history via the GUI and remake it (script it out first!)