Skip to content

Commit 4fdcad4

Browse files
authored
Merge pull request #1085 from BrentOzarULTD/issue_1082/brent
#1082 sp_Blitz warn if CheckUserDatabaseObjects was disabled
2 parents 1ee7cdf + c0f9197 commit 4fdcad4

File tree

2 files changed

+29
-0
lines changed

2 files changed

+29
-0
lines changed

Documentation/sp_Blitz Checks by Priority.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ If you want to change anything about a check - the priority, finding, URL, or ID
99
| Priority | FindingsGroup | Finding | URL | CheckID |
1010
|----------|-----------------------------|---------------------------------------------------------|------------------------------------------------------------------------|----------|
1111
| 0 | Outdated sp_Blitz | sp_Blitz is Over 6 Months Old | https://www.BrentOzar.com/blitz/ | 155 |
12+
| 0 | Informational | @CheckUserDatabaseObjects Disabled | https://www.BrentOzar.com/blitz/ | 201 |
1213
| 1 | Backup | Backing Up to Same Drive Where Databases Reside | https://www.BrentOzar.com/go/backup | 93 |
1314
| 1 | Backup | Backups Not Performed Recently | https://www.BrentOzar.com/go/nobak | 1 |
1415
| 1 | Backup | Full Recovery Mode w/o Log Backups | https://www.BrentOzar.com/go/biglogs | 2 |

sp_Blitz.sql

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -250,6 +250,20 @@ AS
250250
PRINT 'The database-level checks rely on CTEs, which are not supported in SQL 2000 compat level databases.';
251251
PRINT 'Get with the cool kids and switch to a current compatibility level, Grandpa. To find the problems, run:';
252252
PRINT 'SELECT * FROM sys.databases WHERE compatibility_level < 90;';
253+
INSERT INTO #BlitzResults
254+
( CheckID ,
255+
Priority ,
256+
FindingsGroup ,
257+
Finding ,
258+
URL ,
259+
Details
260+
)
261+
SELECT 201 AS CheckID ,
262+
0 AS Priority ,
263+
'Informational' AS FindingsGroup ,
264+
'@CheckUserDatabaseObjects Disabled' AS Finding ,
265+
'https://www.BrentOzar.com/blitz/' AS URL ,
266+
'Since you have databases with compatibility_level < 90, we can''t run @CheckUserDatabaseObjects = 1. To find them: SELECT * FROM sys.databases WHERE compatibility_level < 90' AS Details;
253267
END;
254268

255269

@@ -584,6 +598,20 @@ AS
584598
SET @CheckUserDatabaseObjects = 0;
585599
PRINT 'Running sp_Blitz @CheckUserDatabaseObjects = 1 on a server with 50+ databases may cause temporary insanity for the server and/or user.';
586600
PRINT 'If you''re sure you want to do this, run again with the parameter @BringThePain = 1.';
601+
INSERT INTO #BlitzResults
602+
( CheckID ,
603+
Priority ,
604+
FindingsGroup ,
605+
Finding ,
606+
URL ,
607+
Details
608+
)
609+
SELECT 201 AS CheckID ,
610+
0 AS Priority ,
611+
'Informational' AS FindingsGroup ,
612+
'@CheckUserDatabaseObjects Disabled' AS Finding ,
613+
'https://www.BrentOzar.com/blitz/' AS URL ,
614+
'If you want to check 50+ databases, you have to also use @BringThePain = 1.' AS Details;
587615
END;
588616

589617
/* Sanitize our inputs */

0 commit comments

Comments
 (0)