How can I determine the status of a job?

前端 未结 14 2269
佛祖请我去吃肉
佛祖请我去吃肉 2020-11-30 02:36

I have a Stored procedure which schedules a job. This Job takes a lot of time to get completed (approx 30 to 40 min). I need to get to know the status of this Job. Below det

14条回答
  •  一整个雨季
    2020-11-30 03:02

    The tasks above work but I have seen many records in the msdb.dbo.sysjobactivity where run_Requested_date is not null and stop_execution_date is null ---- and the job is not currently running.

    I would recommend running the following script to clear out all of the bogus entries (make sure no jobs are running at the time).

    SQL2008:

        delete activity
        from msdb.dbo.sysjobs_view job  
        inner join msdb.dbo.sysjobactivity activity on job.job_id = activity.job_id 
        where  
            activity.run_Requested_date is not null  
        and activity.stop_execution_date is null  
    

提交回复
热议问题