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)?

2 Answers 2

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)
1
  • Brent - Who knows "Brent Ozar First Responder Kit" better than the one and only... "Brent Ozar"! Trick question, but maybe you'd say "Kendra Little". . . j/k. Sep 19, 2016 at 22:52
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 :-)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.