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
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