What SQL Jobs were Running?
With performance issues with SQL Jobs sometimes I want to know what other jobs were running at the same time. With these two queries I get that information. Query 1 lets me get the exact name of the job and what time it ran. You may ask how come I did not know the exact name of the job. We have lots of jobs and that is all the developer gave me. :-)
USE MSDB
Go
SELECT DISTINCT
sysjobs.name, sysjobhistory.instance_id, sysjobhistory.job_id, sysjobhistory.step_id, sysjobhistory.step_name, sysjobhistory.sql_message_id,
sysjobhistory.sql_severity, sysjobhistory.message, sysjobhistory.run_status, sysjobhistory.run_date, sysjobhistory.run_time, sysjobhistory.run_duration,
sysjobhistory.retries_attempted, sysjobhistory.server
FROM sysjobhistory INNER JOIN
sysjobs ON sysjobhistory.job_id = sysjobs.job_id
WHERE (sysjobhistory.run_date = 20150616) AND (sysjobs.name LIKE N'BI Pop%')
USE MSDB
Go
SELECT DISTINCT
sysjobs.name, sysjobhistory.instance_id, sysjobhistory.step_id, sysjobhistory.step_name, sysjobhistory.message, sysjobhistory.run_status,
sysjobhistory.run_date, sysjobhistory.run_time, sysjobhistory.run_duration, sysjobhistory.server
FROM sysjobhistory INNER JOIN
sysjobs ON sysjobhistory.job_id = sysjobs.job_id
WHERE (sysjobhistory.run_date = 20151123) AND (sysjobhistory.run_time >= 190000) AND (sysjobhistory.run_time <= 193000)
ORDER BY sysjobhistory.run_time DESC
USE MSDB
Go
SELECT DISTINCT
sysjobs.name, sysjobhistory.instance_id, sysjobhistory.job_id, sysjobhistory.step_id, sysjobhistory.step_name, sysjobhistory.sql_message_id,
sysjobhistory.sql_severity, sysjobhistory.message, sysjobhistory.run_status, sysjobhistory.run_date, sysjobhistory.run_time, sysjobhistory.run_duration,
sysjobhistory.retries_attempted, sysjobhistory.server
FROM sysjobhistory INNER JOIN
sysjobs ON sysjobhistory.job_id = sysjobs.job_id
WHERE (sysjobhistory.run_date = 20150616) AND (sysjobs.name LIKE N'BI Pop%')
USE MSDB
Go
SELECT DISTINCT
sysjobs.name, sysjobhistory.instance_id, sysjobhistory.step_id, sysjobhistory.step_name, sysjobhistory.message, sysjobhistory.run_status,
sysjobhistory.run_date, sysjobhistory.run_time, sysjobhistory.run_duration, sysjobhistory.server
FROM sysjobhistory INNER JOIN
sysjobs ON sysjobhistory.job_id = sysjobs.job_id
WHERE (sysjobhistory.run_date = 20151123) AND (sysjobhistory.run_time >= 190000) AND (sysjobhistory.run_time <= 193000)
ORDER BY sysjobhistory.run_time DESC
0 Comments:
Post a Comment
<< Home