BrentOzarULTD / SQL-Server-First-Responder-Kit

sp_Blitz, sp_BlitzCache, sp_BlitzFirst, sp_BlitzIndex, and other SQL Server scripts for health checks and performance tuning.
http://FirstResponderKit.org
Other
3.38k stars 1k forks source link

sp_Blitz: Fix checks 191 and 73 #3575

Closed Tisit closed 1 month ago

Tisit commented 2 months ago

Check 73 - No Failsafe Operator Configured

This check currently works only when user has EXECUTE on [master].[dbo].[sp_MSgetalertinfo] and does NOT have sa. Changed to check for permissions on sp_MSgetalertinfo in case the user isn't sa

Check 191 - Mismatch between the number of TempDB files in sys.master_files versus tempdb.sys.database_files

User not having sa may get this incorrectly since sys.master_files may return 0 rows for tempdb, while tempdb.sys.database_files returns the right number of rows. Reading through this article it seems normally sys.master_files = tempdb.sys.database_files. When there are problems sys.master_files > tempdb.sys.database_files. So state where sys.master_files < tempdb.sys.database_files is invalid because we don't see all the rows. Based on this I changed comparision between those tables from <> to >. Kinda stupid, but I feel how SQL Server works here is stupid too.

BrentOzar commented 1 month ago

Thanks for the pull request, but a couple of notes:

I'm going to close this, but you can definitely submit issues & pull requests going forward. Thanks for understanding, and sorry about the delay!