Question

I'm an accidental DBA here,

I am attempting to create a SQL Agent Job that will capture the data for sp_blitzFirst. My goal is to start using the PowerBI dashboard to help show our pain points to management.

When I run the SQL code below, it outputs the data to my tables, but when I run it as a SQL Job, it does nothing. The job succeeds without any errors codes.

EXEC sp_BlitzFirst 
  @OutputDatabaseName = 'DBATOOLS', 
  @OutputSchemaName = 'dbo', 
  @OutputTableName = 'BlitzFirst',
  @OutputTableNameFileStats = 'BlitzFirst_FileStats',
  @OutputTableNamePerfmonStats = 'BlitzFirst_PerfmonStats',
  @OutputTableNameWaitStats = 'BlitzFirst_WaitStats',
  @OutputTableNameBlitzCache = 'BlitzCache',
  @OutputTableNameBlitzWho = 'BlitzWho';

Here is the output from the task:

Message
Executed as user: NT SERVICE\SQLSERVERAGENT. Setting up configuration variables [SQLSTATE 01000] (Message 50000)  
Now starting diagnostic analysis [SQLSTATE 01000] (Message 50000)  
Checking for Read intent databases to exclude [SQLSTATE 01000] (Message 50000)  
Capturing first pass of wait stats, perfmon counters, file stats [SQLSTATE 01000] (Message 50000)  
Beginning investigatory queries [SQLSTATE 01000] (Message 50000)  
Warning: The join order has been enforced because a local join hint is used. [SQLSTATE 01000] (Message 8625)  
Warning: The join order has been enforced because a local join hint is used. [SQLSTATE 01000] (Message 8625)  
Finished running investigatory queries [SQLSTATE 01000] (Message 50000)  Waiting to match @Seconds parameter [SQLSTATE 01000] (Message 50000)  
Capturing second pass of wait stats, perfmon counters, file stats [SQLSTATE 01000] (Message 50000)  
Analyzing changes between first and second passes of DMVs [SQLSTATE 01000] (Message 50000)  
Analysis finished, outputting results [SQLSTATE 01000] (Message 50000).  
The step succeeded.

Any help in the right direction would be appreciated.

Thanks!

Was it helpful?

Solution

Moving the answer from the comments:

When this happens, start by double-checking the contents of your Agent job, and make sure it exactly matches the command you're running manually.

In this case, the text of the Agent job was calling for a different database name - one that didn't exist - so it was skipping the logging portion. Right now, if you call it with a database name that doesn't exist, it doesn't fail hard. It probably should - if you want to file a Github issue for that at http://FirstResponderKit.org, I can add that.

Licensed under: CC-BY-SA with attribution
Not affiliated with dba.stackexchange
scroll top