8

About once a week the query sp_Blitz @IgnorePrioritiesAbove = 50, @CheckUserDatabaseObjects = 0 shows "errors" with DB backups that are very old.

It's correct to show this, but is it possible to filter this error in case of availability group DB's which are on a secondary node and are not backed up (I'm using Ola's scripts to backup the DBs)?

Philᵀᴹ
  • 31,952
  • 10
  • 86
  • 108

2 Answers2

13

Yes, you can use the @SkipChecks parameters for this. Create a table with columns for:

  • DatabaseName NVARCHAR(128)
  • CheckID INT
  • ServerName NVARCHAR(128)

Then populate it with the list of databases & checks you want skipped. For example, if you want check 52 skipped for all databases, add a row with CheckID 52, and databasename null. If you want check 52 only skipped for the WebSite database, add a row with DatabaseName = WebSite, CheckID = 52.

Then when you run sp_Blitz, populate these parameters:

  • @SkipChecksDatabase - the database where your SkipChecks table lives, like DBAtools
  • @SkipChecksSchema - the schema, like dbo
  • @SkipChecksTable - the name of the SkipChecks table (could be BlitzSkipChecks for example)
Brent Ozar
  • 43,325
  • 51
  • 233
  • 390
0

OK, thank you Brent, I did like this to be more generic

************
    IF (SELECT COUNT(*) FROM sys.dm_hadr_database_replica_states WHERE is_primary_replica = 0 AND is_local = 1) > 0
    BEGIN
        CREATE Table #BlitzSkipChecks
            (
            DatabaseName NVARCHAR(128),
            CheckID INT,
            ServerName NVARCHAR(128)
            )

        INSERT INTO #BlitzSkipChecks VALUES (NULL,1,@@SERVERNAME)
        INSERT INTO #BlitzSkipChecks VALUES (NULL,2,@@SERVERNAME)

        EXEC sp_Blitz 
            @IgnorePrioritiesAbove = 50, 
            @CheckUserDatabaseObjects = 0, 
            @SkipChecksDatabase = 'master', 
            @SkipChecksSchema = 'dbo', 
            @SkipChecksTable = '#BlitzSkipChecks'

        DROP Table #BlitzSkipChecks
    END
ELSE
    EXEC sp_Blitz 
            @IgnorePrioritiesAbove = 50, 
            @CheckUserDatabaseObjects = 0

******************

It's a few hundreds lines no more visible :-)