T-SQL Tuesday #186 - Agent Job History Visualization
I’m hosting T-SQL Tuesday this month and our topic is Managing SQL Agent Jobs. In this post, we’ll be taking a look at a very handy combination of dbatools
functions for looking at agent job schedules & performance.
Getting Job History
If you don’t have a monitoring suite watching SQL Agent, or you want to get a bigger picture view of when and how your Agent jobs are running, dbatools
can help you shortcut getting this information. Get-DbaAgentJobHistory
does exactly what its name suggests - it fetches the execution history for one or more Agent jobs on one or more SQL Server instances. Thing is…it can produce a lot of output if you’re not careful. By default, it’ll return the entire job history, with at least two objects per job execution. For example, this is the partial output of Get-DbaAgentJobHistory -SqlInstance localhost\sql19
: