1、背景
下面是从以往Profiler收集的跟踪文件中提取Job有关数据
;with cte as( select b.Name EventClass,TextData,DatabaseName,Duration/1000 Duration_ms ,CPU CPU_ms,Reads,Writes,StartTime,EndTime,HostName,LoginName,ApplicationName ,row_number() over(partition by ApplicationName order by CPU desc) rankid from fn_trace_gettable(N'F:\TroubleShooting\Trace\InstanceName_HighCPU40_20160907.trc', 1) a inner join sys.trace_events b on a.EventClass=b.trace_event_id where ApplicationName like '%SQLAgent - TSQL JobStep%' ) select * from cte where rankid=1 order by CPU_ms desc