The other day, I was troubleshooting a database slowness issue when the lead application developer asks me whether or not there are any SQL Jobs running during that time. The T-SQL script below helped me to retrieve that info. This T-SQL script will check the SQL Agent Job history.
SELECT
j.name AS 'JobName',
run_date,
run_time,
msdb.dbo.agent_datetime(run_date, run_time) AS 'RunDateTime'
FROM msdb.dbo.sysjobs j
INNER JOIN msdb.dbo.sysjobhistory h
ON j.job_id = h.job_id
WHERE j.enabled = 1 --Only Enabled Jobs
ORDER by JobName, RunDateTime DESC
Leave a Reply