You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Version of the script
Version: 8.16
VersionDate: 20230820
What is the current behavior?
If the user is not part of the sysadmin group @sa gets set to 0: SET @sa = 0; /*Setting this to 0 to skip DBCC COMMANDS*/
This later ensures that check 68 and 69 are added to #SkipChecks
INSERT #SkipChecks (DatabaseName, CheckID, ServerName)
SELECT
v.*FROM (VALUES(NULL, 68, NULL)) AS v (DatabaseName, CheckID, ServerName) /*DBCC command*/WHERE @sa =0;
INSERT #SkipChecks (DatabaseName, CheckID, ServerName)
SELECT
v.*FROM (VALUES(NULL, 69, NULL)) AS v (DatabaseName, CheckID, ServerName) /*DBCC command*/WHERE @sa =0;
But the code checking if DDBC DBInfo can be run has a logical error in it:
--Reformated for readablity/*Check 233 is not in #BlitzResultsCheck 2 is not in #SkipChecksCheck 68 is in #SkipChecks*/IFNOTEXISTS
(
SELECT1FROM #BlitzResults
WHERE CheckID =223ANDURL='https://aws.amazon.com/rds/sqlserver/')
AND
(
NOTEXISTS
(
SELECT1FROM #SkipChecks
WHERE DatabaseName ISNULLAND CheckID =2
) ORNOTEXISTS
(
SELECT1FROM #SkipChecks
WHERE DatabaseName ISNULLAND CheckID =68
)
)
If the current behavior is a bug, please provide the steps to reproduce.
Make a user that is not sysadmin but has VIEW SERVER STATE rights, and doesn't have read rights in some of the system databases
Execute sp_blitz:
Extracting DBCC DBINFO data (used in checks 2 and 68).
Msg 2571, Level 14, State 1, Line 9909
User 'guest' does not have permission to run DBCC DBInfo.
Msg 2571, Level 14, State 1, Line 9909
User 'guest' does not have permission to run DBCC DBInfo.
Msg 2571, Level 14, State 1, Line 9909
User 'guest' does not have permission to run DBCC DBInfo.
Msg 2571, Level 14, State 1, Line 9909
User 'SomeUser' does not have permission to run DBCC DBInfo.
Msg 2571, Level 14, State 1, Line 9909
User 'SomeUser' does not have permission to run DBCC DBInfo.
What is the expected behavior?
The DBCC DBInfo is properly excluded if the user is not SA
The text was updated successfully, but these errors were encountered:
The current code works if both 2 and 68 are in de #SkipChecks, also the errors aren't fatal and the procedure will continue to run.
Montro1981
changed the title
[sp_Blitz] DDBC dbinfo fires even if CheckID 68 and/or 2 are in #SkipChecks
[sp_Blitz] DDBC dbinfo fires even if CheckID 68 or 2 is in #SkipChecks
Sep 22, 2023
Montro1981
changed the title
[sp_Blitz] DDBC dbinfo fires even if CheckID 68 or 2 is in #SkipChecks
[sp_Blitz] DBCC dbinfo fires even if CheckID 68 or 2 is in #SkipChecks
Sep 22, 2023
Montro1981
added a commit
to Montro1981/SQL-Server-First-Responder-Kit
that referenced
this issue
Sep 26, 2023
Thanks for the pull request! Wow, the logic in the original one makes my head hurt. Merging into the dev branch, will be in the next release with credit to you in the release notes.
Version of the script
Version: 8.16
VersionDate: 20230820
What is the current behavior?
If the user is not part of the sysadmin group
@sa
gets set to 0:SET @sa = 0; /*Setting this to 0 to skip DBCC COMMANDS*/
This later ensures that check 68 and 69 are added to #SkipChecks
But the code checking if
DDBC DBInfo
can be run has a logical error in it:If the current behavior is a bug, please provide the steps to reproduce.
Make a user that is not sysadmin but has VIEW SERVER STATE rights, and doesn't have read rights in some of the system databases
Execute sp_blitz:
And you'll get these errors:
What is the expected behavior?
The DBCC DBInfo is properly excluded if the user is not SA
The text was updated successfully, but these errors were encountered: