October 4, 2009 at 6:10 am
Some time SQL job are not executed even though sql agent are started. I want to find out the list of jobs which are not executed (skipped). Is there any way or query to find out the list of skipped jobs?
Please help me.
October 4, 2009 at 6:34 am
Maybe this can get you started :
select h.server as Server
, name as Job_Name
, description
, h.run_date as Run_Date
, h.run_time as Run_Time
, h.Run_Status as Run_Status
, h.message
from msdb..sysjobs s
left join
msdb..sysjobhistory h
on s.job_id = h.job_id
and h.step_id = 0 -- status job level
and s.enabled = 1 -- only active jobs
where h.run_date = ( select max(run_date) from msdb..sysjobhistory hs where hs.job_id = h.job_id )
order by Server, Job_Name, Run_Time desc
go
-- jobs en NextRun time
select s.Originating_server as Server
, s.name as Job_Name
, s.description
, sc.next_run_date as Next_Run_Date
, sc.next_run_time as Next_Run_Time
from msdb..sysjobs s
left join
msdb..sysjobschedules sc
on s.job_id = sc.job_id
and s.enabled = 1 -- enkel actieve jobs
and sc.enabled = 1 -- enkel actieve schedules
-- where sc.next_run_date = convert(integer, CONVERT ( char(8) , current_timestamp , 112 )) -- only jobs scheduled for today
order by Server, Job_Name
go
Johan
Learn to play, play to learn !
Dont drive faster than your guardian angel can fly ...
but keeping both feet on the ground wont get you anywhere :w00t:
- How to post Performance Problems
- How to post data/code to get the best help[/url]
- How to prevent a sore throat after hours of presenting ppt
press F1 for solution, press shift+F1 for urgent solution 😀
Need a bit of Powershell? How about this
Who am I ? Sometimes this is me but most of the time this is me
Viewing 2 posts - 1 through 1 (of 1 total)
You must be logged in to reply to this topic. Login to reply