From 26f701c83253307d3d74fb16034d566fc23d7203 Mon Sep 17 00:00:00 2001 From: Martin van der Boom Date: Wed, 11 Oct 2023 14:42:27 +0200 Subject: [PATCH 01/33] #3377 Added a check for sp_MSgetalertinfo --- sp_Blitz.sql | 61 ++++++++++++++++++++++++++++++++++++++-------------- 1 file changed, 45 insertions(+), 16 deletions(-) diff --git a/sp_Blitz.sql b/sp_Blitz.sql index 08a6ca91..26d90bfc 100644 --- a/sp_Blitz.sql +++ b/sp_Blitz.sql @@ -200,6 +200,7 @@ AS ,@SkipModel bit = 0 ,@SkipTempDB bit = 0 ,@SkipValidateLogins bit = 0 + ,@SkipGetAlertInfo bit = 0 /* Variables for check 211: */ ,@powerScheme varchar(36) ,@cpu_speed_mhz int @@ -229,6 +230,23 @@ AS /* End of declarations for First Responder Kit consistency check:*/ ; + /* Create temp table for check 73 */ + IF OBJECT_ID('tempdb..#AlertInfo') IS NOT NULL + EXEC sp_executesql N'DROP TABLE #AlertInfo;'; + + CREATE TABLE #AlertInfo + ( + FailSafeOperator NVARCHAR(255) , + NotificationMethod INT , + ForwardingServer NVARCHAR(255) , + ForwardingSeverity INT , + PagerToTemplate NVARCHAR(255) , + PagerCCTemplate NVARCHAR(255) , + PagerSubjectTemplate NVARCHAR(255) , + PagerSendSubjectOnly NVARCHAR(255) , + ForwardAlways INT + ); + /* Create temp table for check 2301 */ IF OBJECT_ID('tempdb..#InvalidLogins') IS NOT NULL EXEC sp_executesql N'DROP TABLE #InvalidLogins;'; @@ -350,6 +368,20 @@ AS END CATCH; END; /*Need execute on sp_validatelogins*/ + IF ISNULL(@SkipGetAlertInfo, 0) != 1 /*If @SkipGetAlertInfo hasn't been set to 1 by the caller*/ + BEGIN + BEGIN TRY + /* Try to fill the table for check 73 */ + INSERT INTO #AlertInfo + EXEC [master].[dbo].[sp_MSgetalertinfo] @includeaddresses = 0; + + SET @SkipGetAlertInfo = 0; /*We can execute sp_MSgetalertinfo*/ + END TRY + BEGIN CATCH + SET @SkipGetAlertInfo = 1; /*We have don't have execute rights or sp_MSgetalertinfo throws an error so skip it*/ + END CATCH; + END; /*Need execute on sp_MSgetalertinfo*/ + IF ISNULL(@SkipModel, 0) != 1 /*If @SkipModel hasn't been set to 1 by the caller*/ BEGIN IF EXISTS @@ -628,7 +660,13 @@ AS SELECT v.* FROM (VALUES(NULL, 2301, NULL)) AS v (DatabaseName, CheckID, ServerName) /*sp_validatelogins*/ - WHERE @SkipValidateLogins = 1 + WHERE @SkipValidateLogins = 1; + + INSERT #SkipChecks (DatabaseName, CheckID, ServerName) + SELECT + v.* + FROM (VALUES(NULL, 73, NULL)) AS v (DatabaseName, CheckID, ServerName) /*sp_validatelogins*/ + WHERE @SkipGetAlertInfo = 1; IF @SkipChecksTable IS NOT NULL AND @SkipChecksSchema IS NOT NULL @@ -8181,20 +8219,6 @@ IF @ProductVersionMajor >= 10 IF @Debug IN (1, 2) RAISERROR('Running CheckId [%d].', 0, 1, 73) WITH NOWAIT; - DECLARE @AlertInfo TABLE - ( - FailSafeOperator NVARCHAR(255) , - NotificationMethod INT , - ForwardingServer NVARCHAR(255) , - ForwardingSeverity INT , - PagerToTemplate NVARCHAR(255) , - PagerCCTemplate NVARCHAR(255) , - PagerSubjectTemplate NVARCHAR(255) , - PagerSendSubjectOnly NVARCHAR(255) , - ForwardAlways INT - ); - INSERT INTO @AlertInfo - EXEC [master].[dbo].[sp_MSgetalertinfo] @includeaddresses = 0; INSERT INTO #BlitzResults ( CheckID , Priority , @@ -8209,7 +8233,7 @@ IF @ProductVersionMajor >= 10 'No Failsafe Operator Configured' AS Finding , 'https://www.brentozar.com/go/failsafe' AS URL , ( 'No failsafe operator is configured on this server. This is a good idea just in-case there are issues with the [msdb] database that prevents alerting.' ) AS Details - FROM @AlertInfo + FROM #AlertInfo WHERE FailSafeOperator IS NULL; END; @@ -9957,6 +9981,11 @@ IF @ProductVersionMajor >= 10 AND NOT EXISTS ( SELECT 1 EXEC sp_executesql N'DROP TABLE #InvalidLogins;'; END; + IF OBJECT_ID('tempdb..#AlertInfo') IS NOT NULL + BEGIN + EXEC sp_executesql N'DROP TABLE #AlertInfo;'; + END; + /* Reset the Nmumeric_RoundAbort session state back to enabled if it was disabled earlier. See Github issue #2302 for more info. From 103ea3f43ff8463b2c0e3bf0bcfa44ff6d3fb48b Mon Sep 17 00:00:00 2001 From: Henrik Staun Poulsen Date: Mon, 13 Nov 2023 13:20:56 +0000 Subject: [PATCH 02/33] added #h and #os tables --- sp_BlitzIndex.sql | 282 +++++++++++++++++++++++++++++++++++++++------- 1 file changed, 244 insertions(+), 38 deletions(-) diff --git a/sp_BlitzIndex.sql b/sp_BlitzIndex.sql index bb23c2ee..26dd93b4 100644 --- a/sp_BlitzIndex.sql +++ b/sp_BlitzIndex.sql @@ -38,7 +38,7 @@ ALTER PROCEDURE dbo.sp_BlitzIndex @SortOrder NVARCHAR(50) = NULL, /* Only affects @Mode = 2. */ @SortDirection NVARCHAR(4) = 'DESC', /* Only affects @Mode = 2. */ @Help TINYINT = 0, - @Debug BIT = 0, + @Debug BIT =0, @Version VARCHAR(30) = NULL OUTPUT, @VersionDate DATETIME = NULL OUTPUT, @VersionCheckMode BIT = 0 @@ -105,7 +105,7 @@ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. '; -RETURN; +return; END; /* @Help = 1 */ DECLARE @ScriptVersionName NVARCHAR(50); @@ -253,9 +253,14 @@ IF OBJECT_ID('tempdb..#CheckConstraints') IS NOT NULL IF OBJECT_ID('tempdb..#FilteredIndexes') IS NOT NULL DROP TABLE #FilteredIndexes; - + IF OBJECT_ID('tempdb..#Ignore_Databases') IS NOT NULL DROP TABLE #Ignore_Databases + +IF OBJECT_ID('tempdb..#H') IS NOT NULL + DROP TABLE #H +IF OBJECT_ID('tempdb..#OS') IS NOT NULL + DROP TABLE #OS RAISERROR (N'Create temp tables.',0,1) WITH NOWAIT; CREATE TABLE #BlitzIndexResults @@ -1065,6 +1070,8 @@ FROM sys.databases ---------------------------------------- BEGIN TRY BEGIN + declare @d varchar(19) = convert(varchar(19), getdate(), 121); + RAISERROR (N'starting at %s',0,1, @d) WITH NOWAIT; --Validate SQL Server Version @@ -1160,7 +1167,7 @@ BEGIN TRY --insert columns for clustered indexes and heaps --collect info on identity columns for this one SET @dsql = N'/* sp_BlitzIndex */ - SET LOCK_TIMEOUT 1000; /* To fix locking bug in sys.identity_columns. See Github issue #2176. */ + --SET LOCK_TIMEOUT 10000; /* To fix locking bug in sys.identity_columns. See Github issue #2176. */ SET TRANSACTION ISOLATION LEVEL READ UNCOMMITTED; SELECT ' + CAST(@DatabaseID AS NVARCHAR(16)) + ', s.name, @@ -1435,40 +1442,100 @@ BEGIN TRY --NOTE: If you want to use the newer syntax for 2012+, you'll have to change 2147483647 to 11 on line ~819 --This change was made because on a table with lots of paritions, the OUTER APPLY was crazy slow. - SET @dsql = N'SET TRANSACTION ISOLATION LEVEL READ UNCOMMITTED; +DROP TABLE if exists #h +create table #h +( + database_id smallint not null + , object_id int not null + , sname sysname NULL + , index_id int + , partition_number int + , partition_id bigint + , row_count bigint + , reserved_MB bigint + , reserved_LOB_MB bigint + , reserved_row_overflow_MB bigint + , lock_escalation_desc varchar(1000)/*?*/ + , data_compression_desc varchar(100)/*?*/ + , reserved_dictionary_MB bigint +) +drop TABLE if exists #os +create table #os +( + database_id smallint not null + , object_id int not null + , index_id int + , partition_number int + , hobt_id bigint + , leaf_insert_count bigint + , leaf_delete_count bigint + , leaf_update_count bigint + , leaf_ghost_count bigint + , nonleaf_insert_count bigint + , nonleaf_delete_count bigint + , nonleaf_update_count bigint + , leaf_allocation_count bigint + , nonleaf_allocation_count bigint + , leaf_page_merge_count bigint + , nonleaf_page_merge_count bigint + , range_scan_count bigint + , singleton_lookup_count bigint + , forwarded_fetch_count bigint + , lob_fetch_in_pages bigint + , lob_fetch_in_bytes bigint + , lob_orphan_create_count bigint + , lob_orphan_insert_count bigint + , row_overflow_fetch_in_pages bigint + , row_overflow_fetch_in_bytes bigint + , column_value_push_off_row_count bigint + , column_value_pull_in_row_count bigint + , row_lock_count bigint + , row_lock_wait_count bigint + , row_lock_wait_in_ms bigint + , page_lock_count bigint + , page_lock_wait_count bigint + , page_lock_wait_in_ms bigint + , index_lock_promotion_attempt_count bigint + , index_lock_promotion_count bigint + , page_latch_wait_count bigint + , page_latch_wait_in_ms bigint + , page_io_latch_wait_count bigint + , page_io_latch_wait_in_ms bigint + , tree_page_latch_wait_count bigint + , tree_page_latch_wait_in_ms bigint + , tree_page_io_latch_wait_count bigint + , tree_page_io_latch_wait_in_ms bigint + , page_compression_attempt_count bigint + , page_compression_success_count bigint + , version_generated_inrow bigint + , version_generated_offrow bigint + , ghost_version_inrow bigint + , ghost_version_offrow bigint + , insert_over_ghost_version_inrow bigint + , insert_over_ghost_version_offrow bigint + ) + + SET @dsql = N' + declare @d varchar(19) = convert(varchar(19), getdate(), 121) + RAISERROR (N''start getting data into #h at %s'',0,1, @d) WITH NOWAIT; + SET TRANSACTION ISOLATION LEVEL READ UNCOMMITTED; + insert into #h + ( + database_id, object_id, sname, index_id, partition_number, partition_id, row_count, reserved_MB, reserved_LOB_MB, reserved_row_overflow_MB, lock_escalation_desc, data_compression_desc, reserved_dictionary_MB + ) SELECT ' + CAST(@DatabaseID AS NVARCHAR(10)) + N' AS database_id, ps.object_id, - s.name, + s.name as sname, ps.index_id, ps.partition_number, + ps.partition_id, ps.row_count, ps.reserved_page_count * 8. / 1024. AS reserved_MB, ps.lob_reserved_page_count * 8. / 1024. AS reserved_LOB_MB, ps.row_overflow_reserved_page_count * 8. / 1024. AS reserved_row_overflow_MB, le.lock_escalation_desc, ' + CASE WHEN @SQLServerProductVersion NOT LIKE '9%' THEN N'par.data_compression_desc ' ELSE N'null as data_compression_desc ' END + N', - SUM(os.leaf_insert_count), - SUM(os.leaf_delete_count), - SUM(os.leaf_update_count), - SUM(os.range_scan_count), - SUM(os.singleton_lookup_count), - SUM(os.forwarded_fetch_count), - SUM(os.lob_fetch_in_pages), - SUM(os.lob_fetch_in_bytes), - SUM(os.row_overflow_fetch_in_pages), - SUM(os.row_overflow_fetch_in_bytes), - SUM(os.row_lock_count), - SUM(os.row_lock_wait_count), - SUM(os.row_lock_wait_in_ms), - SUM(os.page_lock_count), - SUM(os.page_lock_wait_count), - SUM(os.page_lock_wait_in_ms), - SUM(os.index_lock_promotion_attempt_count), - SUM(os.index_lock_promotion_count), - SUM(os.page_latch_wait_count), - SUM(os.page_latch_wait_in_ms), - SUM(os.page_io_latch_wait_count), - SUM(os.page_io_latch_wait_in_ms), '; +'; /* Get columnstore dictionary size - more info: https://github.com/BrentOzarULTD/SQL-Server-First-Responder-Kit/issues/2585 */ IF EXISTS (SELECT * FROM sys.all_objects WHERE name = 'column_store_dictionaries') @@ -1484,9 +1551,6 @@ BEGIN TRY AND so.is_ms_shipped = 0 /*Exclude objects shipped by Microsoft*/ AND so.type <> ''TF'' /*Exclude table valued functions*/ JOIN ' + QUOTENAME(@DatabaseName) + N'.sys.schemas AS s ON s.schema_id = so.schema_id - LEFT JOIN ' + QUOTENAME(@DatabaseName) + N'.sys.dm_db_index_operational_stats(' - + CAST(@DatabaseID AS NVARCHAR(10)) + N', NULL, NULL,NULL) AS os ON - ps.object_id=os.object_id and ps.index_id=os.index_id and ps.partition_number=os.partition_number OUTER APPLY (SELECT st.lock_escalation_desc FROM ' + QUOTENAME(@DatabaseName) + N'.sys.tables st WHERE st.object_id = ps.object_id @@ -1506,7 +1570,123 @@ BEGIN TRY le.lock_escalation_desc, ' + CASE WHEN @SQLServerProductVersion NOT LIKE '9%' THEN N'par.data_compression_desc ' ELSE N'null as data_compression_desc ' END + N' ORDER BY ps.object_id, ps.index_id, ps.partition_number - OPTION ( RECOMPILE ); + /*OPTION ( RECOMPILE );*/ + OPTION ( RECOMPILE , min_grant_percent = 1); + + set @d = convert(varchar(19), getdate(), 121) + RAISERROR (N''start getting data into #os at %s.'',0,1, @d) WITH NOWAIT; + + insert into #os + ( + database_id + , object_id + , index_id + , partition_number + , hobt_id + , leaf_insert_count + , leaf_delete_count + , leaf_update_count + , leaf_ghost_count + , nonleaf_insert_count + , nonleaf_delete_count + , nonleaf_update_count + , leaf_allocation_count + , nonleaf_allocation_count + , leaf_page_merge_count + , nonleaf_page_merge_count + , range_scan_count + , singleton_lookup_count + , forwarded_fetch_count + , lob_fetch_in_pages + , lob_fetch_in_bytes + , lob_orphan_create_count + , lob_orphan_insert_count + , row_overflow_fetch_in_pages + , row_overflow_fetch_in_bytes + , column_value_push_off_row_count + , column_value_pull_in_row_count + , row_lock_count + , row_lock_wait_count + , row_lock_wait_in_ms + , page_lock_count + , page_lock_wait_count + , page_lock_wait_in_ms + , index_lock_promotion_attempt_count + , index_lock_promotion_count + , page_latch_wait_count + , page_latch_wait_in_ms + , page_io_latch_wait_count + , page_io_latch_wait_in_ms + , tree_page_latch_wait_count + , tree_page_latch_wait_in_ms + , tree_page_io_latch_wait_count + , tree_page_io_latch_wait_in_ms + , page_compression_attempt_count + , page_compression_success_count + , version_generated_inrow + , version_generated_offrow + , ghost_version_inrow + , ghost_version_offrow + , insert_over_ghost_version_inrow + , insert_over_ghost_version_offrow + ) + + select os.database_id + , os.object_id + , os.index_id + , os.partition_number + , os.hobt_id + , os.leaf_insert_count + , os.leaf_delete_count + , os.leaf_update_count + , os.leaf_ghost_count + , os.nonleaf_insert_count + , os.nonleaf_delete_count + , os.nonleaf_update_count + , os.leaf_allocation_count + , os.nonleaf_allocation_count + , os.leaf_page_merge_count + , os.nonleaf_page_merge_count + , os.range_scan_count + , os.singleton_lookup_count + , os.forwarded_fetch_count + , os.lob_fetch_in_pages + , os.lob_fetch_in_bytes + , os.lob_orphan_create_count + , os.lob_orphan_insert_count + , os.row_overflow_fetch_in_pages + , os.row_overflow_fetch_in_bytes + , os.column_value_push_off_row_count + , os.column_value_pull_in_row_count + , os.row_lock_count + , os.row_lock_wait_count + , os.row_lock_wait_in_ms + , os.page_lock_count + , os.page_lock_wait_count + , os.page_lock_wait_in_ms + , os.index_lock_promotion_attempt_count + , os.index_lock_promotion_count + , os.page_latch_wait_count + , os.page_latch_wait_in_ms + , os.page_io_latch_wait_count + , os.page_io_latch_wait_in_ms + , os.tree_page_latch_wait_count + , os.tree_page_latch_wait_in_ms + , os.tree_page_io_latch_wait_count + , os.tree_page_io_latch_wait_in_ms + , os.page_compression_attempt_count + , os.page_compression_success_count + , os.version_generated_inrow + , os.version_generated_offrow + , os.ghost_version_inrow + , os.ghost_version_offrow + , os.insert_over_ghost_version_inrow + , os.insert_over_ghost_version_offrow + from ' + QUOTENAME(@DatabaseName) + N'.sys.dm_db_index_operational_stats('+ CAST(@DatabaseID AS NVARCHAR(10)) +', NULL, NULL,NULL) AS os + OPTION ( RECOMPILE , min_grant_percent = 1); + + set @d = convert(varchar(19), getdate(), 121) + RAISERROR (N''finished getting data into #os at %s.'',0,1, @d) WITH NOWAIT; '; END; ELSE @@ -1605,6 +1785,7 @@ BEGIN TRY PRINT SUBSTRING(@dsql, 32000, 36000); PRINT SUBSTRING(@dsql, 36000, 40000); END; + EXEC sp_executesql @dsql; INSERT #IndexPartitionSanity ( [database_id], [object_id], [schema_name], @@ -1639,8 +1820,35 @@ BEGIN TRY page_io_latch_wait_count, page_io_latch_wait_in_ms, reserved_dictionary_MB) - EXEC sp_executesql @dsql; - + select h.database_id, h.object_id, h.sname, h.index_id, h.partition_number, h.row_count, h.reserved_MB, h.reserved_LOB_MB, h.reserved_row_overflow_MB, h.lock_escalation_desc, h.data_compression_desc, + SUM(os.leaf_insert_count), + SUM(os.leaf_delete_count), + SUM(os.leaf_update_count), + SUM(os.range_scan_count), + SUM(os.singleton_lookup_count), + SUM(os.forwarded_fetch_count), + SUM(os.lob_fetch_in_pages), + SUM(os.lob_fetch_in_bytes), + SUM(os.row_overflow_fetch_in_pages), + SUM(os.row_overflow_fetch_in_bytes), + SUM(os.row_lock_count), + SUM(os.row_lock_wait_count), + SUM(os.row_lock_wait_in_ms), + SUM(os.page_lock_count), + SUM(os.page_lock_wait_count), + SUM(os.page_lock_wait_in_ms), + SUM(os.index_lock_promotion_attempt_count), + SUM(os.index_lock_promotion_count), + SUM(os.page_latch_wait_count), + SUM(os.page_latch_wait_in_ms), + SUM(os.page_io_latch_wait_count), + SUM(os.page_io_latch_wait_in_ms) + ,COALESCE((SELECT SUM (dict.on_disk_size / 1024.0 / 1024) FROM [DataWarehouse].sys.column_store_dictionaries dict WHERE dict.partition_id = h.partition_id),0) AS reserved_dictionary_MB + from #h h + left JOIN #os as os ON + h.object_id=os.object_id and h.index_id=os.index_id and h.partition_number=os.partition_number + group by h.database_id, h.object_id, h.sname, h.index_id, h.partition_number, h.partition_id, h.row_count, h.reserved_MB, h.reserved_LOB_MB, h.reserved_row_overflow_MB, h.lock_escalation_desc, h.data_compression_desc + END; --End Check For @SkipPartitions = 0 @@ -2591,7 +2799,6 @@ SELECT FROM #IndexSanity; RAISERROR (N'Populate #PartitionCompressionInfo.',0,1) WITH NOWAIT; -IF OBJECT_ID('tempdb..#maps') IS NOT NULL DROP TABLE #maps; WITH maps AS ( @@ -2606,7 +2813,6 @@ SELECT * INTO #maps FROM maps; -IF OBJECT_ID('tempdb..#grps') IS NOT NULL DROP TABLE #grps; WITH grps AS ( @@ -6178,7 +6384,8 @@ BEGIN END; /* End @Mode=3 (index detail)*/ - + set @d = convert(varchar(19), getdate(), 121); + RAISERROR (N'finishing at %s',0,1, @d) WITH NOWAIT; END /* End @TableName IS NULL (mode 0/1/2/3/4) */ END TRY @@ -6197,4 +6404,3 @@ BEGIN CATCH RETURN; END CATCH; -GO From 3eee3ff94778741e0bd7adeabcdc26edfbc3b838 Mon Sep 17 00:00:00 2001 From: Henrik Staun Poulsen Date: Mon, 13 Nov 2023 14:55:02 +0100 Subject: [PATCH 03/33] Update sp_BlitzIndex.sql with #h and #os Update sp_BlitzIndex.sql with #h and #os to improve speed --- sp_BlitzIndex.sql | 21 ++++++++++++--------- 1 file changed, 12 insertions(+), 9 deletions(-) diff --git a/sp_BlitzIndex.sql b/sp_BlitzIndex.sql index 26dd93b4..90528e8c 100644 --- a/sp_BlitzIndex.sql +++ b/sp_BlitzIndex.sql @@ -38,7 +38,7 @@ ALTER PROCEDURE dbo.sp_BlitzIndex @SortOrder NVARCHAR(50) = NULL, /* Only affects @Mode = 2. */ @SortDirection NVARCHAR(4) = 'DESC', /* Only affects @Mode = 2. */ @Help TINYINT = 0, - @Debug BIT =0, + @Debug BIT = 0, @Version VARCHAR(30) = NULL OUTPUT, @VersionDate DATETIME = NULL OUTPUT, @VersionCheckMode BIT = 0 @@ -105,7 +105,7 @@ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. '; -return; +RETURN; END; /* @Help = 1 */ DECLARE @ScriptVersionName NVARCHAR(50); @@ -1070,7 +1070,7 @@ FROM sys.databases ---------------------------------------- BEGIN TRY BEGIN - declare @d varchar(19) = convert(varchar(19), getdate(), 121); + DECLARE @d VARCHAR(19) = CONVERT(VARCHAR(19), GETDATE(), 121); RAISERROR (N'starting at %s',0,1, @d) WITH NOWAIT; --Validate SQL Server Version @@ -1167,7 +1167,7 @@ BEGIN TRY --insert columns for clustered indexes and heaps --collect info on identity columns for this one SET @dsql = N'/* sp_BlitzIndex */ - --SET LOCK_TIMEOUT 10000; /* To fix locking bug in sys.identity_columns. See Github issue #2176. */ + SET LOCK_TIMEOUT 1000; /* To fix locking bug in sys.identity_columns. See Github issue #2176. */ SET TRANSACTION ISOLATION LEVEL READ UNCOMMITTED; SELECT ' + CAST(@DatabaseID AS NVARCHAR(16)) + ', s.name, @@ -1516,10 +1516,10 @@ create table #os ) SET @dsql = N' - declare @d varchar(19) = convert(varchar(19), getdate(), 121) + DECLARE @d VARCHAR(19) = CONVERT(VARCHAR(19), GETDATE(), 121) RAISERROR (N''start getting data into #h at %s'',0,1, @d) WITH NOWAIT; SET TRANSACTION ISOLATION LEVEL READ UNCOMMITTED; - insert into #h + INSERT INTO #h ( database_id, object_id, sname, index_id, partition_number, partition_id, row_count, reserved_MB, reserved_LOB_MB, reserved_row_overflow_MB, lock_escalation_desc, data_compression_desc, reserved_dictionary_MB ) @@ -1573,7 +1573,7 @@ create table #os /*OPTION ( RECOMPILE );*/ OPTION ( RECOMPILE , min_grant_percent = 1); - set @d = convert(varchar(19), getdate(), 121) + SET @d = CONVERT(VARCHAR(19), GETDATE(), 121) RAISERROR (N''start getting data into #os at %s.'',0,1, @d) WITH NOWAIT; insert into #os @@ -1685,7 +1685,7 @@ create table #os from ' + QUOTENAME(@DatabaseName) + N'.sys.dm_db_index_operational_stats('+ CAST(@DatabaseID AS NVARCHAR(10)) +', NULL, NULL,NULL) AS os OPTION ( RECOMPILE , min_grant_percent = 1); - set @d = convert(varchar(19), getdate(), 121) + SET @d = CONVERT(VARCHAR(19), GETDATE(), 121) RAISERROR (N''finished getting data into #os at %s.'',0,1, @d) WITH NOWAIT; '; END; @@ -2799,6 +2799,7 @@ SELECT FROM #IndexSanity; RAISERROR (N'Populate #PartitionCompressionInfo.',0,1) WITH NOWAIT; +IF OBJECT_ID('tempdb..#maps') IS NOT NULL DROP TABLE #maps; WITH maps AS ( @@ -2813,6 +2814,7 @@ SELECT * INTO #maps FROM maps; +IF OBJECT_ID('tempdb..#grps') IS NOT NULL DROP TABLE #grps; WITH grps AS ( @@ -6384,7 +6386,7 @@ BEGIN END; /* End @Mode=3 (index detail)*/ - set @d = convert(varchar(19), getdate(), 121); + SET @d = CONVERT(VARCHAR(19), GETDATE(), 121); RAISERROR (N'finishing at %s',0,1, @d) WITH NOWAIT; END /* End @TableName IS NULL (mode 0/1/2/3/4) */ END TRY @@ -6404,3 +6406,4 @@ BEGIN CATCH RETURN; END CATCH; +GO From e9887f5cd5ec7d4e8c7501bb11d84f7107dddeaf Mon Sep 17 00:00:00 2001 From: Henrik Staun Poulsen Date: Mon, 13 Nov 2023 21:49:29 +0100 Subject: [PATCH 04/33] removed hardcoded db name --- sp_BlitzIndex.sql | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/sp_BlitzIndex.sql b/sp_BlitzIndex.sql index 90528e8c..e84f3f46 100644 --- a/sp_BlitzIndex.sql +++ b/sp_BlitzIndex.sql @@ -1843,11 +1843,11 @@ create table #os SUM(os.page_latch_wait_in_ms), SUM(os.page_io_latch_wait_count), SUM(os.page_io_latch_wait_in_ms) - ,COALESCE((SELECT SUM (dict.on_disk_size / 1024.0 / 1024) FROM [DataWarehouse].sys.column_store_dictionaries dict WHERE dict.partition_id = h.partition_id),0) AS reserved_dictionary_MB + , h.reserved_dictionary_MB from #h h left JOIN #os as os ON h.object_id=os.object_id and h.index_id=os.index_id and h.partition_number=os.partition_number - group by h.database_id, h.object_id, h.sname, h.index_id, h.partition_number, h.partition_id, h.row_count, h.reserved_MB, h.reserved_LOB_MB, h.reserved_row_overflow_MB, h.lock_escalation_desc, h.data_compression_desc + group by h.database_id, h.object_id, h.sname, h.index_id, h.partition_number, h.partition_id, h.row_count, h.reserved_MB, h.reserved_LOB_MB, h.reserved_row_overflow_MB, h.lock_escalation_desc, h.data_compression_desc, h.reserved_dictionary_MB END; --End Check For @SkipPartitions = 0 From bf57b8d23410a4ef1e39460bc3d56e59b64ec926 Mon Sep 17 00:00:00 2001 From: Henrik Staun Poulsen Date: Mon, 25 Dec 2023 20:09:17 +0100 Subject: [PATCH 05/33] Update sp_BlitzIndex.sql with better #tmp table names Named the new tables #dm_db_partition_stats_etc and #dm_db_index_operational_stats Tested on a smaller db (27TB) where the new version runs in 3 seconds, and the old 11 seconds. Same output. I'll see if I can get a result set from the old version on the larger database, now that there are a couple of holidays. Previously I have given up after 11 hours. My new version ran in 3 hours. --- sp_BlitzIndex.sql | 184 +++++++++++++++++++++++----------------------- 1 file changed, 90 insertions(+), 94 deletions(-) diff --git a/sp_BlitzIndex.sql b/sp_BlitzIndex.sql index e84f3f46..7f7fa13e 100644 --- a/sp_BlitzIndex.sql +++ b/sp_BlitzIndex.sql @@ -257,10 +257,10 @@ IF OBJECT_ID('tempdb..#FilteredIndexes') IS NOT NULL IF OBJECT_ID('tempdb..#Ignore_Databases') IS NOT NULL DROP TABLE #Ignore_Databases -IF OBJECT_ID('tempdb..#H') IS NOT NULL - DROP TABLE #H -IF OBJECT_ID('tempdb..#OS') IS NOT NULL - DROP TABLE #OS +IF OBJECT_ID('tempdb..#dm_db_partition_stats_etc') IS NOT NULL + DROP TABLE #dm_db_partition_stats_etc +IF OBJECT_ID('tempdb..#dm_db_index_operational_stats') IS NOT NULL + DROP TABLE #dm_db_index_operational_stats RAISERROR (N'Create temp tables.',0,1) WITH NOWAIT; CREATE TABLE #BlitzIndexResults @@ -1442,86 +1442,89 @@ BEGIN TRY --NOTE: If you want to use the newer syntax for 2012+, you'll have to change 2147483647 to 11 on line ~819 --This change was made because on a table with lots of paritions, the OUTER APPLY was crazy slow. -DROP TABLE if exists #h -create table #h -( - database_id smallint not null - , object_id int not null - , sname sysname NULL - , index_id int - , partition_number int - , partition_id bigint - , row_count bigint - , reserved_MB bigint - , reserved_LOB_MB bigint - , reserved_row_overflow_MB bigint - , lock_escalation_desc varchar(1000)/*?*/ - , data_compression_desc varchar(100)/*?*/ - , reserved_dictionary_MB bigint -) -drop TABLE if exists #os -create table #os -( - database_id smallint not null - , object_id int not null - , index_id int - , partition_number int - , hobt_id bigint - , leaf_insert_count bigint - , leaf_delete_count bigint - , leaf_update_count bigint - , leaf_ghost_count bigint - , nonleaf_insert_count bigint - , nonleaf_delete_count bigint - , nonleaf_update_count bigint - , leaf_allocation_count bigint - , nonleaf_allocation_count bigint - , leaf_page_merge_count bigint - , nonleaf_page_merge_count bigint - , range_scan_count bigint - , singleton_lookup_count bigint - , forwarded_fetch_count bigint - , lob_fetch_in_pages bigint - , lob_fetch_in_bytes bigint - , lob_orphan_create_count bigint - , lob_orphan_insert_count bigint - , row_overflow_fetch_in_pages bigint - , row_overflow_fetch_in_bytes bigint - , column_value_push_off_row_count bigint - , column_value_pull_in_row_count bigint - , row_lock_count bigint - , row_lock_wait_count bigint - , row_lock_wait_in_ms bigint - , page_lock_count bigint - , page_lock_wait_count bigint - , page_lock_wait_in_ms bigint - , index_lock_promotion_attempt_count bigint - , index_lock_promotion_count bigint - , page_latch_wait_count bigint - , page_latch_wait_in_ms bigint - , page_io_latch_wait_count bigint - , page_io_latch_wait_in_ms bigint - , tree_page_latch_wait_count bigint - , tree_page_latch_wait_in_ms bigint - , tree_page_io_latch_wait_count bigint - , tree_page_io_latch_wait_in_ms bigint - , page_compression_attempt_count bigint - , page_compression_success_count bigint - , version_generated_inrow bigint - , version_generated_offrow bigint - , ghost_version_inrow bigint - , ghost_version_offrow bigint - , insert_over_ghost_version_inrow bigint - , insert_over_ghost_version_offrow bigint - ) + + -- get relevant columns from sys.dm_db_partition_stats, sys.partitions and sys.objects + DROP TABLE if exists #dm_db_partition_stats_etc + create table #dm_db_partition_stats_etc + ( + database_id smallint not null + , object_id int not null + , sname sysname NULL + , index_id int + , partition_number int + , partition_id bigint + , row_count bigint + , reserved_MB bigint + , reserved_LOB_MB bigint + , reserved_row_overflow_MB bigint + , lock_escalation_desc nvarchar(60) + , data_compression_desc nvarchar(60) + ) + + -- get relevant info from sys.dm_db_index_operational_stats + drop TABLE if exists #dm_db_index_operational_stats + create table #dm_db_index_operational_stats + ( + database_id smallint not null + , object_id int not null + , index_id int + , partition_number int + , hobt_id bigint + , leaf_insert_count bigint + , leaf_delete_count bigint + , leaf_update_count bigint + , leaf_ghost_count bigint + , nonleaf_insert_count bigint + , nonleaf_delete_count bigint + , nonleaf_update_count bigint + , leaf_allocation_count bigint + , nonleaf_allocation_count bigint + , leaf_page_merge_count bigint + , nonleaf_page_merge_count bigint + , range_scan_count bigint + , singleton_lookup_count bigint + , forwarded_fetch_count bigint + , lob_fetch_in_pages bigint + , lob_fetch_in_bytes bigint + , lob_orphan_create_count bigint + , lob_orphan_insert_count bigint + , row_overflow_fetch_in_pages bigint + , row_overflow_fetch_in_bytes bigint + , column_value_push_off_row_count bigint + , column_value_pull_in_row_count bigint + , row_lock_count bigint + , row_lock_wait_count bigint + , row_lock_wait_in_ms bigint + , page_lock_count bigint + , page_lock_wait_count bigint + , page_lock_wait_in_ms bigint + , index_lock_promotion_attempt_count bigint + , index_lock_promotion_count bigint + , page_latch_wait_count bigint + , page_latch_wait_in_ms bigint + , page_io_latch_wait_count bigint + , page_io_latch_wait_in_ms bigint + , tree_page_latch_wait_count bigint + , tree_page_latch_wait_in_ms bigint + , tree_page_io_latch_wait_count bigint + , tree_page_io_latch_wait_in_ms bigint + , page_compression_attempt_count bigint + , page_compression_success_count bigint + , version_generated_inrow bigint + , version_generated_offrow bigint + , ghost_version_inrow bigint + , ghost_version_offrow bigint + , insert_over_ghost_version_inrow bigint + , insert_over_ghost_version_offrow bigint + ) SET @dsql = N' DECLARE @d VARCHAR(19) = CONVERT(VARCHAR(19), GETDATE(), 121) - RAISERROR (N''start getting data into #h at %s'',0,1, @d) WITH NOWAIT; + RAISERROR (N''start getting data into #dm_db_partition_stats_etc at %s'',0,1, @d) WITH NOWAIT; SET TRANSACTION ISOLATION LEVEL READ UNCOMMITTED; - INSERT INTO #h + INSERT INTO #dm_db_partition_stats_etc ( - database_id, object_id, sname, index_id, partition_number, partition_id, row_count, reserved_MB, reserved_LOB_MB, reserved_row_overflow_MB, lock_escalation_desc, data_compression_desc, reserved_dictionary_MB + database_id, object_id, sname, index_id, partition_number, partition_id, row_count, reserved_MB, reserved_LOB_MB, reserved_row_overflow_MB, lock_escalation_desc, data_compression_desc ) SELECT ' + CAST(@DatabaseID AS NVARCHAR(10)) + N' AS database_id, ps.object_id, @@ -1534,16 +1537,9 @@ create table #os ps.lob_reserved_page_count * 8. / 1024. AS reserved_LOB_MB, ps.row_overflow_reserved_page_count * 8. / 1024. AS reserved_row_overflow_MB, le.lock_escalation_desc, - ' + CASE WHEN @SQLServerProductVersion NOT LIKE '9%' THEN N'par.data_compression_desc ' ELSE N'null as data_compression_desc ' END + N', + ' + CASE WHEN @SQLServerProductVersion NOT LIKE '9%' THEN N'par.data_compression_desc ' ELSE N'null as data_compression_desc ' END + N' '; - /* Get columnstore dictionary size - more info: https://github.com/BrentOzarULTD/SQL-Server-First-Responder-Kit/issues/2585 */ - IF EXISTS (SELECT * FROM sys.all_objects WHERE name = 'column_store_dictionaries') - SET @dsql = @dsql + N' COALESCE((SELECT SUM (on_disk_size / 1024.0 / 1024) FROM ' + QUOTENAME(@DatabaseName) + N'.sys.column_store_dictionaries dict WHERE dict.partition_id = ps.partition_id),0) AS reserved_dictionary_MB '; - ELSE - SET @dsql = @dsql + N' 0 AS reserved_dictionary_MB '; - - SET @dsql = @dsql + N' FROM ' + QUOTENAME(@DatabaseName) + N'.sys.dm_db_partition_stats AS ps JOIN ' + QUOTENAME(@DatabaseName) + N'.sys.partitions AS par on ps.partition_id=par.partition_id @@ -1574,9 +1570,9 @@ create table #os OPTION ( RECOMPILE , min_grant_percent = 1); SET @d = CONVERT(VARCHAR(19), GETDATE(), 121) - RAISERROR (N''start getting data into #os at %s.'',0,1, @d) WITH NOWAIT; + RAISERROR (N''start getting data into #dm_db_index_operational_stats at %s.'',0,1, @d) WITH NOWAIT; - insert into #os + insert into #dm_db_index_operational_stats ( database_id , object_id @@ -1686,7 +1682,7 @@ create table #os OPTION ( RECOMPILE , min_grant_percent = 1); SET @d = CONVERT(VARCHAR(19), GETDATE(), 121) - RAISERROR (N''finished getting data into #os at %s.'',0,1, @d) WITH NOWAIT; + RAISERROR (N''finished getting data into #dm_db_index_operational_stats at %s.'',0,1, @d) WITH NOWAIT; '; END; ELSE @@ -1843,11 +1839,11 @@ create table #os SUM(os.page_latch_wait_in_ms), SUM(os.page_io_latch_wait_count), SUM(os.page_io_latch_wait_in_ms) - , h.reserved_dictionary_MB - from #h h - left JOIN #os as os ON + ,COALESCE((SELECT SUM (dict.on_disk_size / 1024.0 / 1024) FROM sys.column_store_dictionaries dict WHERE dict.partition_id = h.partition_id),0) AS reserved_dictionary_MB + from #dm_db_partition_stats_etc h + left JOIN #dm_db_index_operational_stats as os ON h.object_id=os.object_id and h.index_id=os.index_id and h.partition_number=os.partition_number - group by h.database_id, h.object_id, h.sname, h.index_id, h.partition_number, h.partition_id, h.row_count, h.reserved_MB, h.reserved_LOB_MB, h.reserved_row_overflow_MB, h.lock_escalation_desc, h.data_compression_desc, h.reserved_dictionary_MB + group by h.database_id, h.object_id, h.sname, h.index_id, h.partition_number, h.partition_id, h.row_count, h.reserved_MB, h.reserved_LOB_MB, h.reserved_row_overflow_MB, h.lock_escalation_desc, h.data_compression_desc END; --End Check For @SkipPartitions = 0 From 42a7590be0765d069dbb81dcc53a119b98772006 Mon Sep 17 00:00:00 2001 From: Chris May <99744523+ChrisMayIVCE@users.noreply.github.com> Date: Wed, 27 Dec 2023 12:53:12 +0000 Subject: [PATCH 06/33] Update sp_BlitzIndex.sql Remove extra junk output for columnstore visualisation on a partitioned table with at least one other rowstore index --- sp_BlitzIndex.sql | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sp_BlitzIndex.sql b/sp_BlitzIndex.sql index 0e23b24f..02e4386b 100644 --- a/sp_BlitzIndex.sql +++ b/sp_BlitzIndex.sql @@ -2991,7 +2991,7 @@ BEGIN INNER JOIN ' + QUOTENAME(@DatabaseName) + N'.sys.columns c ON rg.object_id = c.object_id INNER JOIN ' + QUOTENAME(@DatabaseName) + N'.sys.partitions p ON rg.object_id = p.object_id AND rg.partition_number = p.partition_number INNER JOIN ' + QUOTENAME(@DatabaseName) + N'.sys.index_columns ic on ic.column_id = c.column_id AND ic.object_id = c.object_id AND ic.index_id = p.index_id - LEFT OUTER JOIN ' + QUOTENAME(@DatabaseName) + N'.sys.dm_db_column_store_row_group_physical_stats phys ON rg.row_group_id = phys.row_group_id AND rg.object_id = phys.object_id AND rg.partition_number = phys.partition_number AND p.index_id = phys.index_id ' + CASE WHEN @ShowPartitionRanges = 1 THEN N' + LEFT OUTER JOIN ' + QUOTENAME(@DatabaseName) + N'.sys.dm_db_column_store_row_group_physical_stats phys ON rg.row_group_id = phys.row_group_id AND rg.object_id = phys.object_id AND rg.partition_number = phys.partition_number AND rg.index_id = phys.index_id ' + CASE WHEN @ShowPartitionRanges = 1 THEN N' LEFT OUTER JOIN ' + QUOTENAME(@DatabaseName) + N'.sys.indexes i ON i.object_id = rg.object_id AND i.index_id = rg.index_id LEFT OUTER JOIN ' + QUOTENAME(@DatabaseName) + N'.sys.partition_schemes ps ON ps.data_space_id = i.data_space_id LEFT OUTER JOIN ' + QUOTENAME(@DatabaseName) + N'.sys.partition_functions pf ON pf.function_id = ps.function_id From 9a026def6bfdead374839f41e6e14f8e7f1f1711 Mon Sep 17 00:00:00 2001 From: Brent Ozar Date: Thu, 28 Dec 2023 09:15:20 -0800 Subject: [PATCH 07/33] Update sp_BlitzIndex.sql Removed columns we don't need from prior versions. --- sp_BlitzIndex.sql | 72 ----------------------------------------------- 1 file changed, 72 deletions(-) diff --git a/sp_BlitzIndex.sql b/sp_BlitzIndex.sql index 18087417..15f81c6a 100644 --- a/sp_BlitzIndex.sql +++ b/sp_BlitzIndex.sql @@ -1473,25 +1473,13 @@ BEGIN TRY , leaf_insert_count bigint , leaf_delete_count bigint , leaf_update_count bigint - , leaf_ghost_count bigint - , nonleaf_insert_count bigint - , nonleaf_delete_count bigint - , nonleaf_update_count bigint - , leaf_allocation_count bigint - , nonleaf_allocation_count bigint - , leaf_page_merge_count bigint - , nonleaf_page_merge_count bigint , range_scan_count bigint , singleton_lookup_count bigint , forwarded_fetch_count bigint , lob_fetch_in_pages bigint , lob_fetch_in_bytes bigint - , lob_orphan_create_count bigint - , lob_orphan_insert_count bigint , row_overflow_fetch_in_pages bigint , row_overflow_fetch_in_bytes bigint - , column_value_push_off_row_count bigint - , column_value_pull_in_row_count bigint , row_lock_count bigint , row_lock_wait_count bigint , row_lock_wait_in_ms bigint @@ -1504,18 +1492,6 @@ BEGIN TRY , page_latch_wait_in_ms bigint , page_io_latch_wait_count bigint , page_io_latch_wait_in_ms bigint - , tree_page_latch_wait_count bigint - , tree_page_latch_wait_in_ms bigint - , tree_page_io_latch_wait_count bigint - , tree_page_io_latch_wait_in_ms bigint - , page_compression_attempt_count bigint - , page_compression_success_count bigint - , version_generated_inrow bigint - , version_generated_offrow bigint - , ghost_version_inrow bigint - , ghost_version_offrow bigint - , insert_over_ghost_version_inrow bigint - , insert_over_ghost_version_offrow bigint ) SET @dsql = N' @@ -1582,25 +1558,13 @@ BEGIN TRY , leaf_insert_count , leaf_delete_count , leaf_update_count - , leaf_ghost_count - , nonleaf_insert_count - , nonleaf_delete_count - , nonleaf_update_count - , leaf_allocation_count - , nonleaf_allocation_count - , leaf_page_merge_count - , nonleaf_page_merge_count , range_scan_count , singleton_lookup_count , forwarded_fetch_count , lob_fetch_in_pages , lob_fetch_in_bytes - , lob_orphan_create_count - , lob_orphan_insert_count , row_overflow_fetch_in_pages , row_overflow_fetch_in_bytes - , column_value_push_off_row_count - , column_value_pull_in_row_count , row_lock_count , row_lock_wait_count , row_lock_wait_in_ms @@ -1613,18 +1577,6 @@ BEGIN TRY , page_latch_wait_in_ms , page_io_latch_wait_count , page_io_latch_wait_in_ms - , tree_page_latch_wait_count - , tree_page_latch_wait_in_ms - , tree_page_io_latch_wait_count - , tree_page_io_latch_wait_in_ms - , page_compression_attempt_count - , page_compression_success_count - , version_generated_inrow - , version_generated_offrow - , ghost_version_inrow - , ghost_version_offrow - , insert_over_ghost_version_inrow - , insert_over_ghost_version_offrow ) select os.database_id @@ -1635,25 +1587,13 @@ BEGIN TRY , os.leaf_insert_count , os.leaf_delete_count , os.leaf_update_count - , os.leaf_ghost_count - , os.nonleaf_insert_count - , os.nonleaf_delete_count - , os.nonleaf_update_count - , os.leaf_allocation_count - , os.nonleaf_allocation_count - , os.leaf_page_merge_count - , os.nonleaf_page_merge_count , os.range_scan_count , os.singleton_lookup_count , os.forwarded_fetch_count , os.lob_fetch_in_pages , os.lob_fetch_in_bytes - , os.lob_orphan_create_count - , os.lob_orphan_insert_count , os.row_overflow_fetch_in_pages , os.row_overflow_fetch_in_bytes - , os.column_value_push_off_row_count - , os.column_value_pull_in_row_count , os.row_lock_count , os.row_lock_wait_count , os.row_lock_wait_in_ms @@ -1666,18 +1606,6 @@ BEGIN TRY , os.page_latch_wait_in_ms , os.page_io_latch_wait_count , os.page_io_latch_wait_in_ms - , os.tree_page_latch_wait_count - , os.tree_page_latch_wait_in_ms - , os.tree_page_io_latch_wait_count - , os.tree_page_io_latch_wait_in_ms - , os.page_compression_attempt_count - , os.page_compression_success_count - , os.version_generated_inrow - , os.version_generated_offrow - , os.ghost_version_inrow - , os.ghost_version_offrow - , os.insert_over_ghost_version_inrow - , os.insert_over_ghost_version_offrow from ' + QUOTENAME(@DatabaseName) + N'.sys.dm_db_index_operational_stats('+ CAST(@DatabaseID AS NVARCHAR(10)) +', NULL, NULL,NULL) AS os OPTION ( RECOMPILE , min_grant_percent = 1); From 31799ee32521d1d430f9b2ad9e78f9927caae9ac Mon Sep 17 00:00:00 2001 From: Brent Ozar Date: Thu, 28 Dec 2023 09:31:02 -0800 Subject: [PATCH 08/33] #3402 sp_Blitz AG duplicate rows Fixed with every DBA's favorite T-SQL component, DISTINCT. Closes #3402. --- sp_Blitz.sql | 25 ++++--------------------- 1 file changed, 4 insertions(+), 21 deletions(-) diff --git a/sp_Blitz.sql b/sp_Blitz.sql index 9804f45d..42492627 100644 --- a/sp_Blitz.sql +++ b/sp_Blitz.sql @@ -3394,23 +3394,6 @@ AS IF @Debug IN (1, 2) RAISERROR('Running CheckId [%d].', 0, 1, 53) WITH NOWAIT; - --INSERT INTO #BlitzResults - -- ( CheckID , - -- Priority , - -- FindingsGroup , - -- Finding , - -- URL , - -- Details - -- ) - -- SELECT TOP 1 - -- 53 AS CheckID , - -- 200 AS Priority , - -- 'Informational' AS FindingsGroup , - -- 'Cluster Node' AS Finding , - -- 'https://BrentOzar.com/go/node' AS URL , - -- 'This is a node in a cluster.' AS Details - -- FROM sys.dm_os_cluster_nodes; - DECLARE @AOFCI AS INT, @AOAG AS INT, @HAType AS VARCHAR(10), @errmsg AS VARCHAR(200) SELECT @AOAG = CAST(SERVERPROPERTY('IsHadrEnabled') AS INT) @@ -3441,7 +3424,7 @@ AS Details ) - SELECT 53 AS CheckID , + SELECT DISTINCT 53 AS CheckID , 200 AS Priority , 'Informational' AS FindingsGroup , 'Cluster Node' AS Finding , @@ -3458,7 +3441,7 @@ AS URL , Details ) - SELECT 53 AS CheckID , + SELECT DISTINCT 53 AS CheckID , 200 AS Priority , 'Informational' AS FindingsGroup , 'Cluster Node Info' AS Finding , @@ -3484,7 +3467,7 @@ AS URL , Details ) - SELECT 53 AS CheckID , + SELECT DISTINCT 53 AS CheckID , 200 AS Priority , 'Informational' AS FindingsGroup , 'Cluster Node Info' AS Finding , @@ -3509,7 +3492,7 @@ AS URL , Details ) - SELECT 53 AS CheckID , + SELECT DISTINCT 53 AS CheckID , 200 AS Priority , 'Informational' AS FindingsGroup , 'Cluster Node Info' AS Finding , From c3c9a7cdd2a4ac2a46c56d9ac4225e82caef3734 Mon Sep 17 00:00:00 2001 From: Erik Darling <2136037+erikdarlingdata@users.noreply.github.com> Date: Fri, 5 Jan 2024 14:44:38 -0500 Subject: [PATCH 09/33] Add ADR Check Closes #3411 Adds a check if accelerated database recovery is enabled, It's skipped for MI and SQLDB because it is on by default there. --- sp_Blitz.sql | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/sp_Blitz.sql b/sp_Blitz.sql index 42492627..d0772a77 100644 --- a/sp_Blitz.sql +++ b/sp_Blitz.sql @@ -4803,6 +4803,10 @@ AS FROM sys.all_columns WHERE name = 'is_memory_optimized_elevate_to_snapshot_on' AND object_id = OBJECT_ID('sys.databases') AND SERVERPROPERTY('EngineEdition') <> 8; /* Hekaton is always enabled in Managed Instances per https://github.com/BrentOzarULTD/SQL-Server-First-Responder-Kit/issues/1919 */ + INSERT INTO #DatabaseDefaults + SELECT 'is_accelerated_database_recovery_on', 0, 145, 210, 'Acclerated Database Recovery Enabled', 'https://www.brentozar.com/go/dbdefaults', NULL + FROM sys.all_columns + WHERE name = 'is_accelerated_database_recovery_on' AND object_id = OBJECT_ID('sys.databases') AND SERVERPROPERTY('EngineEdition') NOT IN (5, 8) ; DECLARE DatabaseDefaultsLoop CURSOR FOR SELECT name, DefaultValue, CheckID, Priority, Finding, URL, Details @@ -10048,4 +10052,4 @@ EXEC [dbo].[sp_Blitz] @OutputProcedureCache = 0 , @CheckProcedureCacheFilter = NULL, @CheckServerInfo = 1 -*/ \ No newline at end of file +*/ From d6121bef43b88a4a9751e62d6479b8d39afa9d35 Mon Sep 17 00:00:00 2001 From: David Wiseman <33157668+DavidWiseman@users.noreply.github.com> Date: Mon, 8 Jan 2024 09:21:25 +0000 Subject: [PATCH 10/33] Add Automated Testing Use GitHub Actions to provide automated testing for first responder kit stored procedures. #3418 --- .github/workflows/integration-tests.yml | 52 +++++++++++++++++++++++++ tests/run-tests.ps1 | 14 +++++++ tests/sp_Blitz.tests.ps1 | 10 +++++ tests/sp_BlitzAnalysis.tests.ps1 | 15 +++++++ tests/sp_BlitzBackups.tests.ps1 | 20 ++++++++++ tests/sp_BlitzCache.tests.ps1 | 13 +++++++ tests/sp_BlitzFirst.tests.ps1 | 40 +++++++++++++++++++ tests/sp_BlitzInMemoryOLTP.tests.ps1 | 13 +++++++ tests/sp_BlitzIndex.tests.ps1 | 10 +++++ tests/sp_BlitzLock.tests.ps1 | 11 ++++++ tests/sp_BlitzQueryStore.tests.ps1 | 12 ++++++ tests/sp_BlitzWho.tests.ps1 | 15 +++++++ 12 files changed, 225 insertions(+) create mode 100644 .github/workflows/integration-tests.yml create mode 100644 tests/run-tests.ps1 create mode 100644 tests/sp_Blitz.tests.ps1 create mode 100644 tests/sp_BlitzAnalysis.tests.ps1 create mode 100644 tests/sp_BlitzBackups.tests.ps1 create mode 100644 tests/sp_BlitzCache.tests.ps1 create mode 100644 tests/sp_BlitzFirst.tests.ps1 create mode 100644 tests/sp_BlitzInMemoryOLTP.tests.ps1 create mode 100644 tests/sp_BlitzIndex.tests.ps1 create mode 100644 tests/sp_BlitzLock.tests.ps1 create mode 100644 tests/sp_BlitzQueryStore.tests.ps1 create mode 100644 tests/sp_BlitzWho.tests.ps1 diff --git a/.github/workflows/integration-tests.yml b/.github/workflows/integration-tests.yml new file mode 100644 index 00000000..250e8fbc --- /dev/null +++ b/.github/workflows/integration-tests.yml @@ -0,0 +1,52 @@ +name: First Responder Kit Integration Tests + +on: + push: + workflow_dispatch: + +jobs: + build: + name: Build + runs-on: ubuntu-latest + + steps: + - name: Checkout repository + uses: actions/checkout@v4 + + - name: Install SqlServer Module + shell: pwsh + run: | + Set-PSRepository -Name PSGallery -InstallationPolicy Trusted + Install-Module SqlServer + + - name: Install SQL Server + uses: potatoqualitee/mssqlsuite@v1.7 + with: + install: sqlengine + version: 2017 + collation: SQL_Latin1_General_CP1_CS_AS + + - name: Check SQL Install + run: | + sqlcmd -S localhost -U sa -P dbatools.I0 -d tempdb -Q "SELECT @@version as Version;" -I -b -t 60 + sqlcmd -S localhost -U sa -P dbatools.I0 -d tempdb -Q "SELECT SERVERPROPERTY('Collation') AS Collation;" -I -b -t 60 + + - name: Deploy FRK + run: | + sqlcmd -S localhost -U sa -P dbatools.I0 -d master -i "sp_BlitzCache.sql" -I -b -t 60 + sqlcmd -S localhost -U sa -P dbatools.I0 -d master -i "sp_BlitzWho.sql" -I -b -t 60 + sqlcmd -S localhost -U sa -P dbatools.I0 -d master -i "sp_Blitz.sql" -I -b -t 60 + sqlcmd -S localhost -U sa -P dbatools.I0 -d master -i "sp_BlitzFirst.sql" -I -b -t 60 + sqlcmd -S localhost -U sa -P dbatools.I0 -d master -i "sp_BlitzAnalysis.sql" -I -b -t 60 + sqlcmd -S localhost -U sa -P dbatools.I0 -d master -i "sp_BlitzBackups.sql" -I -b -t 60 + sqlcmd -S localhost -U sa -P dbatools.I0 -d master -i "sp_BlitzIndex.sql" -I -b -t 60 + sqlcmd -S localhost -U sa -P dbatools.I0 -d master -i "sp_BlitzInMemoryOLTP.sql" -I -b -t 60 + sqlcmd -S localhost -U sa -P dbatools.I0 -d master -i "sp_BlitzLock.sql" -I -b -t 60 + sqlcmd -S localhost -U sa -P dbatools.I0 -d master -i "sp_BlitzQueryStore.sql" -I -b -t 60 + sqlcmd -S localhost -U sa -P dbatools.I0 -d master -Q "SELECT * FROM sys.procedures WHERE name LIKE 'sp_Blitz%';" -I -b -t 60 + + - name: Run Pester Tests + shell: pwsh + run: | + cd tests + ./run-tests.ps1 \ No newline at end of file diff --git a/tests/run-tests.ps1 b/tests/run-tests.ps1 new file mode 100644 index 00000000..c16ea15f --- /dev/null +++ b/tests/run-tests.ps1 @@ -0,0 +1,14 @@ +# Assign default values if script-scoped variables are not set +$ServerInstance = if ($null -ne $script:ServerInstance) { $script:ServerInstance } else { "localhost" } +$UserName = if ($null -ne $script:UserName) { $script:UserName } else { "sa" } +$Password = if ($null -ne $script:Password) { $script:Password } else { "dbatools.I0" } +$TrustServerCertificate = if ($null -ne $script:TrustServerCertificate) { $script:TrustServerCertificate } else { $true } + +$PSDefaultParameterValues = @{ + "*:ServerInstance" = $ServerInstance + "*:UserName" = $UserName + "*:Password" = $Password + "*:TrustServerCertificate" = $TrustServerCertificate +} + +Invoke-Pester -PassThru \ No newline at end of file diff --git a/tests/sp_Blitz.tests.ps1 b/tests/sp_Blitz.tests.ps1 new file mode 100644 index 00000000..341b9c34 --- /dev/null +++ b/tests/sp_Blitz.tests.ps1 @@ -0,0 +1,10 @@ +Describe "sp_Blitz Tests" { + + It "sp_Blitz Check" { + $results = Invoke-SqlCmd -Query "EXEC dbo.sp_Blitz" -OutputAs DataSet + $results.Tables.Count | Should -Be 1 + $results.Tables[0].Columns.Count | Should -Be 9 + $results.Tables[0].Rows.Count | Should -BeGreaterThan 0 + } + +} diff --git a/tests/sp_BlitzAnalysis.tests.ps1 b/tests/sp_BlitzAnalysis.tests.ps1 new file mode 100644 index 00000000..f346b619 --- /dev/null +++ b/tests/sp_BlitzAnalysis.tests.ps1 @@ -0,0 +1,15 @@ +Describe "sp_BlitzAnalysis Tests" { + + It "sp_BlitzAnalysis Check" { + + # Run sp_BlitzFirst to populate the tables used by sp_BlitzAnalysis + Invoke-SqlCmd -Query "EXEC dbo.sp_BlitzFirst @OutputDatabaseName = 'tempdb', @OutputSchemaName = N'dbo', @OutputTableName = N'BlitzFirst', @OutputTableNameFileStats = N'BlitzFirst_FileStats',@OutputTableNamePerfmonStats = N'BlitzFirst_PerfmonStats', + @OutputTableNameWaitStats = N'BlitzFirst_WaitStats', + @OutputTableNameBlitzCache = N'BlitzCache', + @OutputTableNameBlitzWho= N'BlitzWho'" + + $results = Invoke-SqlCmd -Query "EXEC dbo.sp_BlitzAnalysis @OutputDatabaseName = 'tempdb'" -OutputAs DataSet + $results.Tables.Count | Should -BeGreaterThan 6 + } + +} diff --git a/tests/sp_BlitzBackups.tests.ps1 b/tests/sp_BlitzBackups.tests.ps1 new file mode 100644 index 00000000..162e869f --- /dev/null +++ b/tests/sp_BlitzBackups.tests.ps1 @@ -0,0 +1,20 @@ +Describe "sp_BlitzBackups Tests" { + + It "sp_BlitzBackups Check" { + # Give sp_BlitzBackups something to capture by performing a dummy backup of model DB + # Test to be run in GitHub action but backing up model to NUL should be safe on most systems + Invoke-SqlCmd -Query "BACKUP DATABASE model TO DISK='NUL'" + $results = Invoke-SqlCmd -Query "EXEC dbo.sp_BlitzBackups" -OutputAs DataSet + $results.Tables.Count | Should -Be 3 + + $results.Tables[0].Columns.Count | Should -Be 39 + $results.Tables[0].Rows.Count | Should -BeGreaterThan 0 + + $results.Tables[1].Columns.Count | Should -Be 32 + $results.Tables[1].Rows.Count | Should -BeGreaterThan 0 + + $results.Tables[2].Columns.Count | Should -Be 5 + $results.Tables[2].Rows.Count | Should -BeGreaterThan 0 + } + +} diff --git a/tests/sp_BlitzCache.tests.ps1 b/tests/sp_BlitzCache.tests.ps1 new file mode 100644 index 00000000..4483e090 --- /dev/null +++ b/tests/sp_BlitzCache.tests.ps1 @@ -0,0 +1,13 @@ +Describe "sp_BlitzCache Tests" { + + It "sp_BlitzCache Check" { + # Note: Added 'SELECT 1 AS A' as an empty first resultset causes issues returning the full DataSet + $results = Invoke-SqlCmd -Query "SELECT 1 AS A;EXEC dbo.sp_BlitzCache" -OutputAs DataSet + # Adjust table count to get the actual tables returned from sp_BlitzCache (So reporting isn't confusing) + $tableCount = $results.Tables.Count -1 + $tableCount | Should -Be 2 + $results.Tables[1].Columns.Count | Should -Be 43 + $results.Tables[2].Columns.Count | Should -Be 6 + $results.Tables[2].Rows.Count | Should -BeGreaterThan 0 + } +} \ No newline at end of file diff --git a/tests/sp_BlitzFirst.tests.ps1 b/tests/sp_BlitzFirst.tests.ps1 new file mode 100644 index 00000000..d2bb42d3 --- /dev/null +++ b/tests/sp_BlitzFirst.tests.ps1 @@ -0,0 +1,40 @@ +Describe "sp_BlitzFirst Tests" { + + It "sp_BlitzFirst Check" { + # Give sp_BlitzFirst something to capture + Start-Job -ScriptBlock { + Invoke-SqlCmd -Query "WAITFOR DELAY '00:00:15'" -ServerInstance $using:ServerInstance -Username $using:UserName -Password $using:Password -TrustServerCertificate:$using:TrustServerCertificate + } + Start-Sleep -Milliseconds 1000 + $results = Invoke-SqlCmd -Query "EXEC dbo.sp_BlitzFirst" -OutputAs DataSet + $results.Tables.Count | Should -Be 1 + $results.Tables[0].Columns.Count | Should -Be 8 + $results.Tables[0].Rows.Count | Should -BeGreaterThan 0 + + $results = Invoke-SqlCmd -Query "EXEC dbo.sp_BlitzFirst @ExpertMode=1" -OutputAs DataSet + $results.Tables.Count | Should -Be 7 + + $results.Tables[0].Columns.Count | Should -Be 21 + $results.Tables[0].Rows.Count | Should -BeGreaterThan 0 + + $results.Tables[1].Columns.Count | Should -Be 40 + $results.Tables[1].Rows.Count | Should -BeGreaterThan 0 + + $results.Tables[2].Columns.Count | Should -Be 13 + $results.Tables[2].Rows.Count | Should -BeGreaterThan 0 + + $results.Tables[3].Columns.Count | Should -Be 11 + $results.Tables[3].Rows.Count | Should -BeGreaterThan 0 + + $results.Tables[4].Columns.Count | Should -Be 10 + $results.Tables[4].Rows.Count | Should -BeGreaterThan 0 + + $results.Tables[5].Columns.Count | Should -Be 4 + $results.Tables[5].Rows.Count | Should -BeGreaterThan 0 + + $results.Tables[6].Columns.Count | Should -Be 21 + $results.Tables[6].Rows.Count | Should -BeGreaterThan 0 + + } + +} \ No newline at end of file diff --git a/tests/sp_BlitzInMemoryOLTP.tests.ps1 b/tests/sp_BlitzInMemoryOLTP.tests.ps1 new file mode 100644 index 00000000..710f0bc5 --- /dev/null +++ b/tests/sp_BlitzInMemoryOLTP.tests.ps1 @@ -0,0 +1,13 @@ +Describe "sp_BlitzInMemoryOLTP Tests" { + + It "sp_BlitzInMemoryOLTP Check" { + # Create InMemory OLTP Database + Invoke-SqlCmd -Query "CREATE DATABASE sp_BlitzInMemoryOLTPTest;ALTER DATABASE sp_BlitzInMemoryOLTPTest SET MEMORY_OPTIMIZED_ELEVATE_TO_SNAPSHOT = ON;ALTER DATABASE sp_BlitzInMemoryOLTPTest ADD FILEGROUP sp_BlitzInMemoryOLTPTest CONTAINS MEMORY_OPTIMIZED_DATA;" + # Note: Added 'SELECT 1 AS A' as an empty first resultset causes issues returning the full DataSet + $results = Invoke-SqlCmd -Query "SELECT 1 AS A;EXEC dbo.sp_BlitzInMemoryOLTP" -OutputAs DataSet + # Adjust table count to get the actual tables returned from sp_BlitzInMemoryOLTP (So reporting isn't confusing) + $tableCount = $results.Tables.Count -1 + $tableCount | Should -BeGreaterThan 0 + } + +} \ No newline at end of file diff --git a/tests/sp_BlitzIndex.tests.ps1 b/tests/sp_BlitzIndex.tests.ps1 new file mode 100644 index 00000000..63c479ad --- /dev/null +++ b/tests/sp_BlitzIndex.tests.ps1 @@ -0,0 +1,10 @@ +Describe "sp_BlitzIndex Tests" { + + It "sp_BlitzIndex Check" { + $results = Invoke-SqlCmd -Query "EXEC dbo.sp_BlitzIndex" -OutputAs DataSet + $results.Tables.Count | Should -Be 1 + $results.Tables[0].Columns.Count | Should -Be 12 + $results.Tables[0].Rows.Count | Should -BeGreaterThan 0 + } + +} \ No newline at end of file diff --git a/tests/sp_BlitzLock.tests.ps1 b/tests/sp_BlitzLock.tests.ps1 new file mode 100644 index 00000000..5368e328 --- /dev/null +++ b/tests/sp_BlitzLock.tests.ps1 @@ -0,0 +1,11 @@ +Describe "sp_BlitzLock Tests" { + + It "sp_BlitzLock Check" { + # Note: Added 'SELECT 1 AS A' as an empty first resultset causes issues returning the full DataSet + $results = Invoke-SqlCmd -Query "SELECT 1 AS A;EXEC dbo.sp_BlitzLock" -OutputAs DataSet + # Adjust table count to get the actual tables returned from sp_BlitzLock (So reporting isn't confusing) + $tableCount = $results.Tables.Count - 1 + $tableCount | Should -Be 3 + } + +} \ No newline at end of file diff --git a/tests/sp_BlitzQueryStore.tests.ps1 b/tests/sp_BlitzQueryStore.tests.ps1 new file mode 100644 index 00000000..079ff108 --- /dev/null +++ b/tests/sp_BlitzQueryStore.tests.ps1 @@ -0,0 +1,12 @@ +Describe "sp_BlitzQueryStore Tests" { + + It "sp_BlitzQueryStore Check" { + # Note: Added 'SELECT 1 AS A' as an empty first resultset causes issues returning the full DataSet + $results = Invoke-SqlCmd -Query "SELECT 1 AS A;EXEC dbo.sp_BlitzQueryStore" -OutputAs DataSet + # Adjust table count to get the actual tables returned from sp_BlitzQueryStore (So reporting isn't confusing) + $tableCount = $results.Tables.Count - 1 + ## We haven't specified @DatabaseName and don't have DBs with Query Store enabled so table count is 0 + $tableCount | Should -Be 0 + } + +} \ No newline at end of file diff --git a/tests/sp_BlitzWho.tests.ps1 b/tests/sp_BlitzWho.tests.ps1 new file mode 100644 index 00000000..3e9febd5 --- /dev/null +++ b/tests/sp_BlitzWho.tests.ps1 @@ -0,0 +1,15 @@ +Describe "sp_BlitzWho Tests" { + + It "sp_BlitzWho Check" { + # Give sp_BlitzWho something to capture + Start-Job -ScriptBlock { + Invoke-SqlCmd -Query "WAITFOR DELAY '00:00:15'" -ServerInstance $using:ServerInstance -Username $using:UserName -Password $using:Password -TrustServerCertificate:$using:TrustServerCertificate + } + Start-Sleep -Milliseconds 1000 + $results = Invoke-SqlCmd -Query "EXEC dbo.sp_BlitzWho" -OutputAs DataSet + $results.Tables.Count | Should -Be 1 + $results.Tables[0].Columns.Count | Should -Be 21 + $results.Tables[0].Rows.Count | Should -BeGreaterThan 0 + } + +} \ No newline at end of file From 08c94850799a7fb5e3f81483b42a4cbc153a22ac Mon Sep 17 00:00:00 2001 From: Brent Ozar Date: Wed, 10 Jan 2024 03:57:17 -0800 Subject: [PATCH 11/33] Update integration-tests.yml --- .github/workflows/integration-tests.yml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/.github/workflows/integration-tests.yml b/.github/workflows/integration-tests.yml index 250e8fbc..d5a09391 100644 --- a/.github/workflows/integration-tests.yml +++ b/.github/workflows/integration-tests.yml @@ -3,6 +3,8 @@ name: First Responder Kit Integration Tests on: push: workflow_dispatch: + pull_request: + types: [opened, review_requested, synchronize] jobs: build: @@ -49,4 +51,4 @@ jobs: shell: pwsh run: | cd tests - ./run-tests.ps1 \ No newline at end of file + ./run-tests.ps1 From 63129ceba213f35c8bcdf63043b1052869231524 Mon Sep 17 00:00:00 2001 From: Brent Ozar Date: Wed, 10 Jan 2024 04:00:22 -0800 Subject: [PATCH 12/33] Update SqlServerVersions.sql Add SQL 2022 CU10 GDR. --- SqlServerVersions.sql | 1 + 1 file changed, 1 insertion(+) diff --git a/SqlServerVersions.sql b/SqlServerVersions.sql index 40aea38c..51384c19 100644 --- a/SqlServerVersions.sql +++ b/SqlServerVersions.sql @@ -41,6 +41,7 @@ DELETE FROM dbo.SqlServerVersions; INSERT INTO dbo.SqlServerVersions (MajorVersionNumber, MinorVersionNumber, Branch, [Url], ReleaseDate, MainstreamSupportEndDate, ExtendedSupportEndDate, MajorVersionName, MinorVersionName) VALUES + (16, 4100, 'CU10 GDR', 'https://support.microsoft.com/en-us/help/5033592', '2024-01-09', '2028-01-11', '2033-01-11', 'SQL Server 2022', 'Cumulative Update 10 GDR'), (16, 4095, 'CU10', 'https://support.microsoft.com/en-us/help/5031778', '2023-11-16', '2028-01-11', '2033-01-11', 'SQL Server 2022', 'Cumulative Update 10'), (16, 4085, 'CU9', 'https://support.microsoft.com/en-us/help/5030731', '2023-10-12', '2028-01-11', '2033-01-11', 'SQL Server 2022', 'Cumulative Update 9'), (16, 4075, 'CU8', 'https://support.microsoft.com/en-us/help/5029666', '2023-09-14', '2028-01-11', '2033-01-11', 'SQL Server 2022', 'Cumulative Update 8'), From fca5bf918137ccb572674fcbf5b102492d63b23a Mon Sep 17 00:00:00 2001 From: twitthoeft-gls <132710946+twitthoeft-gls@users.noreply.github.com> Date: Wed, 10 Jan 2024 17:48:15 -0500 Subject: [PATCH 13/33] Update sp_BlitzCache.sql - Typo fix It's a typo fix. Thanks for making my job easier. Whiskey and Yoga --- sp_BlitzCache.sql | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sp_BlitzCache.sql b/sp_BlitzCache.sql index 07b3e1ab..3279e178 100644 --- a/sp_BlitzCache.sql +++ b/sp_BlitzCache.sql @@ -468,7 +468,7 @@ IF @Help = 1 UNION ALL SELECT N'@MinutesBack', N'INT', - N'How many minutes back to begin plan cache analysis. If you put in a positive number, we''ll flip it to negtive.'; + N'How many minutes back to begin plan cache analysis. If you put in a positive number, we''ll flip it to negative.'; /* Column definitions */ From 464b2292fb0fbfd9184fda63a268c351f8c6d4eb Mon Sep 17 00:00:00 2001 From: Sean Killeen Date: Tue, 16 Jan 2024 10:40:49 -0500 Subject: [PATCH 14/33] Add Matrix for SQL Server Versions --- .github/workflows/integration-tests.yml | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/.github/workflows/integration-tests.yml b/.github/workflows/integration-tests.yml index d5a09391..7d43b4c9 100644 --- a/.github/workflows/integration-tests.yml +++ b/.github/workflows/integration-tests.yml @@ -10,6 +10,10 @@ jobs: build: name: Build runs-on: ubuntu-latest + strategy: + matrix: + SQL_ENGINE_VERSION: [2017,2019] + steps: - name: Checkout repository @@ -25,7 +29,7 @@ jobs: uses: potatoqualitee/mssqlsuite@v1.7 with: install: sqlengine - version: 2017 + version: ${{ matrix.SQL_ENGINE_VERSION }} collation: SQL_Latin1_General_CP1_CS_AS - name: Check SQL Install From a6b27ce9dae726d6786007a465896a342acb9801 Mon Sep 17 00:00:00 2001 From: Sean Killeen Date: Tue, 16 Jan 2024 10:53:56 -0500 Subject: [PATCH 15/33] Add matrix capability for collation too --- .github/workflows/integration-tests.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/integration-tests.yml b/.github/workflows/integration-tests.yml index 7d43b4c9..1a9405e6 100644 --- a/.github/workflows/integration-tests.yml +++ b/.github/workflows/integration-tests.yml @@ -13,6 +13,7 @@ jobs: strategy: matrix: SQL_ENGINE_VERSION: [2017,2019] + COLLATION: [SQL_Latin1_General_CP1_CS_AS] steps: @@ -30,7 +31,7 @@ jobs: with: install: sqlengine version: ${{ matrix.SQL_ENGINE_VERSION }} - collation: SQL_Latin1_General_CP1_CS_AS + collation: ${{ matrix.COLLATION }} - name: Check SQL Install run: | From cabcea4e1df83ee77ed847d508f7eaa24ae4516b Mon Sep 17 00:00:00 2001 From: Sean Killeen Date: Tue, 16 Jan 2024 11:32:21 -0500 Subject: [PATCH 16/33] Add SQL 2022 as well --- .github/workflows/integration-tests.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/integration-tests.yml b/.github/workflows/integration-tests.yml index 1a9405e6..eccb5901 100644 --- a/.github/workflows/integration-tests.yml +++ b/.github/workflows/integration-tests.yml @@ -12,7 +12,7 @@ jobs: runs-on: ubuntu-latest strategy: matrix: - SQL_ENGINE_VERSION: [2017,2019] + SQL_ENGINE_VERSION: [2017,2019,2022] COLLATION: [SQL_Latin1_General_CP1_CS_AS] From d9d16a0867164c9413fe71daa26e03d963253594 Mon Sep 17 00:00:00 2001 From: Sean Killeen Date: Tue, 16 Jan 2024 11:40:00 -0500 Subject: [PATCH 17/33] Language: Insanity -> Problems --- Deprecated/sp_BlitzIndex_SQL_Server_2005.sql | 2 +- Install-All-Scripts.sql | 8 ++++---- Install-Core-Blitz-No-Query-Store.sql | 8 ++++---- Install-Core-Blitz-With-Query-Store.sql | 8 ++++---- sp_Blitz.sql | 2 +- sp_BlitzIndex.sql | 6 +++--- 6 files changed, 17 insertions(+), 17 deletions(-) diff --git a/Deprecated/sp_BlitzIndex_SQL_Server_2005.sql b/Deprecated/sp_BlitzIndex_SQL_Server_2005.sql index 22ec9187..86d0f584 100644 --- a/Deprecated/sp_BlitzIndex_SQL_Server_2005.sql +++ b/Deprecated/sp_BlitzIndex_SQL_Server_2005.sql @@ -43,7 +43,7 @@ Known limitations of this version: -- Example 1: index creates use ONLINE=? instead of ONLINE=ON / ONLINE=OFF. This is because it's important for the user to understand if it's going to be offline and not just run a script. -- Example 2: they do not include all the options the index may have been created with (padding, compression filegroup/partition scheme etc.) -- (The compression and filegroup index create syntax isn't trivial because it's set at the partition level and isn't trivial to code. Two people have voted for wanting it so far.) - - Doesn't advise you about data modeling for clustered indexes and primary keys (primarily looks for signs of insanity.) + - Doesn't advise you about data modeling for clustered indexes and primary keys (primarily looks for signs of problems.) - Found something? Let us know at help@brentozar.com. Thanks for using sp_BlitzIndex(TM)! diff --git a/Install-All-Scripts.sql b/Install-All-Scripts.sql index 547300b1..9fa75fdd 100644 --- a/Install-All-Scripts.sql +++ b/Install-All-Scripts.sql @@ -4022,7 +4022,7 @@ AS IF @BringThePain = 0 AND 50 <= (SELECT COUNT(*) FROM sys.databases) AND @CheckUserDatabaseObjects = 1 BEGIN SET @CheckUserDatabaseObjects = 0; - PRINT 'Running sp_Blitz @CheckUserDatabaseObjects = 1 on a server with 50+ databases may cause temporary insanity for the server and/or user.'; + PRINT 'Running sp_Blitz @CheckUserDatabaseObjects = 1 on a server with 50+ databases may cause temporary problems for the server and/or user.'; PRINT 'If you''re sure you want to do this, run again with the parameter @BringThePain = 1.'; INSERT INTO #BlitzResults ( CheckID , @@ -23015,7 +23015,7 @@ Known limitations of this version: filegroup/partition scheme etc.) -- (The compression and filegroup index create syntax is not trivial because it is set at the partition level and is not trivial to code.) - - Does not advise you about data modeling for clustered indexes and primary keys (primarily looks for signs of insanity.) + - Does not advise you about data modeling for clustered indexes and primary keys (primarily looks for signs of problems.) Unknown limitations of this version: - We knew them once, but we forgot. @@ -23857,7 +23857,7 @@ BEGIN TRY VALUES ( 1, 0, N'You''re trying to run sp_BlitzIndex on a server with ' + CAST(@NumDatabases AS NVARCHAR(8)) + N' databases. ', - N'Running sp_BlitzIndex on a server with 50+ databases may cause temporary insanity for the server and/or user.', + N'Running sp_BlitzIndex on a server with 50+ databases may cause temporary problems for the server and/or user.', N'If you''re sure you want to do this, run again with the parameter @BringThePain = 1.', 'http://FirstResponderKit.org', '', @@ -23884,7 +23884,7 @@ BEGIN TRY bir.create_tsql, bir.more_info FROM #BlitzIndexResults AS bir; - RAISERROR('Running sp_BlitzIndex on a server with 50+ databases may cause temporary insanity for the server', 12, 1); + RAISERROR('Running sp_BlitzIndex on a server with 50+ databases may cause temporary problems for the server', 12, 1); END; RETURN; diff --git a/Install-Core-Blitz-No-Query-Store.sql b/Install-Core-Blitz-No-Query-Store.sql index 58cd0519..2b2dcc93 100644 --- a/Install-Core-Blitz-No-Query-Store.sql +++ b/Install-Core-Blitz-No-Query-Store.sql @@ -1160,7 +1160,7 @@ AS IF @BringThePain = 0 AND 50 <= (SELECT COUNT(*) FROM sys.databases) AND @CheckUserDatabaseObjects = 1 BEGIN SET @CheckUserDatabaseObjects = 0; - PRINT 'Running sp_Blitz @CheckUserDatabaseObjects = 1 on a server with 50+ databases may cause temporary insanity for the server and/or user.'; + PRINT 'Running sp_Blitz @CheckUserDatabaseObjects = 1 on a server with 50+ databases may cause temporary problems for the server and/or user.'; PRINT 'If you''re sure you want to do this, run again with the parameter @BringThePain = 1.'; INSERT INTO #BlitzResults ( CheckID , @@ -20153,7 +20153,7 @@ Known limitations of this version: filegroup/partition scheme etc.) -- (The compression and filegroup index create syntax is not trivial because it is set at the partition level and is not trivial to code.) - - Does not advise you about data modeling for clustered indexes and primary keys (primarily looks for signs of insanity.) + - Does not advise you about data modeling for clustered indexes and primary keys (primarily looks for signs of problems.) Unknown limitations of this version: - We knew them once, but we forgot. @@ -20995,7 +20995,7 @@ BEGIN TRY VALUES ( 1, 0, N'You''re trying to run sp_BlitzIndex on a server with ' + CAST(@NumDatabases AS NVARCHAR(8)) + N' databases. ', - N'Running sp_BlitzIndex on a server with 50+ databases may cause temporary insanity for the server and/or user.', + N'Running sp_BlitzIndex on a server with 50+ databases may cause temporary problems for the server and/or user.', N'If you''re sure you want to do this, run again with the parameter @BringThePain = 1.', 'http://FirstResponderKit.org', '', @@ -21022,7 +21022,7 @@ BEGIN TRY bir.create_tsql, bir.more_info FROM #BlitzIndexResults AS bir; - RAISERROR('Running sp_BlitzIndex on a server with 50+ databases may cause temporary insanity for the server', 12, 1); + RAISERROR('Running sp_BlitzIndex on a server with 50+ databases may cause temporary problems for the server', 12, 1); END; RETURN; diff --git a/Install-Core-Blitz-With-Query-Store.sql b/Install-Core-Blitz-With-Query-Store.sql index 2724cc92..f6241092 100644 --- a/Install-Core-Blitz-With-Query-Store.sql +++ b/Install-Core-Blitz-With-Query-Store.sql @@ -1160,7 +1160,7 @@ AS IF @BringThePain = 0 AND 50 <= (SELECT COUNT(*) FROM sys.databases) AND @CheckUserDatabaseObjects = 1 BEGIN SET @CheckUserDatabaseObjects = 0; - PRINT 'Running sp_Blitz @CheckUserDatabaseObjects = 1 on a server with 50+ databases may cause temporary insanity for the server and/or user.'; + PRINT 'Running sp_Blitz @CheckUserDatabaseObjects = 1 on a server with 50+ databases may cause temporary problems for the server and/or user.'; PRINT 'If you''re sure you want to do this, run again with the parameter @BringThePain = 1.'; INSERT INTO #BlitzResults ( CheckID , @@ -20153,7 +20153,7 @@ Known limitations of this version: filegroup/partition scheme etc.) -- (The compression and filegroup index create syntax is not trivial because it is set at the partition level and is not trivial to code.) - - Does not advise you about data modeling for clustered indexes and primary keys (primarily looks for signs of insanity.) + - Does not advise you about data modeling for clustered indexes and primary keys (primarily looks for signs of problems.) Unknown limitations of this version: - We knew them once, but we forgot. @@ -20995,7 +20995,7 @@ BEGIN TRY VALUES ( 1, 0, N'You''re trying to run sp_BlitzIndex on a server with ' + CAST(@NumDatabases AS NVARCHAR(8)) + N' databases. ', - N'Running sp_BlitzIndex on a server with 50+ databases may cause temporary insanity for the server and/or user.', + N'Running sp_BlitzIndex on a server with 50+ databases may cause temporary problems for the server and/or user.', N'If you''re sure you want to do this, run again with the parameter @BringThePain = 1.', 'http://FirstResponderKit.org', '', @@ -21022,7 +21022,7 @@ BEGIN TRY bir.create_tsql, bir.more_info FROM #BlitzIndexResults AS bir; - RAISERROR('Running sp_BlitzIndex on a server with 50+ databases may cause temporary insanity for the server', 12, 1); + RAISERROR('Running sp_BlitzIndex on a server with 50+ databases may cause temporary problems for the server', 12, 1); END; RETURN; diff --git a/sp_Blitz.sql b/sp_Blitz.sql index b7792b21..52b79967 100644 --- a/sp_Blitz.sql +++ b/sp_Blitz.sql @@ -1198,7 +1198,7 @@ AS IF @BringThePain = 0 AND 50 <= (SELECT COUNT(*) FROM sys.databases) AND @CheckUserDatabaseObjects = 1 BEGIN SET @CheckUserDatabaseObjects = 0; - PRINT 'Running sp_Blitz @CheckUserDatabaseObjects = 1 on a server with 50+ databases may cause temporary insanity for the server and/or user.'; + PRINT 'Running sp_Blitz @CheckUserDatabaseObjects = 1 on a server with 50+ databases may cause temporary problems for the server and/or user.'; PRINT 'If you''re sure you want to do this, run again with the parameter @BringThePain = 1.'; INSERT INTO #BlitzResults ( CheckID , diff --git a/sp_BlitzIndex.sql b/sp_BlitzIndex.sql index 400713fe..a3409527 100644 --- a/sp_BlitzIndex.sql +++ b/sp_BlitzIndex.sql @@ -77,7 +77,7 @@ Known limitations of this version: filegroup/partition scheme etc.) -- (The compression and filegroup index create syntax is not trivial because it is set at the partition level and is not trivial to code.) - - Does not advise you about data modeling for clustered indexes and primary keys (primarily looks for signs of insanity.) + - Does not advise you about data modeling for clustered indexes and primary keys (primarily looks for signs of problems.) Unknown limitations of this version: - We knew them once, but we forgot. @@ -924,7 +924,7 @@ BEGIN TRY VALUES ( 1, 0, N'You''re trying to run sp_BlitzIndex on a server with ' + CAST(@NumDatabases AS NVARCHAR(8)) + N' databases. ', - N'Running sp_BlitzIndex on a server with 50+ databases may cause temporary insanity for the server and/or user.', + N'Running sp_BlitzIndex on a server with 50+ databases may cause temporary problems for the server and/or user.', N'If you''re sure you want to do this, run again with the parameter @BringThePain = 1.', 'http://FirstResponderKit.org', '', @@ -951,7 +951,7 @@ BEGIN TRY bir.create_tsql, bir.more_info FROM #BlitzIndexResults AS bir; - RAISERROR('Running sp_BlitzIndex on a server with 50+ databases may cause temporary insanity for the server', 12, 1); + RAISERROR('Running sp_BlitzIndex on a server with 50+ databases may cause temporary problems for the server', 12, 1); END; RETURN; From cfbf261e20f777f32e1315039ed0c026d309992f Mon Sep 17 00:00:00 2001 From: Sean Killeen Date: Tue, 16 Jan 2024 12:05:20 -0500 Subject: [PATCH 18/33] Revert changes to install scripts --- Install-All-Scripts.sql | 112 ++++++++++++------------ Install-Core-Blitz-No-Query-Store.sql | 102 ++++++++++----------- Install-Core-Blitz-With-Query-Store.sql | 112 ++++++++++++------------ 3 files changed, 163 insertions(+), 163 deletions(-) diff --git a/Install-All-Scripts.sql b/Install-All-Scripts.sql index 9fa75fdd..0cf3afc9 100644 --- a/Install-All-Scripts.sql +++ b/Install-All-Scripts.sql @@ -3585,7 +3585,7 @@ AS SET @CheckUserDatabaseObjects = 0; PRINT 'Databases with compatibility level < 90 found, so setting @CheckUserDatabaseObjects = 0.'; PRINT 'The database-level checks rely on CTEs, which are not supported in SQL 2000 compat level databases.'; - PRINT 'Get with the cool kids and switch to a current compatibility level, Grandpa. To find the problems, run:'; + PRINT 'Get with the cool kids and switch to a current compatibility level, Grandpa. To find the insanity, run:'; PRINT 'SELECT * FROM sys.databases WHERE compatibility_level < 90;'; INSERT INTO #BlitzResults ( CheckID , @@ -4022,7 +4022,7 @@ AS IF @BringThePain = 0 AND 50 <= (SELECT COUNT(*) FROM sys.databases) AND @CheckUserDatabaseObjects = 1 BEGIN SET @CheckUserDatabaseObjects = 0; - PRINT 'Running sp_Blitz @CheckUserDatabaseObjects = 1 on a server with 50+ databases may cause temporary problems for the server and/or user.'; + PRINT 'Running sp_Blitz @CheckUserDatabaseObjects = 1 on a server with 50+ databases may cause temporary insanity for the server and/or user.'; PRINT 'If you''re sure you want to do this, run again with the parameter @BringThePain = 1.'; INSERT INTO #BlitzResults ( CheckID , @@ -4117,9 +4117,9 @@ AS Below, we check master.sys.databases looking for databases that haven't had a backup in the last week. If we find any, we insert them into #BlitzResults, the temp table that - tracks our server's problems. Note that if the check does - NOT find any problems, we don't save that. We're only - saving the problems, not the successful checks. + tracks our server's insanity. Note that if the check does + NOT find any insanity, we don't save that. We're only + saving the insanity, not the successful checks. */ IF @Debug IN (1, 2) RAISERROR('Running CheckId [%d].', 0, 1, 1) WITH NOWAIT; @@ -4209,7 +4209,7 @@ AS And there you have it. The rest of this stored procedure works the same way: it asks: - Should I skip this check? - - If not, do I find problems? + - If not, do I find insanity? - Insert the results into #BlitzResults */ @@ -4757,7 +4757,7 @@ AS 'https://www.brentozar.com/go/owners' AS URL , ( 'Job [' + j.name + '] is owned by [' + SUSER_SNAME(j.owner_sid) - + '] - meaning if their login is disabled or not available due to Active Directory problems, the job will stop working.' ) AS Details + + '] - meaning if their login is disabled or not available due to Active Directory insanity, the job will stop working.' ) AS Details FROM msdb.dbo.sysjobs j WHERE j.enabled = 1 AND SUSER_SNAME(j.owner_sid) <> SUSER_SNAME(0x01); @@ -6665,7 +6665,7 @@ AS 'Performance' AS FindingGroup , 'CPU Schedulers Offline' AS Finding , 'https://www.brentozar.com/go/schedulers' AS URL , - 'Some CPU cores are not accessible to SQL Server due to affinity masking or licensing problems.'; + 'Some CPU cores are not accessible to SQL Server due to affinity masking or licensing insanity.'; END; IF NOT EXISTS ( SELECT 1 @@ -6693,7 +6693,7 @@ AS ''Performance'' AS FindingGroup , ''Memory Nodes Offline'' AS Finding , ''https://www.brentozar.com/go/schedulers'' AS URL , - ''Due to affinity masking or licensing problems, some of the memory may not be available.'' OPTION (RECOMPILE)'; + ''Due to affinity masking or licensing insanity, some of the memory may not be available.'' OPTION (RECOMPILE)'; IF @Debug = 2 AND @StringToExecute IS NOT NULL PRINT @StringToExecute; IF @Debug = 2 AND @StringToExecute IS NULL PRINT '@StringToExecute has gone NULL, for some reason.'; @@ -6780,7 +6780,7 @@ AS 'Performance' AS FindingGroup , 'Poison Wait Detected: ' + wait_type AS Finding , 'https://www.brentozar.com/go/poison/#' + wait_type AS URL , - CONVERT(VARCHAR(10), (SUM([wait_time_ms]) / 1000) / 86400) + ':' + CONVERT(VARCHAR(20), DATEADD(s, (SUM([wait_time_ms]) / 1000), 0), 108) + ' of this wait have been recorded. This wait often indicates killer performance problems.' + CONVERT(VARCHAR(10), (SUM([wait_time_ms]) / 1000) / 86400) + ':' + CONVERT(VARCHAR(20), DATEADD(s, (SUM([wait_time_ms]) / 1000), 0), 108) + ' of this wait have been recorded. This wait often indicates killer performance insanity.' FROM sys.[dm_os_wait_stats] WHERE wait_type IN('IO_QUEUE_LIMIT', 'IO_RETRY', 'LOG_RATE_GOVERNOR', 'POOL_LOG_RATE_GOVERNOR', 'PREEMPTIVE_DEBUG', 'RESMGR_THROTTLED', 'RESOURCE_SEMAPHORE', 'RESOURCE_SEMAPHORE_QUERY_COMPILE','SE_REPL_CATCHUP_THROTTLE','SE_REPL_COMMIT_ACK','SE_REPL_COMMIT_TURN','SE_REPL_ROLLBACK_ACK','SE_REPL_SLOW_SECONDARY_THROTTLE','THREADPOOL') GROUP BY wait_type @@ -6808,7 +6808,7 @@ AS 'Performance' AS FindingGroup , 'Poison Wait Detected: Serializable Locking' AS Finding , 'https://www.brentozar.com/go/serializable' AS URL , - CONVERT(VARCHAR(10), (SUM([wait_time_ms]) / 1000) / 86400) + ':' + CONVERT(VARCHAR(20), DATEADD(s, (SUM([wait_time_ms]) / 1000), 0), 108) + ' of LCK_M_R% waits have been recorded. This wait often indicates killer performance problems.' + CONVERT(VARCHAR(10), (SUM([wait_time_ms]) / 1000) / 86400) + ':' + CONVERT(VARCHAR(20), DATEADD(s, (SUM([wait_time_ms]) / 1000), 0), 108) + ' of LCK_M_R% waits have been recorded. This wait often indicates killer performance insanity.' FROM sys.[dm_os_wait_stats] WHERE wait_type IN ('LCK_M_RS_S', 'LCK_M_RS_U', 'LCK_M_RIn_NL','LCK_M_RIn_S', 'LCK_M_RIn_U','LCK_M_RIn_X', 'LCK_M_RX_S', 'LCK_M_RX_U','LCK_M_RX_X') HAVING SUM([wait_time_ms]) > (SELECT 5000 * datediff(HH,create_date,CURRENT_TIMESTAMP) AS hours_since_startup FROM sys.databases WHERE name='tempdb') @@ -10016,7 +10016,7 @@ IF @ProductVersionMajor >= 10 ''Performance'' AS FindingsGroup, ''Fill Factor Changed'', ''https://www.brentozar.com/go/fillfactor'' AS URL, - ''The ['' + DB_NAME() + ''] database has '' + CAST(SUM(1) AS NVARCHAR(50)) + '' objects with fill factor = '' + CAST(fill_factor AS NVARCHAR(5)) + ''%. This can cause memory and storage performance problems, but may also prevent page splits.'' + ''The ['' + DB_NAME() + ''] database has '' + CAST(SUM(1) AS NVARCHAR(50)) + '' objects with fill factor = '' + CAST(fill_factor AS NVARCHAR(5)) + ''%. This can cause memory and storage performance insanity, but may also prevent page splits.'' FROM [?].sys.indexes WHERE fill_factor <> 0 AND fill_factor < 80 AND is_disabled = 0 AND is_hypothetical = 0 GROUP BY fill_factor OPTION (RECOMPILE);'; @@ -10999,7 +10999,7 @@ IF @ProductVersionMajor >= 10 'Security' AS [FindingsGroup] , 'Endpoints Owned by Users' AS [Finding] , 'https://www.brentozar.com/go/owners' AS [URL] , - ( 'Endpoint ' + ep.[name] + ' is owned by ' + SUSER_NAME(ep.principal_id) + '. If the endpoint owner login is disabled or not available due to Active Directory problems, the high availability will stop working.' + ( 'Endpoint ' + ep.[name] + ' is owned by ' + SUSER_NAME(ep.principal_id) + '. If the endpoint owner login is disabled or not available due to Active Directory insanity, the high availability will stop working.' ) AS [Details] FROM sys.database_mirroring_endpoints ep LEFT OUTER JOIN sys.dm_server_services s ON SUSER_NAME(ep.principal_id) = s.service_account @@ -14687,7 +14687,7 @@ RAISERROR('Rules analysis starting', 0, 1) WITH NOWAIT; INSERT #Warnings (CheckId, Priority, DatabaseName, Finding, Warning ) EXEC sys.sp_executesql @StringToExecute; - /*Looking for compatibility level changing. Only looking for databases that have changed more than twice (It''s possible someone may have changed up, had CE problems, and then changed back)*/ + /*Looking for compatibility level changing. Only looking for databases that have changed more than twice (It''s possible someone may have changed up, had CE insanity, and then changed back)*/ SET @StringToExecute = N'SET TRANSACTION ISOLATION LEVEL READ UNCOMMITTED;' + @crlf; @@ -20235,7 +20235,7 @@ RAISERROR('Checking for plans with no warnings', 0, 1) WITH NOWAIT; UPDATE ##BlitzCacheProcs SET Warnings = 'No warnings detected. ' + CASE @ExpertMode WHEN 0 - THEN ' Try running sp_BlitzCache with @ExpertMode = 1 to find more advanced problems.' + THEN ' Try running sp_BlitzCache with @ExpertMode = 1 to find more advanced insanity.' ELSE '' END WHERE Warnings = '' OR Warnings IS NULL @@ -20943,7 +20943,7 @@ BEGIN 'Performance', 'Function Join', 'https://www.brentozar.com/blitzcache/tvf-join/', - 'Execution plans have been found that join to table valued functions (TVFs). TVFs produce inaccurate estimates of the number of rows returned and can lead to any number of query plan problems.'); + 'Execution plans have been found that join to table valued functions (TVFs). TVFs produce inaccurate estimates of the number of rows returned and can lead to any number of query plan insanity.'); IF EXISTS (SELECT 1/0 FROM ##BlitzCacheProcs @@ -21256,7 +21256,7 @@ BEGIN 'Functions', 'Computed Column UDF', 'https://www.brentozar.com/blitzcache/computed-columns-referencing-functions/', - 'This can cause a whole mess of bad serializartion problems.') ; + 'This can cause a whole mess of bad serializartion insanity.') ; IF EXISTS (SELECT 1/0 FROM ##BlitzCacheProcs p @@ -21510,7 +21510,7 @@ BEGIN 'Functions', 'MSTVFs', 'https://www.brentozar.com/blitzcache/tvf-join/', - 'Execution plans have been found that join to table valued functions (TVFs). TVFs produce inaccurate estimates of the number of rows returned and can lead to any number of query plan problems.'); + 'Execution plans have been found that join to table valued functions (TVFs). TVFs produce inaccurate estimates of the number of rows returned and can lead to any number of query plan insanity.'); IF EXISTS (SELECT 1/0 FROM ##BlitzCacheProcs p @@ -23015,7 +23015,7 @@ Known limitations of this version: filegroup/partition scheme etc.) -- (The compression and filegroup index create syntax is not trivial because it is set at the partition level and is not trivial to code.) - - Does not advise you about data modeling for clustered indexes and primary keys (primarily looks for signs of problems.) + - Does not advise you about data modeling for clustered indexes and primary keys (primarily looks for signs of insanity.) Unknown limitations of this version: - We knew them once, but we forgot. @@ -23857,7 +23857,7 @@ BEGIN TRY VALUES ( 1, 0, N'You''re trying to run sp_BlitzIndex on a server with ' + CAST(@NumDatabases AS NVARCHAR(8)) + N' databases. ', - N'Running sp_BlitzIndex on a server with 50+ databases may cause temporary problems for the server and/or user.', + N'Running sp_BlitzIndex on a server with 50+ databases may cause temporary insanity for the server and/or user.', N'If you''re sure you want to do this, run again with the parameter @BringThePain = 1.', 'http://FirstResponderKit.org', '', @@ -23884,7 +23884,7 @@ BEGIN TRY bir.create_tsql, bir.more_info FROM #BlitzIndexResults AS bir; - RAISERROR('Running sp_BlitzIndex on a server with 50+ databases may cause temporary problems for the server', 12, 1); + RAISERROR('Running sp_BlitzIndex on a server with 50+ databases may cause temporary insanity for the server', 12, 1); END; RETURN; @@ -28007,7 +28007,7 @@ BEGIN INSERT #BlitzIndexResults ( Priority, check_id, findings_group, finding, URL, details, index_definition, index_usage_summary, index_size_summary ) VALUES ( 1, 0 , - N'No Major Problems Found', + N'No Major insanity Found', N'Nice Work!', N'http://FirstResponderKit.org', N'Consider running with @Mode = 4 in individual databases (not all) for more detailed diagnostics.', @@ -28029,7 +28029,7 @@ BEGIN INSERT #BlitzIndexResults ( Priority, check_id, findings_group, finding, URL, details, index_definition, index_usage_summary, index_size_summary ) VALUES ( 1, 0 , - N'No Problems Found', + N'No insanity Found', N'Nice job! Or more likely, you have a nearly empty database.', N'http://FirstResponderKit.org', 'Time to go read some blog posts.', @DaysUptimeInsertValue, N'', N'' @@ -38335,7 +38335,7 @@ BEGIN 'Performance', 'Joining to table valued functions', 'https://www.brentozar.com/blitzcache/tvf-join/', - 'Execution plans have been found that join to table valued functions (TVFs). TVFs produce inaccurate estimates of the number of rows returned and can lead to any number of query plan problems.'); + 'Execution plans have been found that join to table valued functions (TVFs). TVFs produce inaccurate estimates of the number of rows returned and can lead to any number of query plan insanity.'); IF EXISTS (SELECT 1/0 FROM #working_warnings @@ -38636,7 +38636,7 @@ BEGIN 'Computed Columns Referencing Scalar UDFs', 'This makes a whole lot of stuff run serially', 'https://www.brentozar.com/blitzcache/computed-columns-referencing-functions/', - 'This can cause a whole mess of bad serializartion problems.') ; + 'This can cause a whole mess of bad serializartion insanity.') ; IF EXISTS (SELECT 1/0 FROM #working_warnings p @@ -38844,7 +38844,7 @@ BEGIN 'High tempdb use', 'This query uses more than half of a data file on average', 'No URL yet', - 'You should take a look at tempdb waits to see if you''re having problems') ; + 'You should take a look at tempdb waits to see if you''re having insanity') ; IF EXISTS (SELECT 1/0 FROM #working_warnings p @@ -38867,9 +38867,9 @@ BEGIN 60, 100, 'MSTVFs', - 'These have many of the same problems scalar UDFs have', + 'These have many of the same insanity scalar UDFs have', 'https://www.brentozar.com/blitzcache/tvf-join/', - 'Execution plans have been found that join to table valued functions (TVFs). TVFs produce inaccurate estimates of the number of rows returned and can lead to any number of query plan problems.'); + 'Execution plans have been found that join to table valued functions (TVFs). TVFs produce inaccurate estimates of the number of rows returned and can lead to any number of query plan insanity.'); IF EXISTS (SELECT 1/0 FROM #working_warnings p @@ -44861,7 +44861,7 @@ BEGIN AND r.database_id NOT IN (SELECT database_id FROM #ReadableDBs); END - /* Query Problems - Long-Running Query Blocking Others - CheckID 5 */ + /* Query insanity - Long-Running Query Blocking Others - CheckID 5 */ IF SERVERPROPERTY('EngineEdition') <> 5 /*SERVERPROPERTY('Edition') <> 'SQL Azure'*/ AND @Seconds > 0 AND EXISTS(SELECT * FROM sys.dm_os_waiting_tasks WHERE wait_type LIKE 'LCK%' AND wait_duration_ms > 30000) BEGIN IF (@Debug = 1) @@ -44872,7 +44872,7 @@ BEGIN SET @StringToExecute = N'INSERT INTO #BlitzFirstResults (CheckID, Priority, FindingsGroup, Finding, URL, Details, HowToStopIt, QueryPlan, QueryText, StartTime, LoginName, NTUserName, ProgramName, HostName, DatabaseID, DatabaseName, OpenTransactionCount, QueryHash) SELECT 5 AS CheckID, 1 AS Priority, - ''Query Problems'' AS FindingGroup, + ''Query insanity'' AS FindingGroup, ''Long-Running Query Blocking Others'' AS Finding, ''https://www.brentozar.com/go/blocking'' AS URL, ''Query in '' + COALESCE(DB_NAME(COALESCE((SELECT TOP 1 dbid FROM sys.dm_exec_sql_text(r.sql_handle)), @@ -44904,7 +44904,7 @@ BEGIN EXECUTE sp_executesql @StringToExecute; END; - /* Query Problems - Plan Cache Erased Recently - CheckID 7 */ + /* Query insanity - Plan Cache Erased Recently - CheckID 7 */ IF DATEADD(mi, -15, SYSDATETIME()) < (SELECT TOP 1 creation_time FROM sys.dm_exec_query_stats ORDER BY creation_time) BEGIN IF (@Debug = 1) @@ -44915,7 +44915,7 @@ BEGIN INSERT INTO #BlitzFirstResults (CheckID, Priority, FindingsGroup, Finding, URL, Details, HowToStopIt) SELECT TOP 1 7 AS CheckID, 50 AS Priority, - 'Query Problems' AS FindingGroup, + 'Query insanity' AS FindingGroup, 'Plan Cache Erased Recently' AS Finding, 'https://www.brentozar.com/askbrent/plan-cache-erased-recently/' AS URL, 'The oldest query in the plan cache was created at ' + CAST(creation_time AS NVARCHAR(50)) + '. ' + @LineFeed + @LineFeed @@ -44929,7 +44929,7 @@ BEGIN END; - /* Query Problems - Sleeping Query with Open Transactions - CheckID 8 */ + /* Query insanity - Sleeping Query with Open Transactions - CheckID 8 */ IF @Seconds > 0 BEGIN IF (@Debug = 1) @@ -44941,7 +44941,7 @@ BEGIN INSERT INTO #BlitzFirstResults (CheckID, Priority, FindingsGroup, Finding, URL, Details, HowToStopIt, StartTime, LoginName, NTUserName, ProgramName, HostName, DatabaseID, DatabaseName, QueryText, OpenTransactionCount) SELECT 8 AS CheckID, 50 AS Priority, - 'Query Problems' AS FindingGroup, + 'Query insanity' AS FindingGroup, 'Sleeping Query with Open Transactions' AS Finding, 'https://www.brentozar.com/askbrent/sleeping-query-with-open-transactions/' AS URL, 'Database: ' + DB_NAME(db.resource_database_id) + @LineFeed + 'Host: ' + s.hostname + @LineFeed + 'Program: ' + s.[program_name] + @LineFeed + 'Asleep with open transactions and locks since ' + CAST(s.last_batch AS NVARCHAR(100)) + '. ' AS Details, @@ -44971,7 +44971,7 @@ BEGIN AND NOT (resource_type = N'DATABASE' AND request_mode = N'S' AND request_status = N'GRANT' AND request_owner_type = N'SHARED_TRANSACTION_WORKSPACE')); END - /*Query Problems - Clients using implicit transactions - CheckID 37 */ + /*Query insanity - Clients using implicit transactions - CheckID 37 */ IF @Seconds > 0 AND ( @@VERSION NOT LIKE 'Microsoft SQL Server 2005%' AND @@VERSION NOT LIKE 'Microsoft SQL Server 2008%' @@ -44985,7 +44985,7 @@ BEGIN SET @StringToExecute = N'INSERT INTO #BlitzFirstResults (CheckID, Priority, FindingsGroup, Finding, URL, Details, HowToStopIt, StartTime, LoginName, NTUserName, ProgramName, HostName, DatabaseID, DatabaseName, QueryText, OpenTransactionCount) SELECT 37 AS CheckId, 50 AS Priority, - ''Query Problems'' AS FindingsGroup, + ''Query insanity'' AS FindingsGroup, ''Implicit Transactions'', ''https://www.brentozar.com/go/ImplicitTransactions/'' AS URL, ''Database: '' + DB_NAME(s.database_id) + '' '' + CHAR(13) + CHAR(10) + @@ -45016,7 +45016,7 @@ If one of them is a lead blocker, consider killing that query.'' AS HowToStopit, EXECUTE sp_executesql @StringToExecute; END; - /* Query Problems - Query Rolling Back - CheckID 9 */ + /* Query insanity - Query Rolling Back - CheckID 9 */ IF @Seconds > 0 BEGIN IF (@Debug = 1) @@ -45028,7 +45028,7 @@ If one of them is a lead blocker, consider killing that query.'' AS HowToStopit, INSERT INTO #BlitzFirstResults (CheckID, Priority, FindingsGroup, Finding, URL, Details, HowToStopIt, StartTime, LoginName, NTUserName, ProgramName, HostName, DatabaseID, DatabaseName, QueryText, QueryHash) SELECT 9 AS CheckID, 1 AS Priority, - 'Query Problems' AS FindingGroup, + 'Query insanity' AS FindingGroup, 'Query Rolling Back' AS Finding, 'https://www.brentozar.com/askbrent/rollback/' AS URL, 'Rollback started at ' + CAST(r.start_time AS NVARCHAR(100)) + ', is ' + CAST(r.percent_complete AS NVARCHAR(100)) + '% complete.' AS Details, @@ -45061,7 +45061,7 @@ If one of them is a lead blocker, consider killing that query.'' AS HowToStopit, SELECT 47 AS CheckId, 50 AS Priority, - 'Query Problems' AS FindingsGroup, + 'Query insanity' AS FindingsGroup, 'High Percentage Of Runnable Queries' AS Finding, 'https://erikdarlingdata.com/go/RunnableQueue/' AS URL, 'On the ' @@ -45237,7 +45237,7 @@ If one of them is a lead blocker, consider killing that query.'' AS HowToStopit, 'https://www.brentozar.com/askbrent/' AS URL FROM sys.dm_exec_query_memory_grants AS Grants; - /* Query Problems - Queries with high memory grants - CheckID 46 */ + /* Query insanity - Queries with high memory grants - CheckID 46 */ IF (@Debug = 1) BEGIN RAISERROR('Running CheckID 46',10,1) WITH NOWAIT; @@ -45246,7 +45246,7 @@ If one of them is a lead blocker, consider killing that query.'' AS HowToStopit, INSERT INTO #BlitzFirstResults (CheckID, Priority, FindingsGroup, Finding, Details, URL, QueryText, QueryPlan) SELECT 46 AS CheckID, 100 AS Priority, - 'Query Problems' AS FindingGroup, + 'Query insanity' AS FindingGroup, 'Query with a memory grant exceeding ' +CAST(@MemoryGrantThresholdPct AS NVARCHAR(15)) +'%' AS Finding, @@ -45267,7 +45267,7 @@ If one of them is a lead blocker, consider killing that query.'' AS HowToStopit, OUTER APPLY sys.dm_exec_query_plan(Grants.[plan_handle]) AS QueryPlan WHERE Grants.granted_memory_kb > ((@MemoryGrantThresholdPct/100.00)*(@MaxWorkspace*1024)); - /* Query Problems - Memory Leak in USERSTORE_TOKENPERM Cache - CheckID 45 */ + /* Query insanity - Memory Leak in USERSTORE_TOKENPERM Cache - CheckID 45 */ IF EXISTS (SELECT * FROM sys.all_columns WHERE object_id = OBJECT_ID('sys.dm_os_memory_clerks') AND name = 'pages_kb') BEGIN IF (@Debug = 1) @@ -45280,7 +45280,7 @@ If one of them is a lead blocker, consider killing that query.'' AS HowToStopit, INSERT INTO #BlitzFirstResults (CheckID, Priority, FindingsGroup, Finding, Details, URL) SELECT 45 AS CheckID, 50 AS Priority, - ''Query Problems'' AS FindingsGroup, + ''Query insanity'' AS FindingsGroup, ''Memory Leak in USERSTORE_TOKENPERM Cache'' AS Finding, N''UserStore_TokenPerm clerk is using '' + CAST(CAST(SUM(CASE WHEN type = ''USERSTORE_TOKENPERM'' AND name = ''TokenAndPermUserStore'' THEN pages_kb * 1.0 ELSE 0.0 END) / 1024.0 / 1024.0 AS INT) AS NVARCHAR(100)) + N''GB RAM, total buffer pool is '' + CAST(CAST(SUM(pages_kb) / 1024.0 / 1024.0 AS INT) AS NVARCHAR(100)) + N''GB.'' @@ -45640,7 +45640,7 @@ If one of them is a lead blocker, consider killing that query.'' AS HowToStopit, END; /* IF @Seconds < 30 */ - /* Query Problems - Statistics Updated Recently - CheckID 44 */ + /* Query insanity - Statistics Updated Recently - CheckID 44 */ IF (@Debug = 1) BEGIN RAISERROR('Running CheckID 44',10,1) WITH NOWAIT; @@ -45734,7 +45734,7 @@ If one of them is a lead blocker, consider killing that query.'' AS HowToStopit, INSERT INTO #BlitzFirstResults (CheckID, Priority, FindingsGroup, Finding, URL, Details, HowToStopIt) SELECT 44 AS CheckId, 50 AS Priority, - 'Query Problems' AS FindingGroup, + 'Query insanity' AS FindingGroup, 'Statistics Updated Recently' AS Finding, 'https://www.brentozar.com/go/stats' AS URL, 'In the last 15 minutes, statistics were updated. To see which ones, click the HowToStopIt column.' + @LineFeed + @LineFeed @@ -46256,7 +46256,7 @@ If one of them is a lead blocker, consider killing that query.'' AS HowToStopit, AND counter_name = 'Log Shrinks' AND value_delta > 0; - /* Query Problems - Compilations/Sec High - CheckID 15 */ + /* Query insanity - Compilations/Sec High - CheckID 15 */ IF (@Debug = 1) BEGIN RAISERROR('Running CheckID 15',10,1) WITH NOWAIT; @@ -46265,7 +46265,7 @@ If one of them is a lead blocker, consider killing that query.'' AS HowToStopit, INSERT INTO #BlitzFirstResults (CheckID, Priority, FindingsGroup, Finding, URL, Details, HowToStopIt) SELECT 15 AS CheckID, 50 AS Priority, - 'Query Problems' AS FindingGroup, + 'Query insanity' AS FindingGroup, 'Compilations/Sec High' AS Finding, 'https://www.brentozar.com/askbrent/compilations/' AS URL, 'Number of batch requests during the sample: ' + CAST(ps.value_delta AS NVARCHAR(20)) + @LineFeed @@ -46283,7 +46283,7 @@ If one of them is a lead blocker, consider killing that query.'' AS HowToStopit, AND (psComp.value_delta > (10 * @Seconds) OR psComp.value_delta > ps.value_delta) /* Either doing 10 compilations per second, or more compilations than queries */ AND (psComp.value_delta * 10) > ps.value_delta; /* Compilations are more than 10% of batch requests per second */ - /* Query Problems - Re-Compilations/Sec High - CheckID 16 */ + /* Query insanity - Re-Compilations/Sec High - CheckID 16 */ IF (@Debug = 1) BEGIN RAISERROR('Running CheckID 16',10,1) WITH NOWAIT; @@ -46292,7 +46292,7 @@ If one of them is a lead blocker, consider killing that query.'' AS HowToStopit, INSERT INTO #BlitzFirstResults (CheckID, Priority, FindingsGroup, Finding, URL, Details, HowToStopIt) SELECT 16 AS CheckID, 50 AS Priority, - 'Query Problems' AS FindingGroup, + 'Query insanity' AS FindingGroup, 'Re-Compilations/Sec High' AS Finding, 'https://www.brentozar.com/askbrent/recompilations/' AS URL, 'Number of batch requests during the sample: ' + CAST(ps.value_delta AS NVARCHAR(20)) + @LineFeed @@ -46310,7 +46310,7 @@ If one of them is a lead blocker, consider killing that query.'' AS HowToStopit, AND (psComp.value_delta > (10 * @Seconds) OR psComp.value_delta > ps.value_delta) /* Either doing 10 recompilations per second, or more recompilations than queries */ AND (psComp.value_delta * 10) > ps.value_delta; /* Recompilations are more than 10% of batch requests per second */ - /* Table Problems - Forwarded Fetches/Sec High - CheckID 29 */ + /* Table insanity - Forwarded Fetches/Sec High - CheckID 29 */ IF (@Debug = 1) BEGIN RAISERROR('Running CheckID 29',10,1) WITH NOWAIT; @@ -46319,7 +46319,7 @@ If one of them is a lead blocker, consider killing that query.'' AS HowToStopit, INSERT INTO #BlitzFirstResults (CheckID, Priority, FindingsGroup, Finding, URL, Details, HowToStopIt) SELECT 29 AS CheckID, 40 AS Priority, - 'Table Problems' AS FindingGroup, + 'Table insanity' AS FindingGroup, 'Forwarded Fetches/Sec High' AS Finding, 'https://www.brentozar.com/go/fetch/' AS URL, CAST(ps.value_delta AS NVARCHAR(20)) + ' forwarded fetches (from SQLServer:Access Methods counter)' + @LineFeed @@ -46340,7 +46340,7 @@ If one of them is a lead blocker, consider killing that query.'' AS HowToStopit, INSERT INTO #BlitzFirstResults (CheckID, Priority, FindingsGroup, Finding, URL, Details, HowToStopIt) SELECT TOP 10 29 AS CheckID, 40 AS Priority, - ''Table Problems'' AS FindingGroup, + ''Table insanity'' AS FindingGroup, ''Forwarded Fetches/Sec High: TempDB Object'' AS Finding, ''https://www.brentozar.com/go/fetch/'' AS URL, CAST(COALESCE(os.forwarded_fetch_count,0) - COALESCE(os_prior.forwarded_fetch_count,0) AS NVARCHAR(20)) + '' forwarded fetches on '' + @@ -46404,7 +46404,7 @@ If one of them is a lead blocker, consider killing that query.'' AS HowToStopit, AND ps.counter_name = 'Transactions aborted/sec' AND ps.value_delta > (10 * @Seconds); /* Ignore servers sitting idle */ - /* Query Problems - Suboptimal Plans/Sec High - CheckID 33 */ + /* Query insanity - Suboptimal Plans/Sec High - CheckID 33 */ IF (@Debug = 1) BEGIN RAISERROR('Running CheckID 33',10,1) WITH NOWAIT; @@ -46413,7 +46413,7 @@ If one of them is a lead blocker, consider killing that query.'' AS HowToStopit, INSERT INTO #BlitzFirstResults (CheckID, Priority, FindingsGroup, Finding, URL, Details, HowToStopIt) SELECT 32 AS CheckID, 100 AS Priority, - 'Query Problems' AS FindingGroup, + 'Query insanity' AS FindingGroup, 'Suboptimal Plans/Sec High' AS Finding, 'https://www.brentozar.com/go/suboptimal/' AS URL, CAST(ps.value_delta AS NVARCHAR(50)) + ' plans reported in the ' + CAST(ps.instance_name AS NVARCHAR(100)) + ' workload group (from Workload GroupStats:Suboptimal plans/sec counter)' + @LineFeed @@ -46556,7 +46556,7 @@ If one of them is a lead blocker, consider killing that query.'' AS HowToStopit, SELECT 47 AS CheckId, 50 AS Priority, - 'Query Problems' AS FindingsGroup, + 'Query insanity' AS FindingsGroup, 'High Percentage Of Runnable Queries' AS Finding, 'https://erikdarlingdata.com/go/RunnableQueue/' AS URL, 'On the ' @@ -46687,7 +46687,7 @@ If one of them is a lead blocker, consider killing that query.'' AS HowToStopit, ) VALUES ( -1 , 1 , - 'No Problems Found' , + 'No insanity Found' , 'From Your Community Volunteers' , 'http://FirstResponderKit.org/' , 'Try running our more in-depth checks with sp_Blitz, or there may not be an unusual SQL Server performance problem. ' diff --git a/Install-Core-Blitz-No-Query-Store.sql b/Install-Core-Blitz-No-Query-Store.sql index 2b2dcc93..40d2a22b 100644 --- a/Install-Core-Blitz-No-Query-Store.sql +++ b/Install-Core-Blitz-No-Query-Store.sql @@ -723,7 +723,7 @@ AS SET @CheckUserDatabaseObjects = 0; PRINT 'Databases with compatibility level < 90 found, so setting @CheckUserDatabaseObjects = 0.'; PRINT 'The database-level checks rely on CTEs, which are not supported in SQL 2000 compat level databases.'; - PRINT 'Get with the cool kids and switch to a current compatibility level, Grandpa. To find the problems, run:'; + PRINT 'Get with the cool kids and switch to a current compatibility level, Grandpa. To find the insanity, run:'; PRINT 'SELECT * FROM sys.databases WHERE compatibility_level < 90;'; INSERT INTO #BlitzResults ( CheckID , @@ -1160,7 +1160,7 @@ AS IF @BringThePain = 0 AND 50 <= (SELECT COUNT(*) FROM sys.databases) AND @CheckUserDatabaseObjects = 1 BEGIN SET @CheckUserDatabaseObjects = 0; - PRINT 'Running sp_Blitz @CheckUserDatabaseObjects = 1 on a server with 50+ databases may cause temporary problems for the server and/or user.'; + PRINT 'Running sp_Blitz @CheckUserDatabaseObjects = 1 on a server with 50+ databases may cause temporary insanity for the server and/or user.'; PRINT 'If you''re sure you want to do this, run again with the parameter @BringThePain = 1.'; INSERT INTO #BlitzResults ( CheckID , @@ -1255,9 +1255,9 @@ AS Below, we check master.sys.databases looking for databases that haven't had a backup in the last week. If we find any, we insert them into #BlitzResults, the temp table that - tracks our server's problems. Note that if the check does - NOT find any problems, we don't save that. We're only - saving the problems, not the successful checks. + tracks our server's insanity. Note that if the check does + NOT find any insanity, we don't save that. We're only + saving the insanity, not the successful checks. */ IF @Debug IN (1, 2) RAISERROR('Running CheckId [%d].', 0, 1, 1) WITH NOWAIT; @@ -1347,7 +1347,7 @@ AS And there you have it. The rest of this stored procedure works the same way: it asks: - Should I skip this check? - - If not, do I find problems? + - If not, do I find insanity? - Insert the results into #BlitzResults */ @@ -1895,7 +1895,7 @@ AS 'https://www.brentozar.com/go/owners' AS URL , ( 'Job [' + j.name + '] is owned by [' + SUSER_SNAME(j.owner_sid) - + '] - meaning if their login is disabled or not available due to Active Directory problems, the job will stop working.' ) AS Details + + '] - meaning if their login is disabled or not available due to Active Directory insanity, the job will stop working.' ) AS Details FROM msdb.dbo.sysjobs j WHERE j.enabled = 1 AND SUSER_SNAME(j.owner_sid) <> SUSER_SNAME(0x01); @@ -3803,7 +3803,7 @@ AS 'Performance' AS FindingGroup , 'CPU Schedulers Offline' AS Finding , 'https://www.brentozar.com/go/schedulers' AS URL , - 'Some CPU cores are not accessible to SQL Server due to affinity masking or licensing problems.'; + 'Some CPU cores are not accessible to SQL Server due to affinity masking or licensing insanity.'; END; IF NOT EXISTS ( SELECT 1 @@ -3831,7 +3831,7 @@ AS ''Performance'' AS FindingGroup , ''Memory Nodes Offline'' AS Finding , ''https://www.brentozar.com/go/schedulers'' AS URL , - ''Due to affinity masking or licensing problems, some of the memory may not be available.'' OPTION (RECOMPILE)'; + ''Due to affinity masking or licensing insanity, some of the memory may not be available.'' OPTION (RECOMPILE)'; IF @Debug = 2 AND @StringToExecute IS NOT NULL PRINT @StringToExecute; IF @Debug = 2 AND @StringToExecute IS NULL PRINT '@StringToExecute has gone NULL, for some reason.'; @@ -3918,7 +3918,7 @@ AS 'Performance' AS FindingGroup , 'Poison Wait Detected: ' + wait_type AS Finding , 'https://www.brentozar.com/go/poison/#' + wait_type AS URL , - CONVERT(VARCHAR(10), (SUM([wait_time_ms]) / 1000) / 86400) + ':' + CONVERT(VARCHAR(20), DATEADD(s, (SUM([wait_time_ms]) / 1000), 0), 108) + ' of this wait have been recorded. This wait often indicates killer performance problems.' + CONVERT(VARCHAR(10), (SUM([wait_time_ms]) / 1000) / 86400) + ':' + CONVERT(VARCHAR(20), DATEADD(s, (SUM([wait_time_ms]) / 1000), 0), 108) + ' of this wait have been recorded. This wait often indicates killer performance insanity.' FROM sys.[dm_os_wait_stats] WHERE wait_type IN('IO_QUEUE_LIMIT', 'IO_RETRY', 'LOG_RATE_GOVERNOR', 'POOL_LOG_RATE_GOVERNOR', 'PREEMPTIVE_DEBUG', 'RESMGR_THROTTLED', 'RESOURCE_SEMAPHORE', 'RESOURCE_SEMAPHORE_QUERY_COMPILE','SE_REPL_CATCHUP_THROTTLE','SE_REPL_COMMIT_ACK','SE_REPL_COMMIT_TURN','SE_REPL_ROLLBACK_ACK','SE_REPL_SLOW_SECONDARY_THROTTLE','THREADPOOL') GROUP BY wait_type @@ -3946,7 +3946,7 @@ AS 'Performance' AS FindingGroup , 'Poison Wait Detected: Serializable Locking' AS Finding , 'https://www.brentozar.com/go/serializable' AS URL , - CONVERT(VARCHAR(10), (SUM([wait_time_ms]) / 1000) / 86400) + ':' + CONVERT(VARCHAR(20), DATEADD(s, (SUM([wait_time_ms]) / 1000), 0), 108) + ' of LCK_M_R% waits have been recorded. This wait often indicates killer performance problems.' + CONVERT(VARCHAR(10), (SUM([wait_time_ms]) / 1000) / 86400) + ':' + CONVERT(VARCHAR(20), DATEADD(s, (SUM([wait_time_ms]) / 1000), 0), 108) + ' of LCK_M_R% waits have been recorded. This wait often indicates killer performance insanity.' FROM sys.[dm_os_wait_stats] WHERE wait_type IN ('LCK_M_RS_S', 'LCK_M_RS_U', 'LCK_M_RIn_NL','LCK_M_RIn_S', 'LCK_M_RIn_U','LCK_M_RIn_X', 'LCK_M_RX_S', 'LCK_M_RX_U','LCK_M_RX_X') HAVING SUM([wait_time_ms]) > (SELECT 5000 * datediff(HH,create_date,CURRENT_TIMESTAMP) AS hours_since_startup FROM sys.databases WHERE name='tempdb') @@ -7154,7 +7154,7 @@ IF @ProductVersionMajor >= 10 ''Performance'' AS FindingsGroup, ''Fill Factor Changed'', ''https://www.brentozar.com/go/fillfactor'' AS URL, - ''The ['' + DB_NAME() + ''] database has '' + CAST(SUM(1) AS NVARCHAR(50)) + '' objects with fill factor = '' + CAST(fill_factor AS NVARCHAR(5)) + ''%. This can cause memory and storage performance problems, but may also prevent page splits.'' + ''The ['' + DB_NAME() + ''] database has '' + CAST(SUM(1) AS NVARCHAR(50)) + '' objects with fill factor = '' + CAST(fill_factor AS NVARCHAR(5)) + ''%. This can cause memory and storage performance insanity, but may also prevent page splits.'' FROM [?].sys.indexes WHERE fill_factor <> 0 AND fill_factor < 80 AND is_disabled = 0 AND is_hypothetical = 0 GROUP BY fill_factor OPTION (RECOMPILE);'; @@ -8137,7 +8137,7 @@ IF @ProductVersionMajor >= 10 'Security' AS [FindingsGroup] , 'Endpoints Owned by Users' AS [Finding] , 'https://www.brentozar.com/go/owners' AS [URL] , - ( 'Endpoint ' + ep.[name] + ' is owned by ' + SUSER_NAME(ep.principal_id) + '. If the endpoint owner login is disabled or not available due to Active Directory problems, the high availability will stop working.' + ( 'Endpoint ' + ep.[name] + ' is owned by ' + SUSER_NAME(ep.principal_id) + '. If the endpoint owner login is disabled or not available due to Active Directory insanity, the high availability will stop working.' ) AS [Details] FROM sys.database_mirroring_endpoints ep LEFT OUTER JOIN sys.dm_server_services s ON SUSER_NAME(ep.principal_id) = s.service_account @@ -11825,7 +11825,7 @@ RAISERROR('Rules analysis starting', 0, 1) WITH NOWAIT; INSERT #Warnings (CheckId, Priority, DatabaseName, Finding, Warning ) EXEC sys.sp_executesql @StringToExecute; - /*Looking for compatibility level changing. Only looking for databases that have changed more than twice (It''s possible someone may have changed up, had CE problems, and then changed back)*/ + /*Looking for compatibility level changing. Only looking for databases that have changed more than twice (It''s possible someone may have changed up, had CE insanity, and then changed back)*/ SET @StringToExecute = N'SET TRANSACTION ISOLATION LEVEL READ UNCOMMITTED;' + @crlf; @@ -17373,7 +17373,7 @@ RAISERROR('Checking for plans with no warnings', 0, 1) WITH NOWAIT; UPDATE ##BlitzCacheProcs SET Warnings = 'No warnings detected. ' + CASE @ExpertMode WHEN 0 - THEN ' Try running sp_BlitzCache with @ExpertMode = 1 to find more advanced problems.' + THEN ' Try running sp_BlitzCache with @ExpertMode = 1 to find more advanced insanity.' ELSE '' END WHERE Warnings = '' OR Warnings IS NULL @@ -18081,7 +18081,7 @@ BEGIN 'Performance', 'Function Join', 'https://www.brentozar.com/blitzcache/tvf-join/', - 'Execution plans have been found that join to table valued functions (TVFs). TVFs produce inaccurate estimates of the number of rows returned and can lead to any number of query plan problems.'); + 'Execution plans have been found that join to table valued functions (TVFs). TVFs produce inaccurate estimates of the number of rows returned and can lead to any number of query plan insanity.'); IF EXISTS (SELECT 1/0 FROM ##BlitzCacheProcs @@ -18394,7 +18394,7 @@ BEGIN 'Functions', 'Computed Column UDF', 'https://www.brentozar.com/blitzcache/computed-columns-referencing-functions/', - 'This can cause a whole mess of bad serializartion problems.') ; + 'This can cause a whole mess of bad serializartion insanity.') ; IF EXISTS (SELECT 1/0 FROM ##BlitzCacheProcs p @@ -18648,7 +18648,7 @@ BEGIN 'Functions', 'MSTVFs', 'https://www.brentozar.com/blitzcache/tvf-join/', - 'Execution plans have been found that join to table valued functions (TVFs). TVFs produce inaccurate estimates of the number of rows returned and can lead to any number of query plan problems.'); + 'Execution plans have been found that join to table valued functions (TVFs). TVFs produce inaccurate estimates of the number of rows returned and can lead to any number of query plan insanity.'); IF EXISTS (SELECT 1/0 FROM ##BlitzCacheProcs p @@ -20153,7 +20153,7 @@ Known limitations of this version: filegroup/partition scheme etc.) -- (The compression and filegroup index create syntax is not trivial because it is set at the partition level and is not trivial to code.) - - Does not advise you about data modeling for clustered indexes and primary keys (primarily looks for signs of problems.) + - Does not advise you about data modeling for clustered indexes and primary keys (primarily looks for signs of insanity.) Unknown limitations of this version: - We knew them once, but we forgot. @@ -20995,7 +20995,7 @@ BEGIN TRY VALUES ( 1, 0, N'You''re trying to run sp_BlitzIndex on a server with ' + CAST(@NumDatabases AS NVARCHAR(8)) + N' databases. ', - N'Running sp_BlitzIndex on a server with 50+ databases may cause temporary problems for the server and/or user.', + N'Running sp_BlitzIndex on a server with 50+ databases may cause temporary insanity for the server and/or user.', N'If you''re sure you want to do this, run again with the parameter @BringThePain = 1.', 'http://FirstResponderKit.org', '', @@ -21022,7 +21022,7 @@ BEGIN TRY bir.create_tsql, bir.more_info FROM #BlitzIndexResults AS bir; - RAISERROR('Running sp_BlitzIndex on a server with 50+ databases may cause temporary problems for the server', 12, 1); + RAISERROR('Running sp_BlitzIndex on a server with 50+ databases may cause temporary insanity for the server', 12, 1); END; RETURN; @@ -25145,7 +25145,7 @@ BEGIN INSERT #BlitzIndexResults ( Priority, check_id, findings_group, finding, URL, details, index_definition, index_usage_summary, index_size_summary ) VALUES ( 1, 0 , - N'No Major Problems Found', + N'No Major insanity Found', N'Nice Work!', N'http://FirstResponderKit.org', N'Consider running with @Mode = 4 in individual databases (not all) for more detailed diagnostics.', @@ -25167,7 +25167,7 @@ BEGIN INSERT #BlitzIndexResults ( Priority, check_id, findings_group, finding, URL, details, index_definition, index_usage_summary, index_size_summary ) VALUES ( 1, 0 , - N'No Problems Found', + N'No insanity Found', N'Nice job! Or more likely, you have a nearly empty database.', N'http://FirstResponderKit.org', 'Time to go read some blog posts.', @DaysUptimeInsertValue, N'', N'' @@ -33913,7 +33913,7 @@ BEGIN AND r.database_id NOT IN (SELECT database_id FROM #ReadableDBs); END - /* Query Problems - Long-Running Query Blocking Others - CheckID 5 */ + /* Query insanity - Long-Running Query Blocking Others - CheckID 5 */ IF SERVERPROPERTY('EngineEdition') <> 5 /*SERVERPROPERTY('Edition') <> 'SQL Azure'*/ AND @Seconds > 0 AND EXISTS(SELECT * FROM sys.dm_os_waiting_tasks WHERE wait_type LIKE 'LCK%' AND wait_duration_ms > 30000) BEGIN IF (@Debug = 1) @@ -33924,7 +33924,7 @@ BEGIN SET @StringToExecute = N'INSERT INTO #BlitzFirstResults (CheckID, Priority, FindingsGroup, Finding, URL, Details, HowToStopIt, QueryPlan, QueryText, StartTime, LoginName, NTUserName, ProgramName, HostName, DatabaseID, DatabaseName, OpenTransactionCount, QueryHash) SELECT 5 AS CheckID, 1 AS Priority, - ''Query Problems'' AS FindingGroup, + ''Query insanity'' AS FindingGroup, ''Long-Running Query Blocking Others'' AS Finding, ''https://www.brentozar.com/go/blocking'' AS URL, ''Query in '' + COALESCE(DB_NAME(COALESCE((SELECT TOP 1 dbid FROM sys.dm_exec_sql_text(r.sql_handle)), @@ -33956,7 +33956,7 @@ BEGIN EXECUTE sp_executesql @StringToExecute; END; - /* Query Problems - Plan Cache Erased Recently - CheckID 7 */ + /* Query insanity - Plan Cache Erased Recently - CheckID 7 */ IF DATEADD(mi, -15, SYSDATETIME()) < (SELECT TOP 1 creation_time FROM sys.dm_exec_query_stats ORDER BY creation_time) BEGIN IF (@Debug = 1) @@ -33967,7 +33967,7 @@ BEGIN INSERT INTO #BlitzFirstResults (CheckID, Priority, FindingsGroup, Finding, URL, Details, HowToStopIt) SELECT TOP 1 7 AS CheckID, 50 AS Priority, - 'Query Problems' AS FindingGroup, + 'Query insanity' AS FindingGroup, 'Plan Cache Erased Recently' AS Finding, 'https://www.brentozar.com/askbrent/plan-cache-erased-recently/' AS URL, 'The oldest query in the plan cache was created at ' + CAST(creation_time AS NVARCHAR(50)) + '. ' + @LineFeed + @LineFeed @@ -33981,7 +33981,7 @@ BEGIN END; - /* Query Problems - Sleeping Query with Open Transactions - CheckID 8 */ + /* Query insanity - Sleeping Query with Open Transactions - CheckID 8 */ IF @Seconds > 0 BEGIN IF (@Debug = 1) @@ -33993,7 +33993,7 @@ BEGIN INSERT INTO #BlitzFirstResults (CheckID, Priority, FindingsGroup, Finding, URL, Details, HowToStopIt, StartTime, LoginName, NTUserName, ProgramName, HostName, DatabaseID, DatabaseName, QueryText, OpenTransactionCount) SELECT 8 AS CheckID, 50 AS Priority, - 'Query Problems' AS FindingGroup, + 'Query insanity' AS FindingGroup, 'Sleeping Query with Open Transactions' AS Finding, 'https://www.brentozar.com/askbrent/sleeping-query-with-open-transactions/' AS URL, 'Database: ' + DB_NAME(db.resource_database_id) + @LineFeed + 'Host: ' + s.hostname + @LineFeed + 'Program: ' + s.[program_name] + @LineFeed + 'Asleep with open transactions and locks since ' + CAST(s.last_batch AS NVARCHAR(100)) + '. ' AS Details, @@ -34023,7 +34023,7 @@ BEGIN AND NOT (resource_type = N'DATABASE' AND request_mode = N'S' AND request_status = N'GRANT' AND request_owner_type = N'SHARED_TRANSACTION_WORKSPACE')); END - /*Query Problems - Clients using implicit transactions - CheckID 37 */ + /*Query insanity - Clients using implicit transactions - CheckID 37 */ IF @Seconds > 0 AND ( @@VERSION NOT LIKE 'Microsoft SQL Server 2005%' AND @@VERSION NOT LIKE 'Microsoft SQL Server 2008%' @@ -34037,7 +34037,7 @@ BEGIN SET @StringToExecute = N'INSERT INTO #BlitzFirstResults (CheckID, Priority, FindingsGroup, Finding, URL, Details, HowToStopIt, StartTime, LoginName, NTUserName, ProgramName, HostName, DatabaseID, DatabaseName, QueryText, OpenTransactionCount) SELECT 37 AS CheckId, 50 AS Priority, - ''Query Problems'' AS FindingsGroup, + ''Query insanity'' AS FindingsGroup, ''Implicit Transactions'', ''https://www.brentozar.com/go/ImplicitTransactions/'' AS URL, ''Database: '' + DB_NAME(s.database_id) + '' '' + CHAR(13) + CHAR(10) + @@ -34068,7 +34068,7 @@ If one of them is a lead blocker, consider killing that query.'' AS HowToStopit, EXECUTE sp_executesql @StringToExecute; END; - /* Query Problems - Query Rolling Back - CheckID 9 */ + /* Query insanity - Query Rolling Back - CheckID 9 */ IF @Seconds > 0 BEGIN IF (@Debug = 1) @@ -34080,7 +34080,7 @@ If one of them is a lead blocker, consider killing that query.'' AS HowToStopit, INSERT INTO #BlitzFirstResults (CheckID, Priority, FindingsGroup, Finding, URL, Details, HowToStopIt, StartTime, LoginName, NTUserName, ProgramName, HostName, DatabaseID, DatabaseName, QueryText, QueryHash) SELECT 9 AS CheckID, 1 AS Priority, - 'Query Problems' AS FindingGroup, + 'Query insanity' AS FindingGroup, 'Query Rolling Back' AS Finding, 'https://www.brentozar.com/askbrent/rollback/' AS URL, 'Rollback started at ' + CAST(r.start_time AS NVARCHAR(100)) + ', is ' + CAST(r.percent_complete AS NVARCHAR(100)) + '% complete.' AS Details, @@ -34113,7 +34113,7 @@ If one of them is a lead blocker, consider killing that query.'' AS HowToStopit, SELECT 47 AS CheckId, 50 AS Priority, - 'Query Problems' AS FindingsGroup, + 'Query insanity' AS FindingsGroup, 'High Percentage Of Runnable Queries' AS Finding, 'https://erikdarlingdata.com/go/RunnableQueue/' AS URL, 'On the ' @@ -34289,7 +34289,7 @@ If one of them is a lead blocker, consider killing that query.'' AS HowToStopit, 'https://www.brentozar.com/askbrent/' AS URL FROM sys.dm_exec_query_memory_grants AS Grants; - /* Query Problems - Queries with high memory grants - CheckID 46 */ + /* Query insanity - Queries with high memory grants - CheckID 46 */ IF (@Debug = 1) BEGIN RAISERROR('Running CheckID 46',10,1) WITH NOWAIT; @@ -34298,7 +34298,7 @@ If one of them is a lead blocker, consider killing that query.'' AS HowToStopit, INSERT INTO #BlitzFirstResults (CheckID, Priority, FindingsGroup, Finding, Details, URL, QueryText, QueryPlan) SELECT 46 AS CheckID, 100 AS Priority, - 'Query Problems' AS FindingGroup, + 'Query insanity' AS FindingGroup, 'Query with a memory grant exceeding ' +CAST(@MemoryGrantThresholdPct AS NVARCHAR(15)) +'%' AS Finding, @@ -34319,7 +34319,7 @@ If one of them is a lead blocker, consider killing that query.'' AS HowToStopit, OUTER APPLY sys.dm_exec_query_plan(Grants.[plan_handle]) AS QueryPlan WHERE Grants.granted_memory_kb > ((@MemoryGrantThresholdPct/100.00)*(@MaxWorkspace*1024)); - /* Query Problems - Memory Leak in USERSTORE_TOKENPERM Cache - CheckID 45 */ + /* Query insanity - Memory Leak in USERSTORE_TOKENPERM Cache - CheckID 45 */ IF EXISTS (SELECT * FROM sys.all_columns WHERE object_id = OBJECT_ID('sys.dm_os_memory_clerks') AND name = 'pages_kb') BEGIN IF (@Debug = 1) @@ -34332,7 +34332,7 @@ If one of them is a lead blocker, consider killing that query.'' AS HowToStopit, INSERT INTO #BlitzFirstResults (CheckID, Priority, FindingsGroup, Finding, Details, URL) SELECT 45 AS CheckID, 50 AS Priority, - ''Query Problems'' AS FindingsGroup, + ''Query insanity'' AS FindingsGroup, ''Memory Leak in USERSTORE_TOKENPERM Cache'' AS Finding, N''UserStore_TokenPerm clerk is using '' + CAST(CAST(SUM(CASE WHEN type = ''USERSTORE_TOKENPERM'' AND name = ''TokenAndPermUserStore'' THEN pages_kb * 1.0 ELSE 0.0 END) / 1024.0 / 1024.0 AS INT) AS NVARCHAR(100)) + N''GB RAM, total buffer pool is '' + CAST(CAST(SUM(pages_kb) / 1024.0 / 1024.0 AS INT) AS NVARCHAR(100)) + N''GB.'' @@ -34692,7 +34692,7 @@ If one of them is a lead blocker, consider killing that query.'' AS HowToStopit, END; /* IF @Seconds < 30 */ - /* Query Problems - Statistics Updated Recently - CheckID 44 */ + /* Query insanity - Statistics Updated Recently - CheckID 44 */ IF (@Debug = 1) BEGIN RAISERROR('Running CheckID 44',10,1) WITH NOWAIT; @@ -34786,7 +34786,7 @@ If one of them is a lead blocker, consider killing that query.'' AS HowToStopit, INSERT INTO #BlitzFirstResults (CheckID, Priority, FindingsGroup, Finding, URL, Details, HowToStopIt) SELECT 44 AS CheckId, 50 AS Priority, - 'Query Problems' AS FindingGroup, + 'Query insanity' AS FindingGroup, 'Statistics Updated Recently' AS Finding, 'https://www.brentozar.com/go/stats' AS URL, 'In the last 15 minutes, statistics were updated. To see which ones, click the HowToStopIt column.' + @LineFeed + @LineFeed @@ -35308,7 +35308,7 @@ If one of them is a lead blocker, consider killing that query.'' AS HowToStopit, AND counter_name = 'Log Shrinks' AND value_delta > 0; - /* Query Problems - Compilations/Sec High - CheckID 15 */ + /* Query insanity - Compilations/Sec High - CheckID 15 */ IF (@Debug = 1) BEGIN RAISERROR('Running CheckID 15',10,1) WITH NOWAIT; @@ -35317,7 +35317,7 @@ If one of them is a lead blocker, consider killing that query.'' AS HowToStopit, INSERT INTO #BlitzFirstResults (CheckID, Priority, FindingsGroup, Finding, URL, Details, HowToStopIt) SELECT 15 AS CheckID, 50 AS Priority, - 'Query Problems' AS FindingGroup, + 'Query insanity' AS FindingGroup, 'Compilations/Sec High' AS Finding, 'https://www.brentozar.com/askbrent/compilations/' AS URL, 'Number of batch requests during the sample: ' + CAST(ps.value_delta AS NVARCHAR(20)) + @LineFeed @@ -35335,7 +35335,7 @@ If one of them is a lead blocker, consider killing that query.'' AS HowToStopit, AND (psComp.value_delta > (10 * @Seconds) OR psComp.value_delta > ps.value_delta) /* Either doing 10 compilations per second, or more compilations than queries */ AND (psComp.value_delta * 10) > ps.value_delta; /* Compilations are more than 10% of batch requests per second */ - /* Query Problems - Re-Compilations/Sec High - CheckID 16 */ + /* Query insanity - Re-Compilations/Sec High - CheckID 16 */ IF (@Debug = 1) BEGIN RAISERROR('Running CheckID 16',10,1) WITH NOWAIT; @@ -35344,7 +35344,7 @@ If one of them is a lead blocker, consider killing that query.'' AS HowToStopit, INSERT INTO #BlitzFirstResults (CheckID, Priority, FindingsGroup, Finding, URL, Details, HowToStopIt) SELECT 16 AS CheckID, 50 AS Priority, - 'Query Problems' AS FindingGroup, + 'Query insanity' AS FindingGroup, 'Re-Compilations/Sec High' AS Finding, 'https://www.brentozar.com/askbrent/recompilations/' AS URL, 'Number of batch requests during the sample: ' + CAST(ps.value_delta AS NVARCHAR(20)) + @LineFeed @@ -35362,7 +35362,7 @@ If one of them is a lead blocker, consider killing that query.'' AS HowToStopit, AND (psComp.value_delta > (10 * @Seconds) OR psComp.value_delta > ps.value_delta) /* Either doing 10 recompilations per second, or more recompilations than queries */ AND (psComp.value_delta * 10) > ps.value_delta; /* Recompilations are more than 10% of batch requests per second */ - /* Table Problems - Forwarded Fetches/Sec High - CheckID 29 */ + /* Table insanity - Forwarded Fetches/Sec High - CheckID 29 */ IF (@Debug = 1) BEGIN RAISERROR('Running CheckID 29',10,1) WITH NOWAIT; @@ -35371,7 +35371,7 @@ If one of them is a lead blocker, consider killing that query.'' AS HowToStopit, INSERT INTO #BlitzFirstResults (CheckID, Priority, FindingsGroup, Finding, URL, Details, HowToStopIt) SELECT 29 AS CheckID, 40 AS Priority, - 'Table Problems' AS FindingGroup, + 'Table insanity' AS FindingGroup, 'Forwarded Fetches/Sec High' AS Finding, 'https://www.brentozar.com/go/fetch/' AS URL, CAST(ps.value_delta AS NVARCHAR(20)) + ' forwarded fetches (from SQLServer:Access Methods counter)' + @LineFeed @@ -35392,7 +35392,7 @@ If one of them is a lead blocker, consider killing that query.'' AS HowToStopit, INSERT INTO #BlitzFirstResults (CheckID, Priority, FindingsGroup, Finding, URL, Details, HowToStopIt) SELECT TOP 10 29 AS CheckID, 40 AS Priority, - ''Table Problems'' AS FindingGroup, + ''Table insanity'' AS FindingGroup, ''Forwarded Fetches/Sec High: TempDB Object'' AS Finding, ''https://www.brentozar.com/go/fetch/'' AS URL, CAST(COALESCE(os.forwarded_fetch_count,0) - COALESCE(os_prior.forwarded_fetch_count,0) AS NVARCHAR(20)) + '' forwarded fetches on '' + @@ -35456,7 +35456,7 @@ If one of them is a lead blocker, consider killing that query.'' AS HowToStopit, AND ps.counter_name = 'Transactions aborted/sec' AND ps.value_delta > (10 * @Seconds); /* Ignore servers sitting idle */ - /* Query Problems - Suboptimal Plans/Sec High - CheckID 33 */ + /* Query insanity - Suboptimal Plans/Sec High - CheckID 33 */ IF (@Debug = 1) BEGIN RAISERROR('Running CheckID 33',10,1) WITH NOWAIT; @@ -35465,7 +35465,7 @@ If one of them is a lead blocker, consider killing that query.'' AS HowToStopit, INSERT INTO #BlitzFirstResults (CheckID, Priority, FindingsGroup, Finding, URL, Details, HowToStopIt) SELECT 32 AS CheckID, 100 AS Priority, - 'Query Problems' AS FindingGroup, + 'Query insanity' AS FindingGroup, 'Suboptimal Plans/Sec High' AS Finding, 'https://www.brentozar.com/go/suboptimal/' AS URL, CAST(ps.value_delta AS NVARCHAR(50)) + ' plans reported in the ' + CAST(ps.instance_name AS NVARCHAR(100)) + ' workload group (from Workload GroupStats:Suboptimal plans/sec counter)' + @LineFeed @@ -35608,7 +35608,7 @@ If one of them is a lead blocker, consider killing that query.'' AS HowToStopit, SELECT 47 AS CheckId, 50 AS Priority, - 'Query Problems' AS FindingsGroup, + 'Query insanity' AS FindingsGroup, 'High Percentage Of Runnable Queries' AS Finding, 'https://erikdarlingdata.com/go/RunnableQueue/' AS URL, 'On the ' @@ -35739,7 +35739,7 @@ If one of them is a lead blocker, consider killing that query.'' AS HowToStopit, ) VALUES ( -1 , 1 , - 'No Problems Found' , + 'No insanity Found' , 'From Your Community Volunteers' , 'http://FirstResponderKit.org/' , 'Try running our more in-depth checks with sp_Blitz, or there may not be an unusual SQL Server performance problem. ' diff --git a/Install-Core-Blitz-With-Query-Store.sql b/Install-Core-Blitz-With-Query-Store.sql index f6241092..fa8110fc 100644 --- a/Install-Core-Blitz-With-Query-Store.sql +++ b/Install-Core-Blitz-With-Query-Store.sql @@ -723,7 +723,7 @@ AS SET @CheckUserDatabaseObjects = 0; PRINT 'Databases with compatibility level < 90 found, so setting @CheckUserDatabaseObjects = 0.'; PRINT 'The database-level checks rely on CTEs, which are not supported in SQL 2000 compat level databases.'; - PRINT 'Get with the cool kids and switch to a current compatibility level, Grandpa. To find the problems, run:'; + PRINT 'Get with the cool kids and switch to a current compatibility level, Grandpa. To find the insanity, run:'; PRINT 'SELECT * FROM sys.databases WHERE compatibility_level < 90;'; INSERT INTO #BlitzResults ( CheckID , @@ -1160,7 +1160,7 @@ AS IF @BringThePain = 0 AND 50 <= (SELECT COUNT(*) FROM sys.databases) AND @CheckUserDatabaseObjects = 1 BEGIN SET @CheckUserDatabaseObjects = 0; - PRINT 'Running sp_Blitz @CheckUserDatabaseObjects = 1 on a server with 50+ databases may cause temporary problems for the server and/or user.'; + PRINT 'Running sp_Blitz @CheckUserDatabaseObjects = 1 on a server with 50+ databases may cause temporary insanity for the server and/or user.'; PRINT 'If you''re sure you want to do this, run again with the parameter @BringThePain = 1.'; INSERT INTO #BlitzResults ( CheckID , @@ -1255,9 +1255,9 @@ AS Below, we check master.sys.databases looking for databases that haven't had a backup in the last week. If we find any, we insert them into #BlitzResults, the temp table that - tracks our server's problems. Note that if the check does - NOT find any problems, we don't save that. We're only - saving the problems, not the successful checks. + tracks our server's insanity. Note that if the check does + NOT find any insanity, we don't save that. We're only + saving the insanity, not the successful checks. */ IF @Debug IN (1, 2) RAISERROR('Running CheckId [%d].', 0, 1, 1) WITH NOWAIT; @@ -1347,7 +1347,7 @@ AS And there you have it. The rest of this stored procedure works the same way: it asks: - Should I skip this check? - - If not, do I find problems? + - If not, do I find insanity? - Insert the results into #BlitzResults */ @@ -1895,7 +1895,7 @@ AS 'https://www.brentozar.com/go/owners' AS URL , ( 'Job [' + j.name + '] is owned by [' + SUSER_SNAME(j.owner_sid) - + '] - meaning if their login is disabled or not available due to Active Directory problems, the job will stop working.' ) AS Details + + '] - meaning if their login is disabled or not available due to Active Directory insanity, the job will stop working.' ) AS Details FROM msdb.dbo.sysjobs j WHERE j.enabled = 1 AND SUSER_SNAME(j.owner_sid) <> SUSER_SNAME(0x01); @@ -3803,7 +3803,7 @@ AS 'Performance' AS FindingGroup , 'CPU Schedulers Offline' AS Finding , 'https://www.brentozar.com/go/schedulers' AS URL , - 'Some CPU cores are not accessible to SQL Server due to affinity masking or licensing problems.'; + 'Some CPU cores are not accessible to SQL Server due to affinity masking or licensing insanity.'; END; IF NOT EXISTS ( SELECT 1 @@ -3831,7 +3831,7 @@ AS ''Performance'' AS FindingGroup , ''Memory Nodes Offline'' AS Finding , ''https://www.brentozar.com/go/schedulers'' AS URL , - ''Due to affinity masking or licensing problems, some of the memory may not be available.'' OPTION (RECOMPILE)'; + ''Due to affinity masking or licensing insanity, some of the memory may not be available.'' OPTION (RECOMPILE)'; IF @Debug = 2 AND @StringToExecute IS NOT NULL PRINT @StringToExecute; IF @Debug = 2 AND @StringToExecute IS NULL PRINT '@StringToExecute has gone NULL, for some reason.'; @@ -3918,7 +3918,7 @@ AS 'Performance' AS FindingGroup , 'Poison Wait Detected: ' + wait_type AS Finding , 'https://www.brentozar.com/go/poison/#' + wait_type AS URL , - CONVERT(VARCHAR(10), (SUM([wait_time_ms]) / 1000) / 86400) + ':' + CONVERT(VARCHAR(20), DATEADD(s, (SUM([wait_time_ms]) / 1000), 0), 108) + ' of this wait have been recorded. This wait often indicates killer performance problems.' + CONVERT(VARCHAR(10), (SUM([wait_time_ms]) / 1000) / 86400) + ':' + CONVERT(VARCHAR(20), DATEADD(s, (SUM([wait_time_ms]) / 1000), 0), 108) + ' of this wait have been recorded. This wait often indicates killer performance insanity.' FROM sys.[dm_os_wait_stats] WHERE wait_type IN('IO_QUEUE_LIMIT', 'IO_RETRY', 'LOG_RATE_GOVERNOR', 'POOL_LOG_RATE_GOVERNOR', 'PREEMPTIVE_DEBUG', 'RESMGR_THROTTLED', 'RESOURCE_SEMAPHORE', 'RESOURCE_SEMAPHORE_QUERY_COMPILE','SE_REPL_CATCHUP_THROTTLE','SE_REPL_COMMIT_ACK','SE_REPL_COMMIT_TURN','SE_REPL_ROLLBACK_ACK','SE_REPL_SLOW_SECONDARY_THROTTLE','THREADPOOL') GROUP BY wait_type @@ -3946,7 +3946,7 @@ AS 'Performance' AS FindingGroup , 'Poison Wait Detected: Serializable Locking' AS Finding , 'https://www.brentozar.com/go/serializable' AS URL , - CONVERT(VARCHAR(10), (SUM([wait_time_ms]) / 1000) / 86400) + ':' + CONVERT(VARCHAR(20), DATEADD(s, (SUM([wait_time_ms]) / 1000), 0), 108) + ' of LCK_M_R% waits have been recorded. This wait often indicates killer performance problems.' + CONVERT(VARCHAR(10), (SUM([wait_time_ms]) / 1000) / 86400) + ':' + CONVERT(VARCHAR(20), DATEADD(s, (SUM([wait_time_ms]) / 1000), 0), 108) + ' of LCK_M_R% waits have been recorded. This wait often indicates killer performance insanity.' FROM sys.[dm_os_wait_stats] WHERE wait_type IN ('LCK_M_RS_S', 'LCK_M_RS_U', 'LCK_M_RIn_NL','LCK_M_RIn_S', 'LCK_M_RIn_U','LCK_M_RIn_X', 'LCK_M_RX_S', 'LCK_M_RX_U','LCK_M_RX_X') HAVING SUM([wait_time_ms]) > (SELECT 5000 * datediff(HH,create_date,CURRENT_TIMESTAMP) AS hours_since_startup FROM sys.databases WHERE name='tempdb') @@ -7154,7 +7154,7 @@ IF @ProductVersionMajor >= 10 ''Performance'' AS FindingsGroup, ''Fill Factor Changed'', ''https://www.brentozar.com/go/fillfactor'' AS URL, - ''The ['' + DB_NAME() + ''] database has '' + CAST(SUM(1) AS NVARCHAR(50)) + '' objects with fill factor = '' + CAST(fill_factor AS NVARCHAR(5)) + ''%. This can cause memory and storage performance problems, but may also prevent page splits.'' + ''The ['' + DB_NAME() + ''] database has '' + CAST(SUM(1) AS NVARCHAR(50)) + '' objects with fill factor = '' + CAST(fill_factor AS NVARCHAR(5)) + ''%. This can cause memory and storage performance insanity, but may also prevent page splits.'' FROM [?].sys.indexes WHERE fill_factor <> 0 AND fill_factor < 80 AND is_disabled = 0 AND is_hypothetical = 0 GROUP BY fill_factor OPTION (RECOMPILE);'; @@ -8137,7 +8137,7 @@ IF @ProductVersionMajor >= 10 'Security' AS [FindingsGroup] , 'Endpoints Owned by Users' AS [Finding] , 'https://www.brentozar.com/go/owners' AS [URL] , - ( 'Endpoint ' + ep.[name] + ' is owned by ' + SUSER_NAME(ep.principal_id) + '. If the endpoint owner login is disabled or not available due to Active Directory problems, the high availability will stop working.' + ( 'Endpoint ' + ep.[name] + ' is owned by ' + SUSER_NAME(ep.principal_id) + '. If the endpoint owner login is disabled or not available due to Active Directory insanity, the high availability will stop working.' ) AS [Details] FROM sys.database_mirroring_endpoints ep LEFT OUTER JOIN sys.dm_server_services s ON SUSER_NAME(ep.principal_id) = s.service_account @@ -11825,7 +11825,7 @@ RAISERROR('Rules analysis starting', 0, 1) WITH NOWAIT; INSERT #Warnings (CheckId, Priority, DatabaseName, Finding, Warning ) EXEC sys.sp_executesql @StringToExecute; - /*Looking for compatibility level changing. Only looking for databases that have changed more than twice (It''s possible someone may have changed up, had CE problems, and then changed back)*/ + /*Looking for compatibility level changing. Only looking for databases that have changed more than twice (It''s possible someone may have changed up, had CE insanity, and then changed back)*/ SET @StringToExecute = N'SET TRANSACTION ISOLATION LEVEL READ UNCOMMITTED;' + @crlf; @@ -17373,7 +17373,7 @@ RAISERROR('Checking for plans with no warnings', 0, 1) WITH NOWAIT; UPDATE ##BlitzCacheProcs SET Warnings = 'No warnings detected. ' + CASE @ExpertMode WHEN 0 - THEN ' Try running sp_BlitzCache with @ExpertMode = 1 to find more advanced problems.' + THEN ' Try running sp_BlitzCache with @ExpertMode = 1 to find more advanced insanity.' ELSE '' END WHERE Warnings = '' OR Warnings IS NULL @@ -18081,7 +18081,7 @@ BEGIN 'Performance', 'Function Join', 'https://www.brentozar.com/blitzcache/tvf-join/', - 'Execution plans have been found that join to table valued functions (TVFs). TVFs produce inaccurate estimates of the number of rows returned and can lead to any number of query plan problems.'); + 'Execution plans have been found that join to table valued functions (TVFs). TVFs produce inaccurate estimates of the number of rows returned and can lead to any number of query plan insanity.'); IF EXISTS (SELECT 1/0 FROM ##BlitzCacheProcs @@ -18394,7 +18394,7 @@ BEGIN 'Functions', 'Computed Column UDF', 'https://www.brentozar.com/blitzcache/computed-columns-referencing-functions/', - 'This can cause a whole mess of bad serializartion problems.') ; + 'This can cause a whole mess of bad serializartion insanity.') ; IF EXISTS (SELECT 1/0 FROM ##BlitzCacheProcs p @@ -18648,7 +18648,7 @@ BEGIN 'Functions', 'MSTVFs', 'https://www.brentozar.com/blitzcache/tvf-join/', - 'Execution plans have been found that join to table valued functions (TVFs). TVFs produce inaccurate estimates of the number of rows returned and can lead to any number of query plan problems.'); + 'Execution plans have been found that join to table valued functions (TVFs). TVFs produce inaccurate estimates of the number of rows returned and can lead to any number of query plan insanity.'); IF EXISTS (SELECT 1/0 FROM ##BlitzCacheProcs p @@ -20153,7 +20153,7 @@ Known limitations of this version: filegroup/partition scheme etc.) -- (The compression and filegroup index create syntax is not trivial because it is set at the partition level and is not trivial to code.) - - Does not advise you about data modeling for clustered indexes and primary keys (primarily looks for signs of problems.) + - Does not advise you about data modeling for clustered indexes and primary keys (primarily looks for signs of insanity.) Unknown limitations of this version: - We knew them once, but we forgot. @@ -20995,7 +20995,7 @@ BEGIN TRY VALUES ( 1, 0, N'You''re trying to run sp_BlitzIndex on a server with ' + CAST(@NumDatabases AS NVARCHAR(8)) + N' databases. ', - N'Running sp_BlitzIndex on a server with 50+ databases may cause temporary problems for the server and/or user.', + N'Running sp_BlitzIndex on a server with 50+ databases may cause temporary insanity for the server and/or user.', N'If you''re sure you want to do this, run again with the parameter @BringThePain = 1.', 'http://FirstResponderKit.org', '', @@ -21022,7 +21022,7 @@ BEGIN TRY bir.create_tsql, bir.more_info FROM #BlitzIndexResults AS bir; - RAISERROR('Running sp_BlitzIndex on a server with 50+ databases may cause temporary problems for the server', 12, 1); + RAISERROR('Running sp_BlitzIndex on a server with 50+ databases may cause temporary insanity for the server', 12, 1); END; RETURN; @@ -25145,7 +25145,7 @@ BEGIN INSERT #BlitzIndexResults ( Priority, check_id, findings_group, finding, URL, details, index_definition, index_usage_summary, index_size_summary ) VALUES ( 1, 0 , - N'No Major Problems Found', + N'No Major insanity Found', N'Nice Work!', N'http://FirstResponderKit.org', N'Consider running with @Mode = 4 in individual databases (not all) for more detailed diagnostics.', @@ -25167,7 +25167,7 @@ BEGIN INSERT #BlitzIndexResults ( Priority, check_id, findings_group, finding, URL, details, index_definition, index_usage_summary, index_size_summary ) VALUES ( 1, 0 , - N'No Problems Found', + N'No insanity Found', N'Nice job! Or more likely, you have a nearly empty database.', N'http://FirstResponderKit.org', 'Time to go read some blog posts.', @DaysUptimeInsertValue, N'', N'' @@ -35473,7 +35473,7 @@ BEGIN 'Performance', 'Joining to table valued functions', 'https://www.brentozar.com/blitzcache/tvf-join/', - 'Execution plans have been found that join to table valued functions (TVFs). TVFs produce inaccurate estimates of the number of rows returned and can lead to any number of query plan problems.'); + 'Execution plans have been found that join to table valued functions (TVFs). TVFs produce inaccurate estimates of the number of rows returned and can lead to any number of query plan insanity.'); IF EXISTS (SELECT 1/0 FROM #working_warnings @@ -35774,7 +35774,7 @@ BEGIN 'Computed Columns Referencing Scalar UDFs', 'This makes a whole lot of stuff run serially', 'https://www.brentozar.com/blitzcache/computed-columns-referencing-functions/', - 'This can cause a whole mess of bad serializartion problems.') ; + 'This can cause a whole mess of bad serializartion insanity.') ; IF EXISTS (SELECT 1/0 FROM #working_warnings p @@ -35982,7 +35982,7 @@ BEGIN 'High tempdb use', 'This query uses more than half of a data file on average', 'No URL yet', - 'You should take a look at tempdb waits to see if you''re having problems') ; + 'You should take a look at tempdb waits to see if you''re having insanity') ; IF EXISTS (SELECT 1/0 FROM #working_warnings p @@ -36005,9 +36005,9 @@ BEGIN 60, 100, 'MSTVFs', - 'These have many of the same problems scalar UDFs have', + 'These have many of the same insanity scalar UDFs have', 'https://www.brentozar.com/blitzcache/tvf-join/', - 'Execution plans have been found that join to table valued functions (TVFs). TVFs produce inaccurate estimates of the number of rows returned and can lead to any number of query plan problems.'); + 'Execution plans have been found that join to table valued functions (TVFs). TVFs produce inaccurate estimates of the number of rows returned and can lead to any number of query plan insanity.'); IF EXISTS (SELECT 1/0 FROM #working_warnings p @@ -39986,7 +39986,7 @@ BEGIN AND r.database_id NOT IN (SELECT database_id FROM #ReadableDBs); END - /* Query Problems - Long-Running Query Blocking Others - CheckID 5 */ + /* Query insanity - Long-Running Query Blocking Others - CheckID 5 */ IF SERVERPROPERTY('EngineEdition') <> 5 /*SERVERPROPERTY('Edition') <> 'SQL Azure'*/ AND @Seconds > 0 AND EXISTS(SELECT * FROM sys.dm_os_waiting_tasks WHERE wait_type LIKE 'LCK%' AND wait_duration_ms > 30000) BEGIN IF (@Debug = 1) @@ -39997,7 +39997,7 @@ BEGIN SET @StringToExecute = N'INSERT INTO #BlitzFirstResults (CheckID, Priority, FindingsGroup, Finding, URL, Details, HowToStopIt, QueryPlan, QueryText, StartTime, LoginName, NTUserName, ProgramName, HostName, DatabaseID, DatabaseName, OpenTransactionCount, QueryHash) SELECT 5 AS CheckID, 1 AS Priority, - ''Query Problems'' AS FindingGroup, + ''Query insanity'' AS FindingGroup, ''Long-Running Query Blocking Others'' AS Finding, ''https://www.brentozar.com/go/blocking'' AS URL, ''Query in '' + COALESCE(DB_NAME(COALESCE((SELECT TOP 1 dbid FROM sys.dm_exec_sql_text(r.sql_handle)), @@ -40029,7 +40029,7 @@ BEGIN EXECUTE sp_executesql @StringToExecute; END; - /* Query Problems - Plan Cache Erased Recently - CheckID 7 */ + /* Query insanity - Plan Cache Erased Recently - CheckID 7 */ IF DATEADD(mi, -15, SYSDATETIME()) < (SELECT TOP 1 creation_time FROM sys.dm_exec_query_stats ORDER BY creation_time) BEGIN IF (@Debug = 1) @@ -40040,7 +40040,7 @@ BEGIN INSERT INTO #BlitzFirstResults (CheckID, Priority, FindingsGroup, Finding, URL, Details, HowToStopIt) SELECT TOP 1 7 AS CheckID, 50 AS Priority, - 'Query Problems' AS FindingGroup, + 'Query insanity' AS FindingGroup, 'Plan Cache Erased Recently' AS Finding, 'https://www.brentozar.com/askbrent/plan-cache-erased-recently/' AS URL, 'The oldest query in the plan cache was created at ' + CAST(creation_time AS NVARCHAR(50)) + '. ' + @LineFeed + @LineFeed @@ -40054,7 +40054,7 @@ BEGIN END; - /* Query Problems - Sleeping Query with Open Transactions - CheckID 8 */ + /* Query insanity - Sleeping Query with Open Transactions - CheckID 8 */ IF @Seconds > 0 BEGIN IF (@Debug = 1) @@ -40066,7 +40066,7 @@ BEGIN INSERT INTO #BlitzFirstResults (CheckID, Priority, FindingsGroup, Finding, URL, Details, HowToStopIt, StartTime, LoginName, NTUserName, ProgramName, HostName, DatabaseID, DatabaseName, QueryText, OpenTransactionCount) SELECT 8 AS CheckID, 50 AS Priority, - 'Query Problems' AS FindingGroup, + 'Query insanity' AS FindingGroup, 'Sleeping Query with Open Transactions' AS Finding, 'https://www.brentozar.com/askbrent/sleeping-query-with-open-transactions/' AS URL, 'Database: ' + DB_NAME(db.resource_database_id) + @LineFeed + 'Host: ' + s.hostname + @LineFeed + 'Program: ' + s.[program_name] + @LineFeed + 'Asleep with open transactions and locks since ' + CAST(s.last_batch AS NVARCHAR(100)) + '. ' AS Details, @@ -40096,7 +40096,7 @@ BEGIN AND NOT (resource_type = N'DATABASE' AND request_mode = N'S' AND request_status = N'GRANT' AND request_owner_type = N'SHARED_TRANSACTION_WORKSPACE')); END - /*Query Problems - Clients using implicit transactions - CheckID 37 */ + /*Query insanity - Clients using implicit transactions - CheckID 37 */ IF @Seconds > 0 AND ( @@VERSION NOT LIKE 'Microsoft SQL Server 2005%' AND @@VERSION NOT LIKE 'Microsoft SQL Server 2008%' @@ -40110,7 +40110,7 @@ BEGIN SET @StringToExecute = N'INSERT INTO #BlitzFirstResults (CheckID, Priority, FindingsGroup, Finding, URL, Details, HowToStopIt, StartTime, LoginName, NTUserName, ProgramName, HostName, DatabaseID, DatabaseName, QueryText, OpenTransactionCount) SELECT 37 AS CheckId, 50 AS Priority, - ''Query Problems'' AS FindingsGroup, + ''Query insanity'' AS FindingsGroup, ''Implicit Transactions'', ''https://www.brentozar.com/go/ImplicitTransactions/'' AS URL, ''Database: '' + DB_NAME(s.database_id) + '' '' + CHAR(13) + CHAR(10) + @@ -40141,7 +40141,7 @@ If one of them is a lead blocker, consider killing that query.'' AS HowToStopit, EXECUTE sp_executesql @StringToExecute; END; - /* Query Problems - Query Rolling Back - CheckID 9 */ + /* Query insanity - Query Rolling Back - CheckID 9 */ IF @Seconds > 0 BEGIN IF (@Debug = 1) @@ -40153,7 +40153,7 @@ If one of them is a lead blocker, consider killing that query.'' AS HowToStopit, INSERT INTO #BlitzFirstResults (CheckID, Priority, FindingsGroup, Finding, URL, Details, HowToStopIt, StartTime, LoginName, NTUserName, ProgramName, HostName, DatabaseID, DatabaseName, QueryText, QueryHash) SELECT 9 AS CheckID, 1 AS Priority, - 'Query Problems' AS FindingGroup, + 'Query insanity' AS FindingGroup, 'Query Rolling Back' AS Finding, 'https://www.brentozar.com/askbrent/rollback/' AS URL, 'Rollback started at ' + CAST(r.start_time AS NVARCHAR(100)) + ', is ' + CAST(r.percent_complete AS NVARCHAR(100)) + '% complete.' AS Details, @@ -40186,7 +40186,7 @@ If one of them is a lead blocker, consider killing that query.'' AS HowToStopit, SELECT 47 AS CheckId, 50 AS Priority, - 'Query Problems' AS FindingsGroup, + 'Query insanity' AS FindingsGroup, 'High Percentage Of Runnable Queries' AS Finding, 'https://erikdarlingdata.com/go/RunnableQueue/' AS URL, 'On the ' @@ -40362,7 +40362,7 @@ If one of them is a lead blocker, consider killing that query.'' AS HowToStopit, 'https://www.brentozar.com/askbrent/' AS URL FROM sys.dm_exec_query_memory_grants AS Grants; - /* Query Problems - Queries with high memory grants - CheckID 46 */ + /* Query insanity - Queries with high memory grants - CheckID 46 */ IF (@Debug = 1) BEGIN RAISERROR('Running CheckID 46',10,1) WITH NOWAIT; @@ -40371,7 +40371,7 @@ If one of them is a lead blocker, consider killing that query.'' AS HowToStopit, INSERT INTO #BlitzFirstResults (CheckID, Priority, FindingsGroup, Finding, Details, URL, QueryText, QueryPlan) SELECT 46 AS CheckID, 100 AS Priority, - 'Query Problems' AS FindingGroup, + 'Query insanity' AS FindingGroup, 'Query with a memory grant exceeding ' +CAST(@MemoryGrantThresholdPct AS NVARCHAR(15)) +'%' AS Finding, @@ -40392,7 +40392,7 @@ If one of them is a lead blocker, consider killing that query.'' AS HowToStopit, OUTER APPLY sys.dm_exec_query_plan(Grants.[plan_handle]) AS QueryPlan WHERE Grants.granted_memory_kb > ((@MemoryGrantThresholdPct/100.00)*(@MaxWorkspace*1024)); - /* Query Problems - Memory Leak in USERSTORE_TOKENPERM Cache - CheckID 45 */ + /* Query insanity - Memory Leak in USERSTORE_TOKENPERM Cache - CheckID 45 */ IF EXISTS (SELECT * FROM sys.all_columns WHERE object_id = OBJECT_ID('sys.dm_os_memory_clerks') AND name = 'pages_kb') BEGIN IF (@Debug = 1) @@ -40405,7 +40405,7 @@ If one of them is a lead blocker, consider killing that query.'' AS HowToStopit, INSERT INTO #BlitzFirstResults (CheckID, Priority, FindingsGroup, Finding, Details, URL) SELECT 45 AS CheckID, 50 AS Priority, - ''Query Problems'' AS FindingsGroup, + ''Query insanity'' AS FindingsGroup, ''Memory Leak in USERSTORE_TOKENPERM Cache'' AS Finding, N''UserStore_TokenPerm clerk is using '' + CAST(CAST(SUM(CASE WHEN type = ''USERSTORE_TOKENPERM'' AND name = ''TokenAndPermUserStore'' THEN pages_kb * 1.0 ELSE 0.0 END) / 1024.0 / 1024.0 AS INT) AS NVARCHAR(100)) + N''GB RAM, total buffer pool is '' + CAST(CAST(SUM(pages_kb) / 1024.0 / 1024.0 AS INT) AS NVARCHAR(100)) + N''GB.'' @@ -40765,7 +40765,7 @@ If one of them is a lead blocker, consider killing that query.'' AS HowToStopit, END; /* IF @Seconds < 30 */ - /* Query Problems - Statistics Updated Recently - CheckID 44 */ + /* Query insanity - Statistics Updated Recently - CheckID 44 */ IF (@Debug = 1) BEGIN RAISERROR('Running CheckID 44',10,1) WITH NOWAIT; @@ -40859,7 +40859,7 @@ If one of them is a lead blocker, consider killing that query.'' AS HowToStopit, INSERT INTO #BlitzFirstResults (CheckID, Priority, FindingsGroup, Finding, URL, Details, HowToStopIt) SELECT 44 AS CheckId, 50 AS Priority, - 'Query Problems' AS FindingGroup, + 'Query insanity' AS FindingGroup, 'Statistics Updated Recently' AS Finding, 'https://www.brentozar.com/go/stats' AS URL, 'In the last 15 minutes, statistics were updated. To see which ones, click the HowToStopIt column.' + @LineFeed + @LineFeed @@ -41381,7 +41381,7 @@ If one of them is a lead blocker, consider killing that query.'' AS HowToStopit, AND counter_name = 'Log Shrinks' AND value_delta > 0; - /* Query Problems - Compilations/Sec High - CheckID 15 */ + /* Query insanity - Compilations/Sec High - CheckID 15 */ IF (@Debug = 1) BEGIN RAISERROR('Running CheckID 15',10,1) WITH NOWAIT; @@ -41390,7 +41390,7 @@ If one of them is a lead blocker, consider killing that query.'' AS HowToStopit, INSERT INTO #BlitzFirstResults (CheckID, Priority, FindingsGroup, Finding, URL, Details, HowToStopIt) SELECT 15 AS CheckID, 50 AS Priority, - 'Query Problems' AS FindingGroup, + 'Query insanity' AS FindingGroup, 'Compilations/Sec High' AS Finding, 'https://www.brentozar.com/askbrent/compilations/' AS URL, 'Number of batch requests during the sample: ' + CAST(ps.value_delta AS NVARCHAR(20)) + @LineFeed @@ -41408,7 +41408,7 @@ If one of them is a lead blocker, consider killing that query.'' AS HowToStopit, AND (psComp.value_delta > (10 * @Seconds) OR psComp.value_delta > ps.value_delta) /* Either doing 10 compilations per second, or more compilations than queries */ AND (psComp.value_delta * 10) > ps.value_delta; /* Compilations are more than 10% of batch requests per second */ - /* Query Problems - Re-Compilations/Sec High - CheckID 16 */ + /* Query insanity - Re-Compilations/Sec High - CheckID 16 */ IF (@Debug = 1) BEGIN RAISERROR('Running CheckID 16',10,1) WITH NOWAIT; @@ -41417,7 +41417,7 @@ If one of them is a lead blocker, consider killing that query.'' AS HowToStopit, INSERT INTO #BlitzFirstResults (CheckID, Priority, FindingsGroup, Finding, URL, Details, HowToStopIt) SELECT 16 AS CheckID, 50 AS Priority, - 'Query Problems' AS FindingGroup, + 'Query insanity' AS FindingGroup, 'Re-Compilations/Sec High' AS Finding, 'https://www.brentozar.com/askbrent/recompilations/' AS URL, 'Number of batch requests during the sample: ' + CAST(ps.value_delta AS NVARCHAR(20)) + @LineFeed @@ -41435,7 +41435,7 @@ If one of them is a lead blocker, consider killing that query.'' AS HowToStopit, AND (psComp.value_delta > (10 * @Seconds) OR psComp.value_delta > ps.value_delta) /* Either doing 10 recompilations per second, or more recompilations than queries */ AND (psComp.value_delta * 10) > ps.value_delta; /* Recompilations are more than 10% of batch requests per second */ - /* Table Problems - Forwarded Fetches/Sec High - CheckID 29 */ + /* Table insanity - Forwarded Fetches/Sec High - CheckID 29 */ IF (@Debug = 1) BEGIN RAISERROR('Running CheckID 29',10,1) WITH NOWAIT; @@ -41444,7 +41444,7 @@ If one of them is a lead blocker, consider killing that query.'' AS HowToStopit, INSERT INTO #BlitzFirstResults (CheckID, Priority, FindingsGroup, Finding, URL, Details, HowToStopIt) SELECT 29 AS CheckID, 40 AS Priority, - 'Table Problems' AS FindingGroup, + 'Table insanity' AS FindingGroup, 'Forwarded Fetches/Sec High' AS Finding, 'https://www.brentozar.com/go/fetch/' AS URL, CAST(ps.value_delta AS NVARCHAR(20)) + ' forwarded fetches (from SQLServer:Access Methods counter)' + @LineFeed @@ -41465,7 +41465,7 @@ If one of them is a lead blocker, consider killing that query.'' AS HowToStopit, INSERT INTO #BlitzFirstResults (CheckID, Priority, FindingsGroup, Finding, URL, Details, HowToStopIt) SELECT TOP 10 29 AS CheckID, 40 AS Priority, - ''Table Problems'' AS FindingGroup, + ''Table insanity'' AS FindingGroup, ''Forwarded Fetches/Sec High: TempDB Object'' AS Finding, ''https://www.brentozar.com/go/fetch/'' AS URL, CAST(COALESCE(os.forwarded_fetch_count,0) - COALESCE(os_prior.forwarded_fetch_count,0) AS NVARCHAR(20)) + '' forwarded fetches on '' + @@ -41529,7 +41529,7 @@ If one of them is a lead blocker, consider killing that query.'' AS HowToStopit, AND ps.counter_name = 'Transactions aborted/sec' AND ps.value_delta > (10 * @Seconds); /* Ignore servers sitting idle */ - /* Query Problems - Suboptimal Plans/Sec High - CheckID 33 */ + /* Query insanity - Suboptimal Plans/Sec High - CheckID 33 */ IF (@Debug = 1) BEGIN RAISERROR('Running CheckID 33',10,1) WITH NOWAIT; @@ -41538,7 +41538,7 @@ If one of them is a lead blocker, consider killing that query.'' AS HowToStopit, INSERT INTO #BlitzFirstResults (CheckID, Priority, FindingsGroup, Finding, URL, Details, HowToStopIt) SELECT 32 AS CheckID, 100 AS Priority, - 'Query Problems' AS FindingGroup, + 'Query insanity' AS FindingGroup, 'Suboptimal Plans/Sec High' AS Finding, 'https://www.brentozar.com/go/suboptimal/' AS URL, CAST(ps.value_delta AS NVARCHAR(50)) + ' plans reported in the ' + CAST(ps.instance_name AS NVARCHAR(100)) + ' workload group (from Workload GroupStats:Suboptimal plans/sec counter)' + @LineFeed @@ -41681,7 +41681,7 @@ If one of them is a lead blocker, consider killing that query.'' AS HowToStopit, SELECT 47 AS CheckId, 50 AS Priority, - 'Query Problems' AS FindingsGroup, + 'Query insanity' AS FindingsGroup, 'High Percentage Of Runnable Queries' AS Finding, 'https://erikdarlingdata.com/go/RunnableQueue/' AS URL, 'On the ' @@ -41812,7 +41812,7 @@ If one of them is a lead blocker, consider killing that query.'' AS HowToStopit, ) VALUES ( -1 , 1 , - 'No Problems Found' , + 'No insanity Found' , 'From Your Community Volunteers' , 'http://FirstResponderKit.org/' , 'Try running our more in-depth checks with sp_Blitz, or there may not be an unusual SQL Server performance problem. ' From 377a8c614ea0144e94880ebcf5e1fb4c6a565b45 Mon Sep 17 00:00:00 2001 From: Sean Killeen Date: Tue, 16 Jan 2024 12:06:11 -0500 Subject: [PATCH 19/33] Welp, that didn't do the right thing at all. This reverts commit cfbf261e20f777f32e1315039ed0c026d309992f. --- Install-All-Scripts.sql | 112 ++++++++++++------------ Install-Core-Blitz-No-Query-Store.sql | 102 ++++++++++----------- Install-Core-Blitz-With-Query-Store.sql | 112 ++++++++++++------------ 3 files changed, 163 insertions(+), 163 deletions(-) diff --git a/Install-All-Scripts.sql b/Install-All-Scripts.sql index 0cf3afc9..9fa75fdd 100644 --- a/Install-All-Scripts.sql +++ b/Install-All-Scripts.sql @@ -3585,7 +3585,7 @@ AS SET @CheckUserDatabaseObjects = 0; PRINT 'Databases with compatibility level < 90 found, so setting @CheckUserDatabaseObjects = 0.'; PRINT 'The database-level checks rely on CTEs, which are not supported in SQL 2000 compat level databases.'; - PRINT 'Get with the cool kids and switch to a current compatibility level, Grandpa. To find the insanity, run:'; + PRINT 'Get with the cool kids and switch to a current compatibility level, Grandpa. To find the problems, run:'; PRINT 'SELECT * FROM sys.databases WHERE compatibility_level < 90;'; INSERT INTO #BlitzResults ( CheckID , @@ -4022,7 +4022,7 @@ AS IF @BringThePain = 0 AND 50 <= (SELECT COUNT(*) FROM sys.databases) AND @CheckUserDatabaseObjects = 1 BEGIN SET @CheckUserDatabaseObjects = 0; - PRINT 'Running sp_Blitz @CheckUserDatabaseObjects = 1 on a server with 50+ databases may cause temporary insanity for the server and/or user.'; + PRINT 'Running sp_Blitz @CheckUserDatabaseObjects = 1 on a server with 50+ databases may cause temporary problems for the server and/or user.'; PRINT 'If you''re sure you want to do this, run again with the parameter @BringThePain = 1.'; INSERT INTO #BlitzResults ( CheckID , @@ -4117,9 +4117,9 @@ AS Below, we check master.sys.databases looking for databases that haven't had a backup in the last week. If we find any, we insert them into #BlitzResults, the temp table that - tracks our server's insanity. Note that if the check does - NOT find any insanity, we don't save that. We're only - saving the insanity, not the successful checks. + tracks our server's problems. Note that if the check does + NOT find any problems, we don't save that. We're only + saving the problems, not the successful checks. */ IF @Debug IN (1, 2) RAISERROR('Running CheckId [%d].', 0, 1, 1) WITH NOWAIT; @@ -4209,7 +4209,7 @@ AS And there you have it. The rest of this stored procedure works the same way: it asks: - Should I skip this check? - - If not, do I find insanity? + - If not, do I find problems? - Insert the results into #BlitzResults */ @@ -4757,7 +4757,7 @@ AS 'https://www.brentozar.com/go/owners' AS URL , ( 'Job [' + j.name + '] is owned by [' + SUSER_SNAME(j.owner_sid) - + '] - meaning if their login is disabled or not available due to Active Directory insanity, the job will stop working.' ) AS Details + + '] - meaning if their login is disabled or not available due to Active Directory problems, the job will stop working.' ) AS Details FROM msdb.dbo.sysjobs j WHERE j.enabled = 1 AND SUSER_SNAME(j.owner_sid) <> SUSER_SNAME(0x01); @@ -6665,7 +6665,7 @@ AS 'Performance' AS FindingGroup , 'CPU Schedulers Offline' AS Finding , 'https://www.brentozar.com/go/schedulers' AS URL , - 'Some CPU cores are not accessible to SQL Server due to affinity masking or licensing insanity.'; + 'Some CPU cores are not accessible to SQL Server due to affinity masking or licensing problems.'; END; IF NOT EXISTS ( SELECT 1 @@ -6693,7 +6693,7 @@ AS ''Performance'' AS FindingGroup , ''Memory Nodes Offline'' AS Finding , ''https://www.brentozar.com/go/schedulers'' AS URL , - ''Due to affinity masking or licensing insanity, some of the memory may not be available.'' OPTION (RECOMPILE)'; + ''Due to affinity masking or licensing problems, some of the memory may not be available.'' OPTION (RECOMPILE)'; IF @Debug = 2 AND @StringToExecute IS NOT NULL PRINT @StringToExecute; IF @Debug = 2 AND @StringToExecute IS NULL PRINT '@StringToExecute has gone NULL, for some reason.'; @@ -6780,7 +6780,7 @@ AS 'Performance' AS FindingGroup , 'Poison Wait Detected: ' + wait_type AS Finding , 'https://www.brentozar.com/go/poison/#' + wait_type AS URL , - CONVERT(VARCHAR(10), (SUM([wait_time_ms]) / 1000) / 86400) + ':' + CONVERT(VARCHAR(20), DATEADD(s, (SUM([wait_time_ms]) / 1000), 0), 108) + ' of this wait have been recorded. This wait often indicates killer performance insanity.' + CONVERT(VARCHAR(10), (SUM([wait_time_ms]) / 1000) / 86400) + ':' + CONVERT(VARCHAR(20), DATEADD(s, (SUM([wait_time_ms]) / 1000), 0), 108) + ' of this wait have been recorded. This wait often indicates killer performance problems.' FROM sys.[dm_os_wait_stats] WHERE wait_type IN('IO_QUEUE_LIMIT', 'IO_RETRY', 'LOG_RATE_GOVERNOR', 'POOL_LOG_RATE_GOVERNOR', 'PREEMPTIVE_DEBUG', 'RESMGR_THROTTLED', 'RESOURCE_SEMAPHORE', 'RESOURCE_SEMAPHORE_QUERY_COMPILE','SE_REPL_CATCHUP_THROTTLE','SE_REPL_COMMIT_ACK','SE_REPL_COMMIT_TURN','SE_REPL_ROLLBACK_ACK','SE_REPL_SLOW_SECONDARY_THROTTLE','THREADPOOL') GROUP BY wait_type @@ -6808,7 +6808,7 @@ AS 'Performance' AS FindingGroup , 'Poison Wait Detected: Serializable Locking' AS Finding , 'https://www.brentozar.com/go/serializable' AS URL , - CONVERT(VARCHAR(10), (SUM([wait_time_ms]) / 1000) / 86400) + ':' + CONVERT(VARCHAR(20), DATEADD(s, (SUM([wait_time_ms]) / 1000), 0), 108) + ' of LCK_M_R% waits have been recorded. This wait often indicates killer performance insanity.' + CONVERT(VARCHAR(10), (SUM([wait_time_ms]) / 1000) / 86400) + ':' + CONVERT(VARCHAR(20), DATEADD(s, (SUM([wait_time_ms]) / 1000), 0), 108) + ' of LCK_M_R% waits have been recorded. This wait often indicates killer performance problems.' FROM sys.[dm_os_wait_stats] WHERE wait_type IN ('LCK_M_RS_S', 'LCK_M_RS_U', 'LCK_M_RIn_NL','LCK_M_RIn_S', 'LCK_M_RIn_U','LCK_M_RIn_X', 'LCK_M_RX_S', 'LCK_M_RX_U','LCK_M_RX_X') HAVING SUM([wait_time_ms]) > (SELECT 5000 * datediff(HH,create_date,CURRENT_TIMESTAMP) AS hours_since_startup FROM sys.databases WHERE name='tempdb') @@ -10016,7 +10016,7 @@ IF @ProductVersionMajor >= 10 ''Performance'' AS FindingsGroup, ''Fill Factor Changed'', ''https://www.brentozar.com/go/fillfactor'' AS URL, - ''The ['' + DB_NAME() + ''] database has '' + CAST(SUM(1) AS NVARCHAR(50)) + '' objects with fill factor = '' + CAST(fill_factor AS NVARCHAR(5)) + ''%. This can cause memory and storage performance insanity, but may also prevent page splits.'' + ''The ['' + DB_NAME() + ''] database has '' + CAST(SUM(1) AS NVARCHAR(50)) + '' objects with fill factor = '' + CAST(fill_factor AS NVARCHAR(5)) + ''%. This can cause memory and storage performance problems, but may also prevent page splits.'' FROM [?].sys.indexes WHERE fill_factor <> 0 AND fill_factor < 80 AND is_disabled = 0 AND is_hypothetical = 0 GROUP BY fill_factor OPTION (RECOMPILE);'; @@ -10999,7 +10999,7 @@ IF @ProductVersionMajor >= 10 'Security' AS [FindingsGroup] , 'Endpoints Owned by Users' AS [Finding] , 'https://www.brentozar.com/go/owners' AS [URL] , - ( 'Endpoint ' + ep.[name] + ' is owned by ' + SUSER_NAME(ep.principal_id) + '. If the endpoint owner login is disabled or not available due to Active Directory insanity, the high availability will stop working.' + ( 'Endpoint ' + ep.[name] + ' is owned by ' + SUSER_NAME(ep.principal_id) + '. If the endpoint owner login is disabled or not available due to Active Directory problems, the high availability will stop working.' ) AS [Details] FROM sys.database_mirroring_endpoints ep LEFT OUTER JOIN sys.dm_server_services s ON SUSER_NAME(ep.principal_id) = s.service_account @@ -14687,7 +14687,7 @@ RAISERROR('Rules analysis starting', 0, 1) WITH NOWAIT; INSERT #Warnings (CheckId, Priority, DatabaseName, Finding, Warning ) EXEC sys.sp_executesql @StringToExecute; - /*Looking for compatibility level changing. Only looking for databases that have changed more than twice (It''s possible someone may have changed up, had CE insanity, and then changed back)*/ + /*Looking for compatibility level changing. Only looking for databases that have changed more than twice (It''s possible someone may have changed up, had CE problems, and then changed back)*/ SET @StringToExecute = N'SET TRANSACTION ISOLATION LEVEL READ UNCOMMITTED;' + @crlf; @@ -20235,7 +20235,7 @@ RAISERROR('Checking for plans with no warnings', 0, 1) WITH NOWAIT; UPDATE ##BlitzCacheProcs SET Warnings = 'No warnings detected. ' + CASE @ExpertMode WHEN 0 - THEN ' Try running sp_BlitzCache with @ExpertMode = 1 to find more advanced insanity.' + THEN ' Try running sp_BlitzCache with @ExpertMode = 1 to find more advanced problems.' ELSE '' END WHERE Warnings = '' OR Warnings IS NULL @@ -20943,7 +20943,7 @@ BEGIN 'Performance', 'Function Join', 'https://www.brentozar.com/blitzcache/tvf-join/', - 'Execution plans have been found that join to table valued functions (TVFs). TVFs produce inaccurate estimates of the number of rows returned and can lead to any number of query plan insanity.'); + 'Execution plans have been found that join to table valued functions (TVFs). TVFs produce inaccurate estimates of the number of rows returned and can lead to any number of query plan problems.'); IF EXISTS (SELECT 1/0 FROM ##BlitzCacheProcs @@ -21256,7 +21256,7 @@ BEGIN 'Functions', 'Computed Column UDF', 'https://www.brentozar.com/blitzcache/computed-columns-referencing-functions/', - 'This can cause a whole mess of bad serializartion insanity.') ; + 'This can cause a whole mess of bad serializartion problems.') ; IF EXISTS (SELECT 1/0 FROM ##BlitzCacheProcs p @@ -21510,7 +21510,7 @@ BEGIN 'Functions', 'MSTVFs', 'https://www.brentozar.com/blitzcache/tvf-join/', - 'Execution plans have been found that join to table valued functions (TVFs). TVFs produce inaccurate estimates of the number of rows returned and can lead to any number of query plan insanity.'); + 'Execution plans have been found that join to table valued functions (TVFs). TVFs produce inaccurate estimates of the number of rows returned and can lead to any number of query plan problems.'); IF EXISTS (SELECT 1/0 FROM ##BlitzCacheProcs p @@ -23015,7 +23015,7 @@ Known limitations of this version: filegroup/partition scheme etc.) -- (The compression and filegroup index create syntax is not trivial because it is set at the partition level and is not trivial to code.) - - Does not advise you about data modeling for clustered indexes and primary keys (primarily looks for signs of insanity.) + - Does not advise you about data modeling for clustered indexes and primary keys (primarily looks for signs of problems.) Unknown limitations of this version: - We knew them once, but we forgot. @@ -23857,7 +23857,7 @@ BEGIN TRY VALUES ( 1, 0, N'You''re trying to run sp_BlitzIndex on a server with ' + CAST(@NumDatabases AS NVARCHAR(8)) + N' databases. ', - N'Running sp_BlitzIndex on a server with 50+ databases may cause temporary insanity for the server and/or user.', + N'Running sp_BlitzIndex on a server with 50+ databases may cause temporary problems for the server and/or user.', N'If you''re sure you want to do this, run again with the parameter @BringThePain = 1.', 'http://FirstResponderKit.org', '', @@ -23884,7 +23884,7 @@ BEGIN TRY bir.create_tsql, bir.more_info FROM #BlitzIndexResults AS bir; - RAISERROR('Running sp_BlitzIndex on a server with 50+ databases may cause temporary insanity for the server', 12, 1); + RAISERROR('Running sp_BlitzIndex on a server with 50+ databases may cause temporary problems for the server', 12, 1); END; RETURN; @@ -28007,7 +28007,7 @@ BEGIN INSERT #BlitzIndexResults ( Priority, check_id, findings_group, finding, URL, details, index_definition, index_usage_summary, index_size_summary ) VALUES ( 1, 0 , - N'No Major insanity Found', + N'No Major Problems Found', N'Nice Work!', N'http://FirstResponderKit.org', N'Consider running with @Mode = 4 in individual databases (not all) for more detailed diagnostics.', @@ -28029,7 +28029,7 @@ BEGIN INSERT #BlitzIndexResults ( Priority, check_id, findings_group, finding, URL, details, index_definition, index_usage_summary, index_size_summary ) VALUES ( 1, 0 , - N'No insanity Found', + N'No Problems Found', N'Nice job! Or more likely, you have a nearly empty database.', N'http://FirstResponderKit.org', 'Time to go read some blog posts.', @DaysUptimeInsertValue, N'', N'' @@ -38335,7 +38335,7 @@ BEGIN 'Performance', 'Joining to table valued functions', 'https://www.brentozar.com/blitzcache/tvf-join/', - 'Execution plans have been found that join to table valued functions (TVFs). TVFs produce inaccurate estimates of the number of rows returned and can lead to any number of query plan insanity.'); + 'Execution plans have been found that join to table valued functions (TVFs). TVFs produce inaccurate estimates of the number of rows returned and can lead to any number of query plan problems.'); IF EXISTS (SELECT 1/0 FROM #working_warnings @@ -38636,7 +38636,7 @@ BEGIN 'Computed Columns Referencing Scalar UDFs', 'This makes a whole lot of stuff run serially', 'https://www.brentozar.com/blitzcache/computed-columns-referencing-functions/', - 'This can cause a whole mess of bad serializartion insanity.') ; + 'This can cause a whole mess of bad serializartion problems.') ; IF EXISTS (SELECT 1/0 FROM #working_warnings p @@ -38844,7 +38844,7 @@ BEGIN 'High tempdb use', 'This query uses more than half of a data file on average', 'No URL yet', - 'You should take a look at tempdb waits to see if you''re having insanity') ; + 'You should take a look at tempdb waits to see if you''re having problems') ; IF EXISTS (SELECT 1/0 FROM #working_warnings p @@ -38867,9 +38867,9 @@ BEGIN 60, 100, 'MSTVFs', - 'These have many of the same insanity scalar UDFs have', + 'These have many of the same problems scalar UDFs have', 'https://www.brentozar.com/blitzcache/tvf-join/', - 'Execution plans have been found that join to table valued functions (TVFs). TVFs produce inaccurate estimates of the number of rows returned and can lead to any number of query plan insanity.'); + 'Execution plans have been found that join to table valued functions (TVFs). TVFs produce inaccurate estimates of the number of rows returned and can lead to any number of query plan problems.'); IF EXISTS (SELECT 1/0 FROM #working_warnings p @@ -44861,7 +44861,7 @@ BEGIN AND r.database_id NOT IN (SELECT database_id FROM #ReadableDBs); END - /* Query insanity - Long-Running Query Blocking Others - CheckID 5 */ + /* Query Problems - Long-Running Query Blocking Others - CheckID 5 */ IF SERVERPROPERTY('EngineEdition') <> 5 /*SERVERPROPERTY('Edition') <> 'SQL Azure'*/ AND @Seconds > 0 AND EXISTS(SELECT * FROM sys.dm_os_waiting_tasks WHERE wait_type LIKE 'LCK%' AND wait_duration_ms > 30000) BEGIN IF (@Debug = 1) @@ -44872,7 +44872,7 @@ BEGIN SET @StringToExecute = N'INSERT INTO #BlitzFirstResults (CheckID, Priority, FindingsGroup, Finding, URL, Details, HowToStopIt, QueryPlan, QueryText, StartTime, LoginName, NTUserName, ProgramName, HostName, DatabaseID, DatabaseName, OpenTransactionCount, QueryHash) SELECT 5 AS CheckID, 1 AS Priority, - ''Query insanity'' AS FindingGroup, + ''Query Problems'' AS FindingGroup, ''Long-Running Query Blocking Others'' AS Finding, ''https://www.brentozar.com/go/blocking'' AS URL, ''Query in '' + COALESCE(DB_NAME(COALESCE((SELECT TOP 1 dbid FROM sys.dm_exec_sql_text(r.sql_handle)), @@ -44904,7 +44904,7 @@ BEGIN EXECUTE sp_executesql @StringToExecute; END; - /* Query insanity - Plan Cache Erased Recently - CheckID 7 */ + /* Query Problems - Plan Cache Erased Recently - CheckID 7 */ IF DATEADD(mi, -15, SYSDATETIME()) < (SELECT TOP 1 creation_time FROM sys.dm_exec_query_stats ORDER BY creation_time) BEGIN IF (@Debug = 1) @@ -44915,7 +44915,7 @@ BEGIN INSERT INTO #BlitzFirstResults (CheckID, Priority, FindingsGroup, Finding, URL, Details, HowToStopIt) SELECT TOP 1 7 AS CheckID, 50 AS Priority, - 'Query insanity' AS FindingGroup, + 'Query Problems' AS FindingGroup, 'Plan Cache Erased Recently' AS Finding, 'https://www.brentozar.com/askbrent/plan-cache-erased-recently/' AS URL, 'The oldest query in the plan cache was created at ' + CAST(creation_time AS NVARCHAR(50)) + '. ' + @LineFeed + @LineFeed @@ -44929,7 +44929,7 @@ BEGIN END; - /* Query insanity - Sleeping Query with Open Transactions - CheckID 8 */ + /* Query Problems - Sleeping Query with Open Transactions - CheckID 8 */ IF @Seconds > 0 BEGIN IF (@Debug = 1) @@ -44941,7 +44941,7 @@ BEGIN INSERT INTO #BlitzFirstResults (CheckID, Priority, FindingsGroup, Finding, URL, Details, HowToStopIt, StartTime, LoginName, NTUserName, ProgramName, HostName, DatabaseID, DatabaseName, QueryText, OpenTransactionCount) SELECT 8 AS CheckID, 50 AS Priority, - 'Query insanity' AS FindingGroup, + 'Query Problems' AS FindingGroup, 'Sleeping Query with Open Transactions' AS Finding, 'https://www.brentozar.com/askbrent/sleeping-query-with-open-transactions/' AS URL, 'Database: ' + DB_NAME(db.resource_database_id) + @LineFeed + 'Host: ' + s.hostname + @LineFeed + 'Program: ' + s.[program_name] + @LineFeed + 'Asleep with open transactions and locks since ' + CAST(s.last_batch AS NVARCHAR(100)) + '. ' AS Details, @@ -44971,7 +44971,7 @@ BEGIN AND NOT (resource_type = N'DATABASE' AND request_mode = N'S' AND request_status = N'GRANT' AND request_owner_type = N'SHARED_TRANSACTION_WORKSPACE')); END - /*Query insanity - Clients using implicit transactions - CheckID 37 */ + /*Query Problems - Clients using implicit transactions - CheckID 37 */ IF @Seconds > 0 AND ( @@VERSION NOT LIKE 'Microsoft SQL Server 2005%' AND @@VERSION NOT LIKE 'Microsoft SQL Server 2008%' @@ -44985,7 +44985,7 @@ BEGIN SET @StringToExecute = N'INSERT INTO #BlitzFirstResults (CheckID, Priority, FindingsGroup, Finding, URL, Details, HowToStopIt, StartTime, LoginName, NTUserName, ProgramName, HostName, DatabaseID, DatabaseName, QueryText, OpenTransactionCount) SELECT 37 AS CheckId, 50 AS Priority, - ''Query insanity'' AS FindingsGroup, + ''Query Problems'' AS FindingsGroup, ''Implicit Transactions'', ''https://www.brentozar.com/go/ImplicitTransactions/'' AS URL, ''Database: '' + DB_NAME(s.database_id) + '' '' + CHAR(13) + CHAR(10) + @@ -45016,7 +45016,7 @@ If one of them is a lead blocker, consider killing that query.'' AS HowToStopit, EXECUTE sp_executesql @StringToExecute; END; - /* Query insanity - Query Rolling Back - CheckID 9 */ + /* Query Problems - Query Rolling Back - CheckID 9 */ IF @Seconds > 0 BEGIN IF (@Debug = 1) @@ -45028,7 +45028,7 @@ If one of them is a lead blocker, consider killing that query.'' AS HowToStopit, INSERT INTO #BlitzFirstResults (CheckID, Priority, FindingsGroup, Finding, URL, Details, HowToStopIt, StartTime, LoginName, NTUserName, ProgramName, HostName, DatabaseID, DatabaseName, QueryText, QueryHash) SELECT 9 AS CheckID, 1 AS Priority, - 'Query insanity' AS FindingGroup, + 'Query Problems' AS FindingGroup, 'Query Rolling Back' AS Finding, 'https://www.brentozar.com/askbrent/rollback/' AS URL, 'Rollback started at ' + CAST(r.start_time AS NVARCHAR(100)) + ', is ' + CAST(r.percent_complete AS NVARCHAR(100)) + '% complete.' AS Details, @@ -45061,7 +45061,7 @@ If one of them is a lead blocker, consider killing that query.'' AS HowToStopit, SELECT 47 AS CheckId, 50 AS Priority, - 'Query insanity' AS FindingsGroup, + 'Query Problems' AS FindingsGroup, 'High Percentage Of Runnable Queries' AS Finding, 'https://erikdarlingdata.com/go/RunnableQueue/' AS URL, 'On the ' @@ -45237,7 +45237,7 @@ If one of them is a lead blocker, consider killing that query.'' AS HowToStopit, 'https://www.brentozar.com/askbrent/' AS URL FROM sys.dm_exec_query_memory_grants AS Grants; - /* Query insanity - Queries with high memory grants - CheckID 46 */ + /* Query Problems - Queries with high memory grants - CheckID 46 */ IF (@Debug = 1) BEGIN RAISERROR('Running CheckID 46',10,1) WITH NOWAIT; @@ -45246,7 +45246,7 @@ If one of them is a lead blocker, consider killing that query.'' AS HowToStopit, INSERT INTO #BlitzFirstResults (CheckID, Priority, FindingsGroup, Finding, Details, URL, QueryText, QueryPlan) SELECT 46 AS CheckID, 100 AS Priority, - 'Query insanity' AS FindingGroup, + 'Query Problems' AS FindingGroup, 'Query with a memory grant exceeding ' +CAST(@MemoryGrantThresholdPct AS NVARCHAR(15)) +'%' AS Finding, @@ -45267,7 +45267,7 @@ If one of them is a lead blocker, consider killing that query.'' AS HowToStopit, OUTER APPLY sys.dm_exec_query_plan(Grants.[plan_handle]) AS QueryPlan WHERE Grants.granted_memory_kb > ((@MemoryGrantThresholdPct/100.00)*(@MaxWorkspace*1024)); - /* Query insanity - Memory Leak in USERSTORE_TOKENPERM Cache - CheckID 45 */ + /* Query Problems - Memory Leak in USERSTORE_TOKENPERM Cache - CheckID 45 */ IF EXISTS (SELECT * FROM sys.all_columns WHERE object_id = OBJECT_ID('sys.dm_os_memory_clerks') AND name = 'pages_kb') BEGIN IF (@Debug = 1) @@ -45280,7 +45280,7 @@ If one of them is a lead blocker, consider killing that query.'' AS HowToStopit, INSERT INTO #BlitzFirstResults (CheckID, Priority, FindingsGroup, Finding, Details, URL) SELECT 45 AS CheckID, 50 AS Priority, - ''Query insanity'' AS FindingsGroup, + ''Query Problems'' AS FindingsGroup, ''Memory Leak in USERSTORE_TOKENPERM Cache'' AS Finding, N''UserStore_TokenPerm clerk is using '' + CAST(CAST(SUM(CASE WHEN type = ''USERSTORE_TOKENPERM'' AND name = ''TokenAndPermUserStore'' THEN pages_kb * 1.0 ELSE 0.0 END) / 1024.0 / 1024.0 AS INT) AS NVARCHAR(100)) + N''GB RAM, total buffer pool is '' + CAST(CAST(SUM(pages_kb) / 1024.0 / 1024.0 AS INT) AS NVARCHAR(100)) + N''GB.'' @@ -45640,7 +45640,7 @@ If one of them is a lead blocker, consider killing that query.'' AS HowToStopit, END; /* IF @Seconds < 30 */ - /* Query insanity - Statistics Updated Recently - CheckID 44 */ + /* Query Problems - Statistics Updated Recently - CheckID 44 */ IF (@Debug = 1) BEGIN RAISERROR('Running CheckID 44',10,1) WITH NOWAIT; @@ -45734,7 +45734,7 @@ If one of them is a lead blocker, consider killing that query.'' AS HowToStopit, INSERT INTO #BlitzFirstResults (CheckID, Priority, FindingsGroup, Finding, URL, Details, HowToStopIt) SELECT 44 AS CheckId, 50 AS Priority, - 'Query insanity' AS FindingGroup, + 'Query Problems' AS FindingGroup, 'Statistics Updated Recently' AS Finding, 'https://www.brentozar.com/go/stats' AS URL, 'In the last 15 minutes, statistics were updated. To see which ones, click the HowToStopIt column.' + @LineFeed + @LineFeed @@ -46256,7 +46256,7 @@ If one of them is a lead blocker, consider killing that query.'' AS HowToStopit, AND counter_name = 'Log Shrinks' AND value_delta > 0; - /* Query insanity - Compilations/Sec High - CheckID 15 */ + /* Query Problems - Compilations/Sec High - CheckID 15 */ IF (@Debug = 1) BEGIN RAISERROR('Running CheckID 15',10,1) WITH NOWAIT; @@ -46265,7 +46265,7 @@ If one of them is a lead blocker, consider killing that query.'' AS HowToStopit, INSERT INTO #BlitzFirstResults (CheckID, Priority, FindingsGroup, Finding, URL, Details, HowToStopIt) SELECT 15 AS CheckID, 50 AS Priority, - 'Query insanity' AS FindingGroup, + 'Query Problems' AS FindingGroup, 'Compilations/Sec High' AS Finding, 'https://www.brentozar.com/askbrent/compilations/' AS URL, 'Number of batch requests during the sample: ' + CAST(ps.value_delta AS NVARCHAR(20)) + @LineFeed @@ -46283,7 +46283,7 @@ If one of them is a lead blocker, consider killing that query.'' AS HowToStopit, AND (psComp.value_delta > (10 * @Seconds) OR psComp.value_delta > ps.value_delta) /* Either doing 10 compilations per second, or more compilations than queries */ AND (psComp.value_delta * 10) > ps.value_delta; /* Compilations are more than 10% of batch requests per second */ - /* Query insanity - Re-Compilations/Sec High - CheckID 16 */ + /* Query Problems - Re-Compilations/Sec High - CheckID 16 */ IF (@Debug = 1) BEGIN RAISERROR('Running CheckID 16',10,1) WITH NOWAIT; @@ -46292,7 +46292,7 @@ If one of them is a lead blocker, consider killing that query.'' AS HowToStopit, INSERT INTO #BlitzFirstResults (CheckID, Priority, FindingsGroup, Finding, URL, Details, HowToStopIt) SELECT 16 AS CheckID, 50 AS Priority, - 'Query insanity' AS FindingGroup, + 'Query Problems' AS FindingGroup, 'Re-Compilations/Sec High' AS Finding, 'https://www.brentozar.com/askbrent/recompilations/' AS URL, 'Number of batch requests during the sample: ' + CAST(ps.value_delta AS NVARCHAR(20)) + @LineFeed @@ -46310,7 +46310,7 @@ If one of them is a lead blocker, consider killing that query.'' AS HowToStopit, AND (psComp.value_delta > (10 * @Seconds) OR psComp.value_delta > ps.value_delta) /* Either doing 10 recompilations per second, or more recompilations than queries */ AND (psComp.value_delta * 10) > ps.value_delta; /* Recompilations are more than 10% of batch requests per second */ - /* Table insanity - Forwarded Fetches/Sec High - CheckID 29 */ + /* Table Problems - Forwarded Fetches/Sec High - CheckID 29 */ IF (@Debug = 1) BEGIN RAISERROR('Running CheckID 29',10,1) WITH NOWAIT; @@ -46319,7 +46319,7 @@ If one of them is a lead blocker, consider killing that query.'' AS HowToStopit, INSERT INTO #BlitzFirstResults (CheckID, Priority, FindingsGroup, Finding, URL, Details, HowToStopIt) SELECT 29 AS CheckID, 40 AS Priority, - 'Table insanity' AS FindingGroup, + 'Table Problems' AS FindingGroup, 'Forwarded Fetches/Sec High' AS Finding, 'https://www.brentozar.com/go/fetch/' AS URL, CAST(ps.value_delta AS NVARCHAR(20)) + ' forwarded fetches (from SQLServer:Access Methods counter)' + @LineFeed @@ -46340,7 +46340,7 @@ If one of them is a lead blocker, consider killing that query.'' AS HowToStopit, INSERT INTO #BlitzFirstResults (CheckID, Priority, FindingsGroup, Finding, URL, Details, HowToStopIt) SELECT TOP 10 29 AS CheckID, 40 AS Priority, - ''Table insanity'' AS FindingGroup, + ''Table Problems'' AS FindingGroup, ''Forwarded Fetches/Sec High: TempDB Object'' AS Finding, ''https://www.brentozar.com/go/fetch/'' AS URL, CAST(COALESCE(os.forwarded_fetch_count,0) - COALESCE(os_prior.forwarded_fetch_count,0) AS NVARCHAR(20)) + '' forwarded fetches on '' + @@ -46404,7 +46404,7 @@ If one of them is a lead blocker, consider killing that query.'' AS HowToStopit, AND ps.counter_name = 'Transactions aborted/sec' AND ps.value_delta > (10 * @Seconds); /* Ignore servers sitting idle */ - /* Query insanity - Suboptimal Plans/Sec High - CheckID 33 */ + /* Query Problems - Suboptimal Plans/Sec High - CheckID 33 */ IF (@Debug = 1) BEGIN RAISERROR('Running CheckID 33',10,1) WITH NOWAIT; @@ -46413,7 +46413,7 @@ If one of them is a lead blocker, consider killing that query.'' AS HowToStopit, INSERT INTO #BlitzFirstResults (CheckID, Priority, FindingsGroup, Finding, URL, Details, HowToStopIt) SELECT 32 AS CheckID, 100 AS Priority, - 'Query insanity' AS FindingGroup, + 'Query Problems' AS FindingGroup, 'Suboptimal Plans/Sec High' AS Finding, 'https://www.brentozar.com/go/suboptimal/' AS URL, CAST(ps.value_delta AS NVARCHAR(50)) + ' plans reported in the ' + CAST(ps.instance_name AS NVARCHAR(100)) + ' workload group (from Workload GroupStats:Suboptimal plans/sec counter)' + @LineFeed @@ -46556,7 +46556,7 @@ If one of them is a lead blocker, consider killing that query.'' AS HowToStopit, SELECT 47 AS CheckId, 50 AS Priority, - 'Query insanity' AS FindingsGroup, + 'Query Problems' AS FindingsGroup, 'High Percentage Of Runnable Queries' AS Finding, 'https://erikdarlingdata.com/go/RunnableQueue/' AS URL, 'On the ' @@ -46687,7 +46687,7 @@ If one of them is a lead blocker, consider killing that query.'' AS HowToStopit, ) VALUES ( -1 , 1 , - 'No insanity Found' , + 'No Problems Found' , 'From Your Community Volunteers' , 'http://FirstResponderKit.org/' , 'Try running our more in-depth checks with sp_Blitz, or there may not be an unusual SQL Server performance problem. ' diff --git a/Install-Core-Blitz-No-Query-Store.sql b/Install-Core-Blitz-No-Query-Store.sql index 40d2a22b..2b2dcc93 100644 --- a/Install-Core-Blitz-No-Query-Store.sql +++ b/Install-Core-Blitz-No-Query-Store.sql @@ -723,7 +723,7 @@ AS SET @CheckUserDatabaseObjects = 0; PRINT 'Databases with compatibility level < 90 found, so setting @CheckUserDatabaseObjects = 0.'; PRINT 'The database-level checks rely on CTEs, which are not supported in SQL 2000 compat level databases.'; - PRINT 'Get with the cool kids and switch to a current compatibility level, Grandpa. To find the insanity, run:'; + PRINT 'Get with the cool kids and switch to a current compatibility level, Grandpa. To find the problems, run:'; PRINT 'SELECT * FROM sys.databases WHERE compatibility_level < 90;'; INSERT INTO #BlitzResults ( CheckID , @@ -1160,7 +1160,7 @@ AS IF @BringThePain = 0 AND 50 <= (SELECT COUNT(*) FROM sys.databases) AND @CheckUserDatabaseObjects = 1 BEGIN SET @CheckUserDatabaseObjects = 0; - PRINT 'Running sp_Blitz @CheckUserDatabaseObjects = 1 on a server with 50+ databases may cause temporary insanity for the server and/or user.'; + PRINT 'Running sp_Blitz @CheckUserDatabaseObjects = 1 on a server with 50+ databases may cause temporary problems for the server and/or user.'; PRINT 'If you''re sure you want to do this, run again with the parameter @BringThePain = 1.'; INSERT INTO #BlitzResults ( CheckID , @@ -1255,9 +1255,9 @@ AS Below, we check master.sys.databases looking for databases that haven't had a backup in the last week. If we find any, we insert them into #BlitzResults, the temp table that - tracks our server's insanity. Note that if the check does - NOT find any insanity, we don't save that. We're only - saving the insanity, not the successful checks. + tracks our server's problems. Note that if the check does + NOT find any problems, we don't save that. We're only + saving the problems, not the successful checks. */ IF @Debug IN (1, 2) RAISERROR('Running CheckId [%d].', 0, 1, 1) WITH NOWAIT; @@ -1347,7 +1347,7 @@ AS And there you have it. The rest of this stored procedure works the same way: it asks: - Should I skip this check? - - If not, do I find insanity? + - If not, do I find problems? - Insert the results into #BlitzResults */ @@ -1895,7 +1895,7 @@ AS 'https://www.brentozar.com/go/owners' AS URL , ( 'Job [' + j.name + '] is owned by [' + SUSER_SNAME(j.owner_sid) - + '] - meaning if their login is disabled or not available due to Active Directory insanity, the job will stop working.' ) AS Details + + '] - meaning if their login is disabled or not available due to Active Directory problems, the job will stop working.' ) AS Details FROM msdb.dbo.sysjobs j WHERE j.enabled = 1 AND SUSER_SNAME(j.owner_sid) <> SUSER_SNAME(0x01); @@ -3803,7 +3803,7 @@ AS 'Performance' AS FindingGroup , 'CPU Schedulers Offline' AS Finding , 'https://www.brentozar.com/go/schedulers' AS URL , - 'Some CPU cores are not accessible to SQL Server due to affinity masking or licensing insanity.'; + 'Some CPU cores are not accessible to SQL Server due to affinity masking or licensing problems.'; END; IF NOT EXISTS ( SELECT 1 @@ -3831,7 +3831,7 @@ AS ''Performance'' AS FindingGroup , ''Memory Nodes Offline'' AS Finding , ''https://www.brentozar.com/go/schedulers'' AS URL , - ''Due to affinity masking or licensing insanity, some of the memory may not be available.'' OPTION (RECOMPILE)'; + ''Due to affinity masking or licensing problems, some of the memory may not be available.'' OPTION (RECOMPILE)'; IF @Debug = 2 AND @StringToExecute IS NOT NULL PRINT @StringToExecute; IF @Debug = 2 AND @StringToExecute IS NULL PRINT '@StringToExecute has gone NULL, for some reason.'; @@ -3918,7 +3918,7 @@ AS 'Performance' AS FindingGroup , 'Poison Wait Detected: ' + wait_type AS Finding , 'https://www.brentozar.com/go/poison/#' + wait_type AS URL , - CONVERT(VARCHAR(10), (SUM([wait_time_ms]) / 1000) / 86400) + ':' + CONVERT(VARCHAR(20), DATEADD(s, (SUM([wait_time_ms]) / 1000), 0), 108) + ' of this wait have been recorded. This wait often indicates killer performance insanity.' + CONVERT(VARCHAR(10), (SUM([wait_time_ms]) / 1000) / 86400) + ':' + CONVERT(VARCHAR(20), DATEADD(s, (SUM([wait_time_ms]) / 1000), 0), 108) + ' of this wait have been recorded. This wait often indicates killer performance problems.' FROM sys.[dm_os_wait_stats] WHERE wait_type IN('IO_QUEUE_LIMIT', 'IO_RETRY', 'LOG_RATE_GOVERNOR', 'POOL_LOG_RATE_GOVERNOR', 'PREEMPTIVE_DEBUG', 'RESMGR_THROTTLED', 'RESOURCE_SEMAPHORE', 'RESOURCE_SEMAPHORE_QUERY_COMPILE','SE_REPL_CATCHUP_THROTTLE','SE_REPL_COMMIT_ACK','SE_REPL_COMMIT_TURN','SE_REPL_ROLLBACK_ACK','SE_REPL_SLOW_SECONDARY_THROTTLE','THREADPOOL') GROUP BY wait_type @@ -3946,7 +3946,7 @@ AS 'Performance' AS FindingGroup , 'Poison Wait Detected: Serializable Locking' AS Finding , 'https://www.brentozar.com/go/serializable' AS URL , - CONVERT(VARCHAR(10), (SUM([wait_time_ms]) / 1000) / 86400) + ':' + CONVERT(VARCHAR(20), DATEADD(s, (SUM([wait_time_ms]) / 1000), 0), 108) + ' of LCK_M_R% waits have been recorded. This wait often indicates killer performance insanity.' + CONVERT(VARCHAR(10), (SUM([wait_time_ms]) / 1000) / 86400) + ':' + CONVERT(VARCHAR(20), DATEADD(s, (SUM([wait_time_ms]) / 1000), 0), 108) + ' of LCK_M_R% waits have been recorded. This wait often indicates killer performance problems.' FROM sys.[dm_os_wait_stats] WHERE wait_type IN ('LCK_M_RS_S', 'LCK_M_RS_U', 'LCK_M_RIn_NL','LCK_M_RIn_S', 'LCK_M_RIn_U','LCK_M_RIn_X', 'LCK_M_RX_S', 'LCK_M_RX_U','LCK_M_RX_X') HAVING SUM([wait_time_ms]) > (SELECT 5000 * datediff(HH,create_date,CURRENT_TIMESTAMP) AS hours_since_startup FROM sys.databases WHERE name='tempdb') @@ -7154,7 +7154,7 @@ IF @ProductVersionMajor >= 10 ''Performance'' AS FindingsGroup, ''Fill Factor Changed'', ''https://www.brentozar.com/go/fillfactor'' AS URL, - ''The ['' + DB_NAME() + ''] database has '' + CAST(SUM(1) AS NVARCHAR(50)) + '' objects with fill factor = '' + CAST(fill_factor AS NVARCHAR(5)) + ''%. This can cause memory and storage performance insanity, but may also prevent page splits.'' + ''The ['' + DB_NAME() + ''] database has '' + CAST(SUM(1) AS NVARCHAR(50)) + '' objects with fill factor = '' + CAST(fill_factor AS NVARCHAR(5)) + ''%. This can cause memory and storage performance problems, but may also prevent page splits.'' FROM [?].sys.indexes WHERE fill_factor <> 0 AND fill_factor < 80 AND is_disabled = 0 AND is_hypothetical = 0 GROUP BY fill_factor OPTION (RECOMPILE);'; @@ -8137,7 +8137,7 @@ IF @ProductVersionMajor >= 10 'Security' AS [FindingsGroup] , 'Endpoints Owned by Users' AS [Finding] , 'https://www.brentozar.com/go/owners' AS [URL] , - ( 'Endpoint ' + ep.[name] + ' is owned by ' + SUSER_NAME(ep.principal_id) + '. If the endpoint owner login is disabled or not available due to Active Directory insanity, the high availability will stop working.' + ( 'Endpoint ' + ep.[name] + ' is owned by ' + SUSER_NAME(ep.principal_id) + '. If the endpoint owner login is disabled or not available due to Active Directory problems, the high availability will stop working.' ) AS [Details] FROM sys.database_mirroring_endpoints ep LEFT OUTER JOIN sys.dm_server_services s ON SUSER_NAME(ep.principal_id) = s.service_account @@ -11825,7 +11825,7 @@ RAISERROR('Rules analysis starting', 0, 1) WITH NOWAIT; INSERT #Warnings (CheckId, Priority, DatabaseName, Finding, Warning ) EXEC sys.sp_executesql @StringToExecute; - /*Looking for compatibility level changing. Only looking for databases that have changed more than twice (It''s possible someone may have changed up, had CE insanity, and then changed back)*/ + /*Looking for compatibility level changing. Only looking for databases that have changed more than twice (It''s possible someone may have changed up, had CE problems, and then changed back)*/ SET @StringToExecute = N'SET TRANSACTION ISOLATION LEVEL READ UNCOMMITTED;' + @crlf; @@ -17373,7 +17373,7 @@ RAISERROR('Checking for plans with no warnings', 0, 1) WITH NOWAIT; UPDATE ##BlitzCacheProcs SET Warnings = 'No warnings detected. ' + CASE @ExpertMode WHEN 0 - THEN ' Try running sp_BlitzCache with @ExpertMode = 1 to find more advanced insanity.' + THEN ' Try running sp_BlitzCache with @ExpertMode = 1 to find more advanced problems.' ELSE '' END WHERE Warnings = '' OR Warnings IS NULL @@ -18081,7 +18081,7 @@ BEGIN 'Performance', 'Function Join', 'https://www.brentozar.com/blitzcache/tvf-join/', - 'Execution plans have been found that join to table valued functions (TVFs). TVFs produce inaccurate estimates of the number of rows returned and can lead to any number of query plan insanity.'); + 'Execution plans have been found that join to table valued functions (TVFs). TVFs produce inaccurate estimates of the number of rows returned and can lead to any number of query plan problems.'); IF EXISTS (SELECT 1/0 FROM ##BlitzCacheProcs @@ -18394,7 +18394,7 @@ BEGIN 'Functions', 'Computed Column UDF', 'https://www.brentozar.com/blitzcache/computed-columns-referencing-functions/', - 'This can cause a whole mess of bad serializartion insanity.') ; + 'This can cause a whole mess of bad serializartion problems.') ; IF EXISTS (SELECT 1/0 FROM ##BlitzCacheProcs p @@ -18648,7 +18648,7 @@ BEGIN 'Functions', 'MSTVFs', 'https://www.brentozar.com/blitzcache/tvf-join/', - 'Execution plans have been found that join to table valued functions (TVFs). TVFs produce inaccurate estimates of the number of rows returned and can lead to any number of query plan insanity.'); + 'Execution plans have been found that join to table valued functions (TVFs). TVFs produce inaccurate estimates of the number of rows returned and can lead to any number of query plan problems.'); IF EXISTS (SELECT 1/0 FROM ##BlitzCacheProcs p @@ -20153,7 +20153,7 @@ Known limitations of this version: filegroup/partition scheme etc.) -- (The compression and filegroup index create syntax is not trivial because it is set at the partition level and is not trivial to code.) - - Does not advise you about data modeling for clustered indexes and primary keys (primarily looks for signs of insanity.) + - Does not advise you about data modeling for clustered indexes and primary keys (primarily looks for signs of problems.) Unknown limitations of this version: - We knew them once, but we forgot. @@ -20995,7 +20995,7 @@ BEGIN TRY VALUES ( 1, 0, N'You''re trying to run sp_BlitzIndex on a server with ' + CAST(@NumDatabases AS NVARCHAR(8)) + N' databases. ', - N'Running sp_BlitzIndex on a server with 50+ databases may cause temporary insanity for the server and/or user.', + N'Running sp_BlitzIndex on a server with 50+ databases may cause temporary problems for the server and/or user.', N'If you''re sure you want to do this, run again with the parameter @BringThePain = 1.', 'http://FirstResponderKit.org', '', @@ -21022,7 +21022,7 @@ BEGIN TRY bir.create_tsql, bir.more_info FROM #BlitzIndexResults AS bir; - RAISERROR('Running sp_BlitzIndex on a server with 50+ databases may cause temporary insanity for the server', 12, 1); + RAISERROR('Running sp_BlitzIndex on a server with 50+ databases may cause temporary problems for the server', 12, 1); END; RETURN; @@ -25145,7 +25145,7 @@ BEGIN INSERT #BlitzIndexResults ( Priority, check_id, findings_group, finding, URL, details, index_definition, index_usage_summary, index_size_summary ) VALUES ( 1, 0 , - N'No Major insanity Found', + N'No Major Problems Found', N'Nice Work!', N'http://FirstResponderKit.org', N'Consider running with @Mode = 4 in individual databases (not all) for more detailed diagnostics.', @@ -25167,7 +25167,7 @@ BEGIN INSERT #BlitzIndexResults ( Priority, check_id, findings_group, finding, URL, details, index_definition, index_usage_summary, index_size_summary ) VALUES ( 1, 0 , - N'No insanity Found', + N'No Problems Found', N'Nice job! Or more likely, you have a nearly empty database.', N'http://FirstResponderKit.org', 'Time to go read some blog posts.', @DaysUptimeInsertValue, N'', N'' @@ -33913,7 +33913,7 @@ BEGIN AND r.database_id NOT IN (SELECT database_id FROM #ReadableDBs); END - /* Query insanity - Long-Running Query Blocking Others - CheckID 5 */ + /* Query Problems - Long-Running Query Blocking Others - CheckID 5 */ IF SERVERPROPERTY('EngineEdition') <> 5 /*SERVERPROPERTY('Edition') <> 'SQL Azure'*/ AND @Seconds > 0 AND EXISTS(SELECT * FROM sys.dm_os_waiting_tasks WHERE wait_type LIKE 'LCK%' AND wait_duration_ms > 30000) BEGIN IF (@Debug = 1) @@ -33924,7 +33924,7 @@ BEGIN SET @StringToExecute = N'INSERT INTO #BlitzFirstResults (CheckID, Priority, FindingsGroup, Finding, URL, Details, HowToStopIt, QueryPlan, QueryText, StartTime, LoginName, NTUserName, ProgramName, HostName, DatabaseID, DatabaseName, OpenTransactionCount, QueryHash) SELECT 5 AS CheckID, 1 AS Priority, - ''Query insanity'' AS FindingGroup, + ''Query Problems'' AS FindingGroup, ''Long-Running Query Blocking Others'' AS Finding, ''https://www.brentozar.com/go/blocking'' AS URL, ''Query in '' + COALESCE(DB_NAME(COALESCE((SELECT TOP 1 dbid FROM sys.dm_exec_sql_text(r.sql_handle)), @@ -33956,7 +33956,7 @@ BEGIN EXECUTE sp_executesql @StringToExecute; END; - /* Query insanity - Plan Cache Erased Recently - CheckID 7 */ + /* Query Problems - Plan Cache Erased Recently - CheckID 7 */ IF DATEADD(mi, -15, SYSDATETIME()) < (SELECT TOP 1 creation_time FROM sys.dm_exec_query_stats ORDER BY creation_time) BEGIN IF (@Debug = 1) @@ -33967,7 +33967,7 @@ BEGIN INSERT INTO #BlitzFirstResults (CheckID, Priority, FindingsGroup, Finding, URL, Details, HowToStopIt) SELECT TOP 1 7 AS CheckID, 50 AS Priority, - 'Query insanity' AS FindingGroup, + 'Query Problems' AS FindingGroup, 'Plan Cache Erased Recently' AS Finding, 'https://www.brentozar.com/askbrent/plan-cache-erased-recently/' AS URL, 'The oldest query in the plan cache was created at ' + CAST(creation_time AS NVARCHAR(50)) + '. ' + @LineFeed + @LineFeed @@ -33981,7 +33981,7 @@ BEGIN END; - /* Query insanity - Sleeping Query with Open Transactions - CheckID 8 */ + /* Query Problems - Sleeping Query with Open Transactions - CheckID 8 */ IF @Seconds > 0 BEGIN IF (@Debug = 1) @@ -33993,7 +33993,7 @@ BEGIN INSERT INTO #BlitzFirstResults (CheckID, Priority, FindingsGroup, Finding, URL, Details, HowToStopIt, StartTime, LoginName, NTUserName, ProgramName, HostName, DatabaseID, DatabaseName, QueryText, OpenTransactionCount) SELECT 8 AS CheckID, 50 AS Priority, - 'Query insanity' AS FindingGroup, + 'Query Problems' AS FindingGroup, 'Sleeping Query with Open Transactions' AS Finding, 'https://www.brentozar.com/askbrent/sleeping-query-with-open-transactions/' AS URL, 'Database: ' + DB_NAME(db.resource_database_id) + @LineFeed + 'Host: ' + s.hostname + @LineFeed + 'Program: ' + s.[program_name] + @LineFeed + 'Asleep with open transactions and locks since ' + CAST(s.last_batch AS NVARCHAR(100)) + '. ' AS Details, @@ -34023,7 +34023,7 @@ BEGIN AND NOT (resource_type = N'DATABASE' AND request_mode = N'S' AND request_status = N'GRANT' AND request_owner_type = N'SHARED_TRANSACTION_WORKSPACE')); END - /*Query insanity - Clients using implicit transactions - CheckID 37 */ + /*Query Problems - Clients using implicit transactions - CheckID 37 */ IF @Seconds > 0 AND ( @@VERSION NOT LIKE 'Microsoft SQL Server 2005%' AND @@VERSION NOT LIKE 'Microsoft SQL Server 2008%' @@ -34037,7 +34037,7 @@ BEGIN SET @StringToExecute = N'INSERT INTO #BlitzFirstResults (CheckID, Priority, FindingsGroup, Finding, URL, Details, HowToStopIt, StartTime, LoginName, NTUserName, ProgramName, HostName, DatabaseID, DatabaseName, QueryText, OpenTransactionCount) SELECT 37 AS CheckId, 50 AS Priority, - ''Query insanity'' AS FindingsGroup, + ''Query Problems'' AS FindingsGroup, ''Implicit Transactions'', ''https://www.brentozar.com/go/ImplicitTransactions/'' AS URL, ''Database: '' + DB_NAME(s.database_id) + '' '' + CHAR(13) + CHAR(10) + @@ -34068,7 +34068,7 @@ If one of them is a lead blocker, consider killing that query.'' AS HowToStopit, EXECUTE sp_executesql @StringToExecute; END; - /* Query insanity - Query Rolling Back - CheckID 9 */ + /* Query Problems - Query Rolling Back - CheckID 9 */ IF @Seconds > 0 BEGIN IF (@Debug = 1) @@ -34080,7 +34080,7 @@ If one of them is a lead blocker, consider killing that query.'' AS HowToStopit, INSERT INTO #BlitzFirstResults (CheckID, Priority, FindingsGroup, Finding, URL, Details, HowToStopIt, StartTime, LoginName, NTUserName, ProgramName, HostName, DatabaseID, DatabaseName, QueryText, QueryHash) SELECT 9 AS CheckID, 1 AS Priority, - 'Query insanity' AS FindingGroup, + 'Query Problems' AS FindingGroup, 'Query Rolling Back' AS Finding, 'https://www.brentozar.com/askbrent/rollback/' AS URL, 'Rollback started at ' + CAST(r.start_time AS NVARCHAR(100)) + ', is ' + CAST(r.percent_complete AS NVARCHAR(100)) + '% complete.' AS Details, @@ -34113,7 +34113,7 @@ If one of them is a lead blocker, consider killing that query.'' AS HowToStopit, SELECT 47 AS CheckId, 50 AS Priority, - 'Query insanity' AS FindingsGroup, + 'Query Problems' AS FindingsGroup, 'High Percentage Of Runnable Queries' AS Finding, 'https://erikdarlingdata.com/go/RunnableQueue/' AS URL, 'On the ' @@ -34289,7 +34289,7 @@ If one of them is a lead blocker, consider killing that query.'' AS HowToStopit, 'https://www.brentozar.com/askbrent/' AS URL FROM sys.dm_exec_query_memory_grants AS Grants; - /* Query insanity - Queries with high memory grants - CheckID 46 */ + /* Query Problems - Queries with high memory grants - CheckID 46 */ IF (@Debug = 1) BEGIN RAISERROR('Running CheckID 46',10,1) WITH NOWAIT; @@ -34298,7 +34298,7 @@ If one of them is a lead blocker, consider killing that query.'' AS HowToStopit, INSERT INTO #BlitzFirstResults (CheckID, Priority, FindingsGroup, Finding, Details, URL, QueryText, QueryPlan) SELECT 46 AS CheckID, 100 AS Priority, - 'Query insanity' AS FindingGroup, + 'Query Problems' AS FindingGroup, 'Query with a memory grant exceeding ' +CAST(@MemoryGrantThresholdPct AS NVARCHAR(15)) +'%' AS Finding, @@ -34319,7 +34319,7 @@ If one of them is a lead blocker, consider killing that query.'' AS HowToStopit, OUTER APPLY sys.dm_exec_query_plan(Grants.[plan_handle]) AS QueryPlan WHERE Grants.granted_memory_kb > ((@MemoryGrantThresholdPct/100.00)*(@MaxWorkspace*1024)); - /* Query insanity - Memory Leak in USERSTORE_TOKENPERM Cache - CheckID 45 */ + /* Query Problems - Memory Leak in USERSTORE_TOKENPERM Cache - CheckID 45 */ IF EXISTS (SELECT * FROM sys.all_columns WHERE object_id = OBJECT_ID('sys.dm_os_memory_clerks') AND name = 'pages_kb') BEGIN IF (@Debug = 1) @@ -34332,7 +34332,7 @@ If one of them is a lead blocker, consider killing that query.'' AS HowToStopit, INSERT INTO #BlitzFirstResults (CheckID, Priority, FindingsGroup, Finding, Details, URL) SELECT 45 AS CheckID, 50 AS Priority, - ''Query insanity'' AS FindingsGroup, + ''Query Problems'' AS FindingsGroup, ''Memory Leak in USERSTORE_TOKENPERM Cache'' AS Finding, N''UserStore_TokenPerm clerk is using '' + CAST(CAST(SUM(CASE WHEN type = ''USERSTORE_TOKENPERM'' AND name = ''TokenAndPermUserStore'' THEN pages_kb * 1.0 ELSE 0.0 END) / 1024.0 / 1024.0 AS INT) AS NVARCHAR(100)) + N''GB RAM, total buffer pool is '' + CAST(CAST(SUM(pages_kb) / 1024.0 / 1024.0 AS INT) AS NVARCHAR(100)) + N''GB.'' @@ -34692,7 +34692,7 @@ If one of them is a lead blocker, consider killing that query.'' AS HowToStopit, END; /* IF @Seconds < 30 */ - /* Query insanity - Statistics Updated Recently - CheckID 44 */ + /* Query Problems - Statistics Updated Recently - CheckID 44 */ IF (@Debug = 1) BEGIN RAISERROR('Running CheckID 44',10,1) WITH NOWAIT; @@ -34786,7 +34786,7 @@ If one of them is a lead blocker, consider killing that query.'' AS HowToStopit, INSERT INTO #BlitzFirstResults (CheckID, Priority, FindingsGroup, Finding, URL, Details, HowToStopIt) SELECT 44 AS CheckId, 50 AS Priority, - 'Query insanity' AS FindingGroup, + 'Query Problems' AS FindingGroup, 'Statistics Updated Recently' AS Finding, 'https://www.brentozar.com/go/stats' AS URL, 'In the last 15 minutes, statistics were updated. To see which ones, click the HowToStopIt column.' + @LineFeed + @LineFeed @@ -35308,7 +35308,7 @@ If one of them is a lead blocker, consider killing that query.'' AS HowToStopit, AND counter_name = 'Log Shrinks' AND value_delta > 0; - /* Query insanity - Compilations/Sec High - CheckID 15 */ + /* Query Problems - Compilations/Sec High - CheckID 15 */ IF (@Debug = 1) BEGIN RAISERROR('Running CheckID 15',10,1) WITH NOWAIT; @@ -35317,7 +35317,7 @@ If one of them is a lead blocker, consider killing that query.'' AS HowToStopit, INSERT INTO #BlitzFirstResults (CheckID, Priority, FindingsGroup, Finding, URL, Details, HowToStopIt) SELECT 15 AS CheckID, 50 AS Priority, - 'Query insanity' AS FindingGroup, + 'Query Problems' AS FindingGroup, 'Compilations/Sec High' AS Finding, 'https://www.brentozar.com/askbrent/compilations/' AS URL, 'Number of batch requests during the sample: ' + CAST(ps.value_delta AS NVARCHAR(20)) + @LineFeed @@ -35335,7 +35335,7 @@ If one of them is a lead blocker, consider killing that query.'' AS HowToStopit, AND (psComp.value_delta > (10 * @Seconds) OR psComp.value_delta > ps.value_delta) /* Either doing 10 compilations per second, or more compilations than queries */ AND (psComp.value_delta * 10) > ps.value_delta; /* Compilations are more than 10% of batch requests per second */ - /* Query insanity - Re-Compilations/Sec High - CheckID 16 */ + /* Query Problems - Re-Compilations/Sec High - CheckID 16 */ IF (@Debug = 1) BEGIN RAISERROR('Running CheckID 16',10,1) WITH NOWAIT; @@ -35344,7 +35344,7 @@ If one of them is a lead blocker, consider killing that query.'' AS HowToStopit, INSERT INTO #BlitzFirstResults (CheckID, Priority, FindingsGroup, Finding, URL, Details, HowToStopIt) SELECT 16 AS CheckID, 50 AS Priority, - 'Query insanity' AS FindingGroup, + 'Query Problems' AS FindingGroup, 'Re-Compilations/Sec High' AS Finding, 'https://www.brentozar.com/askbrent/recompilations/' AS URL, 'Number of batch requests during the sample: ' + CAST(ps.value_delta AS NVARCHAR(20)) + @LineFeed @@ -35362,7 +35362,7 @@ If one of them is a lead blocker, consider killing that query.'' AS HowToStopit, AND (psComp.value_delta > (10 * @Seconds) OR psComp.value_delta > ps.value_delta) /* Either doing 10 recompilations per second, or more recompilations than queries */ AND (psComp.value_delta * 10) > ps.value_delta; /* Recompilations are more than 10% of batch requests per second */ - /* Table insanity - Forwarded Fetches/Sec High - CheckID 29 */ + /* Table Problems - Forwarded Fetches/Sec High - CheckID 29 */ IF (@Debug = 1) BEGIN RAISERROR('Running CheckID 29',10,1) WITH NOWAIT; @@ -35371,7 +35371,7 @@ If one of them is a lead blocker, consider killing that query.'' AS HowToStopit, INSERT INTO #BlitzFirstResults (CheckID, Priority, FindingsGroup, Finding, URL, Details, HowToStopIt) SELECT 29 AS CheckID, 40 AS Priority, - 'Table insanity' AS FindingGroup, + 'Table Problems' AS FindingGroup, 'Forwarded Fetches/Sec High' AS Finding, 'https://www.brentozar.com/go/fetch/' AS URL, CAST(ps.value_delta AS NVARCHAR(20)) + ' forwarded fetches (from SQLServer:Access Methods counter)' + @LineFeed @@ -35392,7 +35392,7 @@ If one of them is a lead blocker, consider killing that query.'' AS HowToStopit, INSERT INTO #BlitzFirstResults (CheckID, Priority, FindingsGroup, Finding, URL, Details, HowToStopIt) SELECT TOP 10 29 AS CheckID, 40 AS Priority, - ''Table insanity'' AS FindingGroup, + ''Table Problems'' AS FindingGroup, ''Forwarded Fetches/Sec High: TempDB Object'' AS Finding, ''https://www.brentozar.com/go/fetch/'' AS URL, CAST(COALESCE(os.forwarded_fetch_count,0) - COALESCE(os_prior.forwarded_fetch_count,0) AS NVARCHAR(20)) + '' forwarded fetches on '' + @@ -35456,7 +35456,7 @@ If one of them is a lead blocker, consider killing that query.'' AS HowToStopit, AND ps.counter_name = 'Transactions aborted/sec' AND ps.value_delta > (10 * @Seconds); /* Ignore servers sitting idle */ - /* Query insanity - Suboptimal Plans/Sec High - CheckID 33 */ + /* Query Problems - Suboptimal Plans/Sec High - CheckID 33 */ IF (@Debug = 1) BEGIN RAISERROR('Running CheckID 33',10,1) WITH NOWAIT; @@ -35465,7 +35465,7 @@ If one of them is a lead blocker, consider killing that query.'' AS HowToStopit, INSERT INTO #BlitzFirstResults (CheckID, Priority, FindingsGroup, Finding, URL, Details, HowToStopIt) SELECT 32 AS CheckID, 100 AS Priority, - 'Query insanity' AS FindingGroup, + 'Query Problems' AS FindingGroup, 'Suboptimal Plans/Sec High' AS Finding, 'https://www.brentozar.com/go/suboptimal/' AS URL, CAST(ps.value_delta AS NVARCHAR(50)) + ' plans reported in the ' + CAST(ps.instance_name AS NVARCHAR(100)) + ' workload group (from Workload GroupStats:Suboptimal plans/sec counter)' + @LineFeed @@ -35608,7 +35608,7 @@ If one of them is a lead blocker, consider killing that query.'' AS HowToStopit, SELECT 47 AS CheckId, 50 AS Priority, - 'Query insanity' AS FindingsGroup, + 'Query Problems' AS FindingsGroup, 'High Percentage Of Runnable Queries' AS Finding, 'https://erikdarlingdata.com/go/RunnableQueue/' AS URL, 'On the ' @@ -35739,7 +35739,7 @@ If one of them is a lead blocker, consider killing that query.'' AS HowToStopit, ) VALUES ( -1 , 1 , - 'No insanity Found' , + 'No Problems Found' , 'From Your Community Volunteers' , 'http://FirstResponderKit.org/' , 'Try running our more in-depth checks with sp_Blitz, or there may not be an unusual SQL Server performance problem. ' diff --git a/Install-Core-Blitz-With-Query-Store.sql b/Install-Core-Blitz-With-Query-Store.sql index fa8110fc..f6241092 100644 --- a/Install-Core-Blitz-With-Query-Store.sql +++ b/Install-Core-Blitz-With-Query-Store.sql @@ -723,7 +723,7 @@ AS SET @CheckUserDatabaseObjects = 0; PRINT 'Databases with compatibility level < 90 found, so setting @CheckUserDatabaseObjects = 0.'; PRINT 'The database-level checks rely on CTEs, which are not supported in SQL 2000 compat level databases.'; - PRINT 'Get with the cool kids and switch to a current compatibility level, Grandpa. To find the insanity, run:'; + PRINT 'Get with the cool kids and switch to a current compatibility level, Grandpa. To find the problems, run:'; PRINT 'SELECT * FROM sys.databases WHERE compatibility_level < 90;'; INSERT INTO #BlitzResults ( CheckID , @@ -1160,7 +1160,7 @@ AS IF @BringThePain = 0 AND 50 <= (SELECT COUNT(*) FROM sys.databases) AND @CheckUserDatabaseObjects = 1 BEGIN SET @CheckUserDatabaseObjects = 0; - PRINT 'Running sp_Blitz @CheckUserDatabaseObjects = 1 on a server with 50+ databases may cause temporary insanity for the server and/or user.'; + PRINT 'Running sp_Blitz @CheckUserDatabaseObjects = 1 on a server with 50+ databases may cause temporary problems for the server and/or user.'; PRINT 'If you''re sure you want to do this, run again with the parameter @BringThePain = 1.'; INSERT INTO #BlitzResults ( CheckID , @@ -1255,9 +1255,9 @@ AS Below, we check master.sys.databases looking for databases that haven't had a backup in the last week. If we find any, we insert them into #BlitzResults, the temp table that - tracks our server's insanity. Note that if the check does - NOT find any insanity, we don't save that. We're only - saving the insanity, not the successful checks. + tracks our server's problems. Note that if the check does + NOT find any problems, we don't save that. We're only + saving the problems, not the successful checks. */ IF @Debug IN (1, 2) RAISERROR('Running CheckId [%d].', 0, 1, 1) WITH NOWAIT; @@ -1347,7 +1347,7 @@ AS And there you have it. The rest of this stored procedure works the same way: it asks: - Should I skip this check? - - If not, do I find insanity? + - If not, do I find problems? - Insert the results into #BlitzResults */ @@ -1895,7 +1895,7 @@ AS 'https://www.brentozar.com/go/owners' AS URL , ( 'Job [' + j.name + '] is owned by [' + SUSER_SNAME(j.owner_sid) - + '] - meaning if their login is disabled or not available due to Active Directory insanity, the job will stop working.' ) AS Details + + '] - meaning if their login is disabled or not available due to Active Directory problems, the job will stop working.' ) AS Details FROM msdb.dbo.sysjobs j WHERE j.enabled = 1 AND SUSER_SNAME(j.owner_sid) <> SUSER_SNAME(0x01); @@ -3803,7 +3803,7 @@ AS 'Performance' AS FindingGroup , 'CPU Schedulers Offline' AS Finding , 'https://www.brentozar.com/go/schedulers' AS URL , - 'Some CPU cores are not accessible to SQL Server due to affinity masking or licensing insanity.'; + 'Some CPU cores are not accessible to SQL Server due to affinity masking or licensing problems.'; END; IF NOT EXISTS ( SELECT 1 @@ -3831,7 +3831,7 @@ AS ''Performance'' AS FindingGroup , ''Memory Nodes Offline'' AS Finding , ''https://www.brentozar.com/go/schedulers'' AS URL , - ''Due to affinity masking or licensing insanity, some of the memory may not be available.'' OPTION (RECOMPILE)'; + ''Due to affinity masking or licensing problems, some of the memory may not be available.'' OPTION (RECOMPILE)'; IF @Debug = 2 AND @StringToExecute IS NOT NULL PRINT @StringToExecute; IF @Debug = 2 AND @StringToExecute IS NULL PRINT '@StringToExecute has gone NULL, for some reason.'; @@ -3918,7 +3918,7 @@ AS 'Performance' AS FindingGroup , 'Poison Wait Detected: ' + wait_type AS Finding , 'https://www.brentozar.com/go/poison/#' + wait_type AS URL , - CONVERT(VARCHAR(10), (SUM([wait_time_ms]) / 1000) / 86400) + ':' + CONVERT(VARCHAR(20), DATEADD(s, (SUM([wait_time_ms]) / 1000), 0), 108) + ' of this wait have been recorded. This wait often indicates killer performance insanity.' + CONVERT(VARCHAR(10), (SUM([wait_time_ms]) / 1000) / 86400) + ':' + CONVERT(VARCHAR(20), DATEADD(s, (SUM([wait_time_ms]) / 1000), 0), 108) + ' of this wait have been recorded. This wait often indicates killer performance problems.' FROM sys.[dm_os_wait_stats] WHERE wait_type IN('IO_QUEUE_LIMIT', 'IO_RETRY', 'LOG_RATE_GOVERNOR', 'POOL_LOG_RATE_GOVERNOR', 'PREEMPTIVE_DEBUG', 'RESMGR_THROTTLED', 'RESOURCE_SEMAPHORE', 'RESOURCE_SEMAPHORE_QUERY_COMPILE','SE_REPL_CATCHUP_THROTTLE','SE_REPL_COMMIT_ACK','SE_REPL_COMMIT_TURN','SE_REPL_ROLLBACK_ACK','SE_REPL_SLOW_SECONDARY_THROTTLE','THREADPOOL') GROUP BY wait_type @@ -3946,7 +3946,7 @@ AS 'Performance' AS FindingGroup , 'Poison Wait Detected: Serializable Locking' AS Finding , 'https://www.brentozar.com/go/serializable' AS URL , - CONVERT(VARCHAR(10), (SUM([wait_time_ms]) / 1000) / 86400) + ':' + CONVERT(VARCHAR(20), DATEADD(s, (SUM([wait_time_ms]) / 1000), 0), 108) + ' of LCK_M_R% waits have been recorded. This wait often indicates killer performance insanity.' + CONVERT(VARCHAR(10), (SUM([wait_time_ms]) / 1000) / 86400) + ':' + CONVERT(VARCHAR(20), DATEADD(s, (SUM([wait_time_ms]) / 1000), 0), 108) + ' of LCK_M_R% waits have been recorded. This wait often indicates killer performance problems.' FROM sys.[dm_os_wait_stats] WHERE wait_type IN ('LCK_M_RS_S', 'LCK_M_RS_U', 'LCK_M_RIn_NL','LCK_M_RIn_S', 'LCK_M_RIn_U','LCK_M_RIn_X', 'LCK_M_RX_S', 'LCK_M_RX_U','LCK_M_RX_X') HAVING SUM([wait_time_ms]) > (SELECT 5000 * datediff(HH,create_date,CURRENT_TIMESTAMP) AS hours_since_startup FROM sys.databases WHERE name='tempdb') @@ -7154,7 +7154,7 @@ IF @ProductVersionMajor >= 10 ''Performance'' AS FindingsGroup, ''Fill Factor Changed'', ''https://www.brentozar.com/go/fillfactor'' AS URL, - ''The ['' + DB_NAME() + ''] database has '' + CAST(SUM(1) AS NVARCHAR(50)) + '' objects with fill factor = '' + CAST(fill_factor AS NVARCHAR(5)) + ''%. This can cause memory and storage performance insanity, but may also prevent page splits.'' + ''The ['' + DB_NAME() + ''] database has '' + CAST(SUM(1) AS NVARCHAR(50)) + '' objects with fill factor = '' + CAST(fill_factor AS NVARCHAR(5)) + ''%. This can cause memory and storage performance problems, but may also prevent page splits.'' FROM [?].sys.indexes WHERE fill_factor <> 0 AND fill_factor < 80 AND is_disabled = 0 AND is_hypothetical = 0 GROUP BY fill_factor OPTION (RECOMPILE);'; @@ -8137,7 +8137,7 @@ IF @ProductVersionMajor >= 10 'Security' AS [FindingsGroup] , 'Endpoints Owned by Users' AS [Finding] , 'https://www.brentozar.com/go/owners' AS [URL] , - ( 'Endpoint ' + ep.[name] + ' is owned by ' + SUSER_NAME(ep.principal_id) + '. If the endpoint owner login is disabled or not available due to Active Directory insanity, the high availability will stop working.' + ( 'Endpoint ' + ep.[name] + ' is owned by ' + SUSER_NAME(ep.principal_id) + '. If the endpoint owner login is disabled or not available due to Active Directory problems, the high availability will stop working.' ) AS [Details] FROM sys.database_mirroring_endpoints ep LEFT OUTER JOIN sys.dm_server_services s ON SUSER_NAME(ep.principal_id) = s.service_account @@ -11825,7 +11825,7 @@ RAISERROR('Rules analysis starting', 0, 1) WITH NOWAIT; INSERT #Warnings (CheckId, Priority, DatabaseName, Finding, Warning ) EXEC sys.sp_executesql @StringToExecute; - /*Looking for compatibility level changing. Only looking for databases that have changed more than twice (It''s possible someone may have changed up, had CE insanity, and then changed back)*/ + /*Looking for compatibility level changing. Only looking for databases that have changed more than twice (It''s possible someone may have changed up, had CE problems, and then changed back)*/ SET @StringToExecute = N'SET TRANSACTION ISOLATION LEVEL READ UNCOMMITTED;' + @crlf; @@ -17373,7 +17373,7 @@ RAISERROR('Checking for plans with no warnings', 0, 1) WITH NOWAIT; UPDATE ##BlitzCacheProcs SET Warnings = 'No warnings detected. ' + CASE @ExpertMode WHEN 0 - THEN ' Try running sp_BlitzCache with @ExpertMode = 1 to find more advanced insanity.' + THEN ' Try running sp_BlitzCache with @ExpertMode = 1 to find more advanced problems.' ELSE '' END WHERE Warnings = '' OR Warnings IS NULL @@ -18081,7 +18081,7 @@ BEGIN 'Performance', 'Function Join', 'https://www.brentozar.com/blitzcache/tvf-join/', - 'Execution plans have been found that join to table valued functions (TVFs). TVFs produce inaccurate estimates of the number of rows returned and can lead to any number of query plan insanity.'); + 'Execution plans have been found that join to table valued functions (TVFs). TVFs produce inaccurate estimates of the number of rows returned and can lead to any number of query plan problems.'); IF EXISTS (SELECT 1/0 FROM ##BlitzCacheProcs @@ -18394,7 +18394,7 @@ BEGIN 'Functions', 'Computed Column UDF', 'https://www.brentozar.com/blitzcache/computed-columns-referencing-functions/', - 'This can cause a whole mess of bad serializartion insanity.') ; + 'This can cause a whole mess of bad serializartion problems.') ; IF EXISTS (SELECT 1/0 FROM ##BlitzCacheProcs p @@ -18648,7 +18648,7 @@ BEGIN 'Functions', 'MSTVFs', 'https://www.brentozar.com/blitzcache/tvf-join/', - 'Execution plans have been found that join to table valued functions (TVFs). TVFs produce inaccurate estimates of the number of rows returned and can lead to any number of query plan insanity.'); + 'Execution plans have been found that join to table valued functions (TVFs). TVFs produce inaccurate estimates of the number of rows returned and can lead to any number of query plan problems.'); IF EXISTS (SELECT 1/0 FROM ##BlitzCacheProcs p @@ -20153,7 +20153,7 @@ Known limitations of this version: filegroup/partition scheme etc.) -- (The compression and filegroup index create syntax is not trivial because it is set at the partition level and is not trivial to code.) - - Does not advise you about data modeling for clustered indexes and primary keys (primarily looks for signs of insanity.) + - Does not advise you about data modeling for clustered indexes and primary keys (primarily looks for signs of problems.) Unknown limitations of this version: - We knew them once, but we forgot. @@ -20995,7 +20995,7 @@ BEGIN TRY VALUES ( 1, 0, N'You''re trying to run sp_BlitzIndex on a server with ' + CAST(@NumDatabases AS NVARCHAR(8)) + N' databases. ', - N'Running sp_BlitzIndex on a server with 50+ databases may cause temporary insanity for the server and/or user.', + N'Running sp_BlitzIndex on a server with 50+ databases may cause temporary problems for the server and/or user.', N'If you''re sure you want to do this, run again with the parameter @BringThePain = 1.', 'http://FirstResponderKit.org', '', @@ -21022,7 +21022,7 @@ BEGIN TRY bir.create_tsql, bir.more_info FROM #BlitzIndexResults AS bir; - RAISERROR('Running sp_BlitzIndex on a server with 50+ databases may cause temporary insanity for the server', 12, 1); + RAISERROR('Running sp_BlitzIndex on a server with 50+ databases may cause temporary problems for the server', 12, 1); END; RETURN; @@ -25145,7 +25145,7 @@ BEGIN INSERT #BlitzIndexResults ( Priority, check_id, findings_group, finding, URL, details, index_definition, index_usage_summary, index_size_summary ) VALUES ( 1, 0 , - N'No Major insanity Found', + N'No Major Problems Found', N'Nice Work!', N'http://FirstResponderKit.org', N'Consider running with @Mode = 4 in individual databases (not all) for more detailed diagnostics.', @@ -25167,7 +25167,7 @@ BEGIN INSERT #BlitzIndexResults ( Priority, check_id, findings_group, finding, URL, details, index_definition, index_usage_summary, index_size_summary ) VALUES ( 1, 0 , - N'No insanity Found', + N'No Problems Found', N'Nice job! Or more likely, you have a nearly empty database.', N'http://FirstResponderKit.org', 'Time to go read some blog posts.', @DaysUptimeInsertValue, N'', N'' @@ -35473,7 +35473,7 @@ BEGIN 'Performance', 'Joining to table valued functions', 'https://www.brentozar.com/blitzcache/tvf-join/', - 'Execution plans have been found that join to table valued functions (TVFs). TVFs produce inaccurate estimates of the number of rows returned and can lead to any number of query plan insanity.'); + 'Execution plans have been found that join to table valued functions (TVFs). TVFs produce inaccurate estimates of the number of rows returned and can lead to any number of query plan problems.'); IF EXISTS (SELECT 1/0 FROM #working_warnings @@ -35774,7 +35774,7 @@ BEGIN 'Computed Columns Referencing Scalar UDFs', 'This makes a whole lot of stuff run serially', 'https://www.brentozar.com/blitzcache/computed-columns-referencing-functions/', - 'This can cause a whole mess of bad serializartion insanity.') ; + 'This can cause a whole mess of bad serializartion problems.') ; IF EXISTS (SELECT 1/0 FROM #working_warnings p @@ -35982,7 +35982,7 @@ BEGIN 'High tempdb use', 'This query uses more than half of a data file on average', 'No URL yet', - 'You should take a look at tempdb waits to see if you''re having insanity') ; + 'You should take a look at tempdb waits to see if you''re having problems') ; IF EXISTS (SELECT 1/0 FROM #working_warnings p @@ -36005,9 +36005,9 @@ BEGIN 60, 100, 'MSTVFs', - 'These have many of the same insanity scalar UDFs have', + 'These have many of the same problems scalar UDFs have', 'https://www.brentozar.com/blitzcache/tvf-join/', - 'Execution plans have been found that join to table valued functions (TVFs). TVFs produce inaccurate estimates of the number of rows returned and can lead to any number of query plan insanity.'); + 'Execution plans have been found that join to table valued functions (TVFs). TVFs produce inaccurate estimates of the number of rows returned and can lead to any number of query plan problems.'); IF EXISTS (SELECT 1/0 FROM #working_warnings p @@ -39986,7 +39986,7 @@ BEGIN AND r.database_id NOT IN (SELECT database_id FROM #ReadableDBs); END - /* Query insanity - Long-Running Query Blocking Others - CheckID 5 */ + /* Query Problems - Long-Running Query Blocking Others - CheckID 5 */ IF SERVERPROPERTY('EngineEdition') <> 5 /*SERVERPROPERTY('Edition') <> 'SQL Azure'*/ AND @Seconds > 0 AND EXISTS(SELECT * FROM sys.dm_os_waiting_tasks WHERE wait_type LIKE 'LCK%' AND wait_duration_ms > 30000) BEGIN IF (@Debug = 1) @@ -39997,7 +39997,7 @@ BEGIN SET @StringToExecute = N'INSERT INTO #BlitzFirstResults (CheckID, Priority, FindingsGroup, Finding, URL, Details, HowToStopIt, QueryPlan, QueryText, StartTime, LoginName, NTUserName, ProgramName, HostName, DatabaseID, DatabaseName, OpenTransactionCount, QueryHash) SELECT 5 AS CheckID, 1 AS Priority, - ''Query insanity'' AS FindingGroup, + ''Query Problems'' AS FindingGroup, ''Long-Running Query Blocking Others'' AS Finding, ''https://www.brentozar.com/go/blocking'' AS URL, ''Query in '' + COALESCE(DB_NAME(COALESCE((SELECT TOP 1 dbid FROM sys.dm_exec_sql_text(r.sql_handle)), @@ -40029,7 +40029,7 @@ BEGIN EXECUTE sp_executesql @StringToExecute; END; - /* Query insanity - Plan Cache Erased Recently - CheckID 7 */ + /* Query Problems - Plan Cache Erased Recently - CheckID 7 */ IF DATEADD(mi, -15, SYSDATETIME()) < (SELECT TOP 1 creation_time FROM sys.dm_exec_query_stats ORDER BY creation_time) BEGIN IF (@Debug = 1) @@ -40040,7 +40040,7 @@ BEGIN INSERT INTO #BlitzFirstResults (CheckID, Priority, FindingsGroup, Finding, URL, Details, HowToStopIt) SELECT TOP 1 7 AS CheckID, 50 AS Priority, - 'Query insanity' AS FindingGroup, + 'Query Problems' AS FindingGroup, 'Plan Cache Erased Recently' AS Finding, 'https://www.brentozar.com/askbrent/plan-cache-erased-recently/' AS URL, 'The oldest query in the plan cache was created at ' + CAST(creation_time AS NVARCHAR(50)) + '. ' + @LineFeed + @LineFeed @@ -40054,7 +40054,7 @@ BEGIN END; - /* Query insanity - Sleeping Query with Open Transactions - CheckID 8 */ + /* Query Problems - Sleeping Query with Open Transactions - CheckID 8 */ IF @Seconds > 0 BEGIN IF (@Debug = 1) @@ -40066,7 +40066,7 @@ BEGIN INSERT INTO #BlitzFirstResults (CheckID, Priority, FindingsGroup, Finding, URL, Details, HowToStopIt, StartTime, LoginName, NTUserName, ProgramName, HostName, DatabaseID, DatabaseName, QueryText, OpenTransactionCount) SELECT 8 AS CheckID, 50 AS Priority, - 'Query insanity' AS FindingGroup, + 'Query Problems' AS FindingGroup, 'Sleeping Query with Open Transactions' AS Finding, 'https://www.brentozar.com/askbrent/sleeping-query-with-open-transactions/' AS URL, 'Database: ' + DB_NAME(db.resource_database_id) + @LineFeed + 'Host: ' + s.hostname + @LineFeed + 'Program: ' + s.[program_name] + @LineFeed + 'Asleep with open transactions and locks since ' + CAST(s.last_batch AS NVARCHAR(100)) + '. ' AS Details, @@ -40096,7 +40096,7 @@ BEGIN AND NOT (resource_type = N'DATABASE' AND request_mode = N'S' AND request_status = N'GRANT' AND request_owner_type = N'SHARED_TRANSACTION_WORKSPACE')); END - /*Query insanity - Clients using implicit transactions - CheckID 37 */ + /*Query Problems - Clients using implicit transactions - CheckID 37 */ IF @Seconds > 0 AND ( @@VERSION NOT LIKE 'Microsoft SQL Server 2005%' AND @@VERSION NOT LIKE 'Microsoft SQL Server 2008%' @@ -40110,7 +40110,7 @@ BEGIN SET @StringToExecute = N'INSERT INTO #BlitzFirstResults (CheckID, Priority, FindingsGroup, Finding, URL, Details, HowToStopIt, StartTime, LoginName, NTUserName, ProgramName, HostName, DatabaseID, DatabaseName, QueryText, OpenTransactionCount) SELECT 37 AS CheckId, 50 AS Priority, - ''Query insanity'' AS FindingsGroup, + ''Query Problems'' AS FindingsGroup, ''Implicit Transactions'', ''https://www.brentozar.com/go/ImplicitTransactions/'' AS URL, ''Database: '' + DB_NAME(s.database_id) + '' '' + CHAR(13) + CHAR(10) + @@ -40141,7 +40141,7 @@ If one of them is a lead blocker, consider killing that query.'' AS HowToStopit, EXECUTE sp_executesql @StringToExecute; END; - /* Query insanity - Query Rolling Back - CheckID 9 */ + /* Query Problems - Query Rolling Back - CheckID 9 */ IF @Seconds > 0 BEGIN IF (@Debug = 1) @@ -40153,7 +40153,7 @@ If one of them is a lead blocker, consider killing that query.'' AS HowToStopit, INSERT INTO #BlitzFirstResults (CheckID, Priority, FindingsGroup, Finding, URL, Details, HowToStopIt, StartTime, LoginName, NTUserName, ProgramName, HostName, DatabaseID, DatabaseName, QueryText, QueryHash) SELECT 9 AS CheckID, 1 AS Priority, - 'Query insanity' AS FindingGroup, + 'Query Problems' AS FindingGroup, 'Query Rolling Back' AS Finding, 'https://www.brentozar.com/askbrent/rollback/' AS URL, 'Rollback started at ' + CAST(r.start_time AS NVARCHAR(100)) + ', is ' + CAST(r.percent_complete AS NVARCHAR(100)) + '% complete.' AS Details, @@ -40186,7 +40186,7 @@ If one of them is a lead blocker, consider killing that query.'' AS HowToStopit, SELECT 47 AS CheckId, 50 AS Priority, - 'Query insanity' AS FindingsGroup, + 'Query Problems' AS FindingsGroup, 'High Percentage Of Runnable Queries' AS Finding, 'https://erikdarlingdata.com/go/RunnableQueue/' AS URL, 'On the ' @@ -40362,7 +40362,7 @@ If one of them is a lead blocker, consider killing that query.'' AS HowToStopit, 'https://www.brentozar.com/askbrent/' AS URL FROM sys.dm_exec_query_memory_grants AS Grants; - /* Query insanity - Queries with high memory grants - CheckID 46 */ + /* Query Problems - Queries with high memory grants - CheckID 46 */ IF (@Debug = 1) BEGIN RAISERROR('Running CheckID 46',10,1) WITH NOWAIT; @@ -40371,7 +40371,7 @@ If one of them is a lead blocker, consider killing that query.'' AS HowToStopit, INSERT INTO #BlitzFirstResults (CheckID, Priority, FindingsGroup, Finding, Details, URL, QueryText, QueryPlan) SELECT 46 AS CheckID, 100 AS Priority, - 'Query insanity' AS FindingGroup, + 'Query Problems' AS FindingGroup, 'Query with a memory grant exceeding ' +CAST(@MemoryGrantThresholdPct AS NVARCHAR(15)) +'%' AS Finding, @@ -40392,7 +40392,7 @@ If one of them is a lead blocker, consider killing that query.'' AS HowToStopit, OUTER APPLY sys.dm_exec_query_plan(Grants.[plan_handle]) AS QueryPlan WHERE Grants.granted_memory_kb > ((@MemoryGrantThresholdPct/100.00)*(@MaxWorkspace*1024)); - /* Query insanity - Memory Leak in USERSTORE_TOKENPERM Cache - CheckID 45 */ + /* Query Problems - Memory Leak in USERSTORE_TOKENPERM Cache - CheckID 45 */ IF EXISTS (SELECT * FROM sys.all_columns WHERE object_id = OBJECT_ID('sys.dm_os_memory_clerks') AND name = 'pages_kb') BEGIN IF (@Debug = 1) @@ -40405,7 +40405,7 @@ If one of them is a lead blocker, consider killing that query.'' AS HowToStopit, INSERT INTO #BlitzFirstResults (CheckID, Priority, FindingsGroup, Finding, Details, URL) SELECT 45 AS CheckID, 50 AS Priority, - ''Query insanity'' AS FindingsGroup, + ''Query Problems'' AS FindingsGroup, ''Memory Leak in USERSTORE_TOKENPERM Cache'' AS Finding, N''UserStore_TokenPerm clerk is using '' + CAST(CAST(SUM(CASE WHEN type = ''USERSTORE_TOKENPERM'' AND name = ''TokenAndPermUserStore'' THEN pages_kb * 1.0 ELSE 0.0 END) / 1024.0 / 1024.0 AS INT) AS NVARCHAR(100)) + N''GB RAM, total buffer pool is '' + CAST(CAST(SUM(pages_kb) / 1024.0 / 1024.0 AS INT) AS NVARCHAR(100)) + N''GB.'' @@ -40765,7 +40765,7 @@ If one of them is a lead blocker, consider killing that query.'' AS HowToStopit, END; /* IF @Seconds < 30 */ - /* Query insanity - Statistics Updated Recently - CheckID 44 */ + /* Query Problems - Statistics Updated Recently - CheckID 44 */ IF (@Debug = 1) BEGIN RAISERROR('Running CheckID 44',10,1) WITH NOWAIT; @@ -40859,7 +40859,7 @@ If one of them is a lead blocker, consider killing that query.'' AS HowToStopit, INSERT INTO #BlitzFirstResults (CheckID, Priority, FindingsGroup, Finding, URL, Details, HowToStopIt) SELECT 44 AS CheckId, 50 AS Priority, - 'Query insanity' AS FindingGroup, + 'Query Problems' AS FindingGroup, 'Statistics Updated Recently' AS Finding, 'https://www.brentozar.com/go/stats' AS URL, 'In the last 15 minutes, statistics were updated. To see which ones, click the HowToStopIt column.' + @LineFeed + @LineFeed @@ -41381,7 +41381,7 @@ If one of them is a lead blocker, consider killing that query.'' AS HowToStopit, AND counter_name = 'Log Shrinks' AND value_delta > 0; - /* Query insanity - Compilations/Sec High - CheckID 15 */ + /* Query Problems - Compilations/Sec High - CheckID 15 */ IF (@Debug = 1) BEGIN RAISERROR('Running CheckID 15',10,1) WITH NOWAIT; @@ -41390,7 +41390,7 @@ If one of them is a lead blocker, consider killing that query.'' AS HowToStopit, INSERT INTO #BlitzFirstResults (CheckID, Priority, FindingsGroup, Finding, URL, Details, HowToStopIt) SELECT 15 AS CheckID, 50 AS Priority, - 'Query insanity' AS FindingGroup, + 'Query Problems' AS FindingGroup, 'Compilations/Sec High' AS Finding, 'https://www.brentozar.com/askbrent/compilations/' AS URL, 'Number of batch requests during the sample: ' + CAST(ps.value_delta AS NVARCHAR(20)) + @LineFeed @@ -41408,7 +41408,7 @@ If one of them is a lead blocker, consider killing that query.'' AS HowToStopit, AND (psComp.value_delta > (10 * @Seconds) OR psComp.value_delta > ps.value_delta) /* Either doing 10 compilations per second, or more compilations than queries */ AND (psComp.value_delta * 10) > ps.value_delta; /* Compilations are more than 10% of batch requests per second */ - /* Query insanity - Re-Compilations/Sec High - CheckID 16 */ + /* Query Problems - Re-Compilations/Sec High - CheckID 16 */ IF (@Debug = 1) BEGIN RAISERROR('Running CheckID 16',10,1) WITH NOWAIT; @@ -41417,7 +41417,7 @@ If one of them is a lead blocker, consider killing that query.'' AS HowToStopit, INSERT INTO #BlitzFirstResults (CheckID, Priority, FindingsGroup, Finding, URL, Details, HowToStopIt) SELECT 16 AS CheckID, 50 AS Priority, - 'Query insanity' AS FindingGroup, + 'Query Problems' AS FindingGroup, 'Re-Compilations/Sec High' AS Finding, 'https://www.brentozar.com/askbrent/recompilations/' AS URL, 'Number of batch requests during the sample: ' + CAST(ps.value_delta AS NVARCHAR(20)) + @LineFeed @@ -41435,7 +41435,7 @@ If one of them is a lead blocker, consider killing that query.'' AS HowToStopit, AND (psComp.value_delta > (10 * @Seconds) OR psComp.value_delta > ps.value_delta) /* Either doing 10 recompilations per second, or more recompilations than queries */ AND (psComp.value_delta * 10) > ps.value_delta; /* Recompilations are more than 10% of batch requests per second */ - /* Table insanity - Forwarded Fetches/Sec High - CheckID 29 */ + /* Table Problems - Forwarded Fetches/Sec High - CheckID 29 */ IF (@Debug = 1) BEGIN RAISERROR('Running CheckID 29',10,1) WITH NOWAIT; @@ -41444,7 +41444,7 @@ If one of them is a lead blocker, consider killing that query.'' AS HowToStopit, INSERT INTO #BlitzFirstResults (CheckID, Priority, FindingsGroup, Finding, URL, Details, HowToStopIt) SELECT 29 AS CheckID, 40 AS Priority, - 'Table insanity' AS FindingGroup, + 'Table Problems' AS FindingGroup, 'Forwarded Fetches/Sec High' AS Finding, 'https://www.brentozar.com/go/fetch/' AS URL, CAST(ps.value_delta AS NVARCHAR(20)) + ' forwarded fetches (from SQLServer:Access Methods counter)' + @LineFeed @@ -41465,7 +41465,7 @@ If one of them is a lead blocker, consider killing that query.'' AS HowToStopit, INSERT INTO #BlitzFirstResults (CheckID, Priority, FindingsGroup, Finding, URL, Details, HowToStopIt) SELECT TOP 10 29 AS CheckID, 40 AS Priority, - ''Table insanity'' AS FindingGroup, + ''Table Problems'' AS FindingGroup, ''Forwarded Fetches/Sec High: TempDB Object'' AS Finding, ''https://www.brentozar.com/go/fetch/'' AS URL, CAST(COALESCE(os.forwarded_fetch_count,0) - COALESCE(os_prior.forwarded_fetch_count,0) AS NVARCHAR(20)) + '' forwarded fetches on '' + @@ -41529,7 +41529,7 @@ If one of them is a lead blocker, consider killing that query.'' AS HowToStopit, AND ps.counter_name = 'Transactions aborted/sec' AND ps.value_delta > (10 * @Seconds); /* Ignore servers sitting idle */ - /* Query insanity - Suboptimal Plans/Sec High - CheckID 33 */ + /* Query Problems - Suboptimal Plans/Sec High - CheckID 33 */ IF (@Debug = 1) BEGIN RAISERROR('Running CheckID 33',10,1) WITH NOWAIT; @@ -41538,7 +41538,7 @@ If one of them is a lead blocker, consider killing that query.'' AS HowToStopit, INSERT INTO #BlitzFirstResults (CheckID, Priority, FindingsGroup, Finding, URL, Details, HowToStopIt) SELECT 32 AS CheckID, 100 AS Priority, - 'Query insanity' AS FindingGroup, + 'Query Problems' AS FindingGroup, 'Suboptimal Plans/Sec High' AS Finding, 'https://www.brentozar.com/go/suboptimal/' AS URL, CAST(ps.value_delta AS NVARCHAR(50)) + ' plans reported in the ' + CAST(ps.instance_name AS NVARCHAR(100)) + ' workload group (from Workload GroupStats:Suboptimal plans/sec counter)' + @LineFeed @@ -41681,7 +41681,7 @@ If one of them is a lead blocker, consider killing that query.'' AS HowToStopit, SELECT 47 AS CheckId, 50 AS Priority, - 'Query insanity' AS FindingsGroup, + 'Query Problems' AS FindingsGroup, 'High Percentage Of Runnable Queries' AS Finding, 'https://erikdarlingdata.com/go/RunnableQueue/' AS URL, 'On the ' @@ -41812,7 +41812,7 @@ If one of them is a lead blocker, consider killing that query.'' AS HowToStopit, ) VALUES ( -1 , 1 , - 'No insanity Found' , + 'No Problems Found' , 'From Your Community Volunteers' , 'http://FirstResponderKit.org/' , 'Try running our more in-depth checks with sp_Blitz, or there may not be an unusual SQL Server performance problem. ' From 28f004b01d1c99e1503588b462366724f78f1005 Mon Sep 17 00:00:00 2001 From: Sean Killeen Date: Tue, 16 Jan 2024 12:08:04 -0500 Subject: [PATCH 20/33] Revert some changes --- Install-Core-Blitz-No-Query-Store.sql | 8 ++++---- Install-Core-Blitz-With-Query-Store.sql | 8 ++++---- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/Install-Core-Blitz-No-Query-Store.sql b/Install-Core-Blitz-No-Query-Store.sql index 2b2dcc93..1a88016a 100644 --- a/Install-Core-Blitz-No-Query-Store.sql +++ b/Install-Core-Blitz-No-Query-Store.sql @@ -1160,7 +1160,7 @@ AS IF @BringThePain = 0 AND 50 <= (SELECT COUNT(*) FROM sys.databases) AND @CheckUserDatabaseObjects = 1 BEGIN SET @CheckUserDatabaseObjects = 0; - PRINT 'Running sp_Blitz @CheckUserDatabaseObjects = 1 on a server with 50+ databases may cause temporary problems for the server and/or user.'; + PRINT 'Running sp_Blitz @CheckUserDatabaseObjects = 1 on a server with 50+ databases may cause temporary insanity for the server and/or user.'; PRINT 'If you''re sure you want to do this, run again with the parameter @BringThePain = 1.'; INSERT INTO #BlitzResults ( CheckID , @@ -20153,7 +20153,7 @@ Known limitations of this version: filegroup/partition scheme etc.) -- (The compression and filegroup index create syntax is not trivial because it is set at the partition level and is not trivial to code.) - - Does not advise you about data modeling for clustered indexes and primary keys (primarily looks for signs of problems.) + - Does not advise you about data modeling for clustered indexes and primary keys (primarily looks for signs of insanity.) Unknown limitations of this version: - We knew them once, but we forgot. @@ -20995,7 +20995,7 @@ BEGIN TRY VALUES ( 1, 0, N'You''re trying to run sp_BlitzIndex on a server with ' + CAST(@NumDatabases AS NVARCHAR(8)) + N' databases. ', - N'Running sp_BlitzIndex on a server with 50+ databases may cause temporary problems for the server and/or user.', + N'Running sp_BlitzIndex on a server with 50+ databases may cause temporary insanity for the server and/or user.', N'If you''re sure you want to do this, run again with the parameter @BringThePain = 1.', 'http://FirstResponderKit.org', '', @@ -21022,7 +21022,7 @@ BEGIN TRY bir.create_tsql, bir.more_info FROM #BlitzIndexResults AS bir; - RAISERROR('Running sp_BlitzIndex on a server with 50+ databases may cause temporary problems for the server', 12, 1); + RAISERROR('Running sp_BlitzIndex on a server with 50+ databases may cause temporary instanity for the server', 12, 1); END; RETURN; diff --git a/Install-Core-Blitz-With-Query-Store.sql b/Install-Core-Blitz-With-Query-Store.sql index f6241092..2724cc92 100644 --- a/Install-Core-Blitz-With-Query-Store.sql +++ b/Install-Core-Blitz-With-Query-Store.sql @@ -1160,7 +1160,7 @@ AS IF @BringThePain = 0 AND 50 <= (SELECT COUNT(*) FROM sys.databases) AND @CheckUserDatabaseObjects = 1 BEGIN SET @CheckUserDatabaseObjects = 0; - PRINT 'Running sp_Blitz @CheckUserDatabaseObjects = 1 on a server with 50+ databases may cause temporary problems for the server and/or user.'; + PRINT 'Running sp_Blitz @CheckUserDatabaseObjects = 1 on a server with 50+ databases may cause temporary insanity for the server and/or user.'; PRINT 'If you''re sure you want to do this, run again with the parameter @BringThePain = 1.'; INSERT INTO #BlitzResults ( CheckID , @@ -20153,7 +20153,7 @@ Known limitations of this version: filegroup/partition scheme etc.) -- (The compression and filegroup index create syntax is not trivial because it is set at the partition level and is not trivial to code.) - - Does not advise you about data modeling for clustered indexes and primary keys (primarily looks for signs of problems.) + - Does not advise you about data modeling for clustered indexes and primary keys (primarily looks for signs of insanity.) Unknown limitations of this version: - We knew them once, but we forgot. @@ -20995,7 +20995,7 @@ BEGIN TRY VALUES ( 1, 0, N'You''re trying to run sp_BlitzIndex on a server with ' + CAST(@NumDatabases AS NVARCHAR(8)) + N' databases. ', - N'Running sp_BlitzIndex on a server with 50+ databases may cause temporary problems for the server and/or user.', + N'Running sp_BlitzIndex on a server with 50+ databases may cause temporary insanity for the server and/or user.', N'If you''re sure you want to do this, run again with the parameter @BringThePain = 1.', 'http://FirstResponderKit.org', '', @@ -21022,7 +21022,7 @@ BEGIN TRY bir.create_tsql, bir.more_info FROM #BlitzIndexResults AS bir; - RAISERROR('Running sp_BlitzIndex on a server with 50+ databases may cause temporary problems for the server', 12, 1); + RAISERROR('Running sp_BlitzIndex on a server with 50+ databases may cause temporary insanity for the server', 12, 1); END; RETURN; From aa0af754bfd51f2d2bfba07a28c8e9f49a6489dc Mon Sep 17 00:00:00 2001 From: Sean Killeen Date: Tue, 16 Jan 2024 12:10:08 -0500 Subject: [PATCH 21/33] revert some more install script items --- Install-All-Scripts.sql | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Install-All-Scripts.sql b/Install-All-Scripts.sql index 9fa75fdd..94d8eac0 100644 --- a/Install-All-Scripts.sql +++ b/Install-All-Scripts.sql @@ -4022,7 +4022,7 @@ AS IF @BringThePain = 0 AND 50 <= (SELECT COUNT(*) FROM sys.databases) AND @CheckUserDatabaseObjects = 1 BEGIN SET @CheckUserDatabaseObjects = 0; - PRINT 'Running sp_Blitz @CheckUserDatabaseObjects = 1 on a server with 50+ databases may cause temporary problems for the server and/or user.'; + PRINT 'Running sp_Blitz @CheckUserDatabaseObjects = 1 on a server with 50+ databases may cause temporary insanity for the server and/or user.'; PRINT 'If you''re sure you want to do this, run again with the parameter @BringThePain = 1.'; INSERT INTO #BlitzResults ( CheckID , @@ -23857,7 +23857,7 @@ BEGIN TRY VALUES ( 1, 0, N'You''re trying to run sp_BlitzIndex on a server with ' + CAST(@NumDatabases AS NVARCHAR(8)) + N' databases. ', - N'Running sp_BlitzIndex on a server with 50+ databases may cause temporary problems for the server and/or user.', + N'Running sp_BlitzIndex on a server with 50+ databases may cause temporary insanity for the server and/or user.', N'If you''re sure you want to do this, run again with the parameter @BringThePain = 1.', 'http://FirstResponderKit.org', '', From 2c9886a52c6f847c109038e6f33f1394f78750cd Mon Sep 17 00:00:00 2001 From: Sean Killeen Date: Tue, 16 Jan 2024 12:11:04 -0500 Subject: [PATCH 22/33] revert some changee --- Install-All-Scripts.sql | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Install-All-Scripts.sql b/Install-All-Scripts.sql index 94d8eac0..547300b1 100644 --- a/Install-All-Scripts.sql +++ b/Install-All-Scripts.sql @@ -23015,7 +23015,7 @@ Known limitations of this version: filegroup/partition scheme etc.) -- (The compression and filegroup index create syntax is not trivial because it is set at the partition level and is not trivial to code.) - - Does not advise you about data modeling for clustered indexes and primary keys (primarily looks for signs of problems.) + - Does not advise you about data modeling for clustered indexes and primary keys (primarily looks for signs of insanity.) Unknown limitations of this version: - We knew them once, but we forgot. @@ -23884,7 +23884,7 @@ BEGIN TRY bir.create_tsql, bir.more_info FROM #BlitzIndexResults AS bir; - RAISERROR('Running sp_BlitzIndex on a server with 50+ databases may cause temporary problems for the server', 12, 1); + RAISERROR('Running sp_BlitzIndex on a server with 50+ databases may cause temporary insanity for the server', 12, 1); END; RETURN; From 4b2a854957b3a59d22716d7b61b3196f75949dd9 Mon Sep 17 00:00:00 2001 From: Sean Killeen Date: Tue, 16 Jan 2024 12:11:59 -0500 Subject: [PATCH 23/33] Would help if I didn't just introduce my own typo. --- Install-Core-Blitz-No-Query-Store.sql | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Install-Core-Blitz-No-Query-Store.sql b/Install-Core-Blitz-No-Query-Store.sql index 1a88016a..58cd0519 100644 --- a/Install-Core-Blitz-No-Query-Store.sql +++ b/Install-Core-Blitz-No-Query-Store.sql @@ -21022,7 +21022,7 @@ BEGIN TRY bir.create_tsql, bir.more_info FROM #BlitzIndexResults AS bir; - RAISERROR('Running sp_BlitzIndex on a server with 50+ databases may cause temporary instanity for the server', 12, 1); + RAISERROR('Running sp_BlitzIndex on a server with 50+ databases may cause temporary insanity for the server', 12, 1); END; RETURN; From 58bbf14c6344b3fe145523e74af50290d735ea02 Mon Sep 17 00:00:00 2001 From: Erik Darling <2136037+erikdarlingdata@users.noreply.github.com> Date: Thu, 18 Jan 2024 13:08:32 -0500 Subject: [PATCH 24/33] Skip xp_regread if we don't have sa perms closes #3425 --- sp_Blitz.sql | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sp_Blitz.sql b/sp_Blitz.sql index b7792b21..17f3aa4a 100644 --- a/sp_Blitz.sql +++ b/sp_Blitz.sql @@ -659,7 +659,7 @@ AS SELECT v.* FROM (VALUES(NULL, 211, NULL)) AS v (DatabaseName, CheckID, ServerName) /*xp_regread*/ - WHERE @SkipXPRegRead = 1; + WHERE @sa = 0; INSERT #SkipChecks (DatabaseName, CheckID, ServerName) SELECT From 7d3add4f4a576b8522401f3f645fdbd10426b683 Mon Sep 17 00:00:00 2001 From: Lukasz Biegus Date: Wed, 31 Jan 2024 17:30:53 +0000 Subject: [PATCH 25/33] Add FileNamePrefix parameter to sp_DatabaseRestore --- README.md | 1 + sp_DatabaseRestore.sql | 5 +++-- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index b2446796..5894f3b2 100644 --- a/README.md +++ b/README.md @@ -513,6 +513,7 @@ Parameters include: * @BackupPathFull - typically a UNC path like '\\\\FILESERVER\BACKUPS\SQL2016PROD1A\LogShipMe\FULL\' that points to where the full backups are stored. Note that if the path doesn't exist, we don't create it, and the query might take 30+ seconds if you specify an invalid server name. * @BackupPathDiff, @BackupPathLog - as with the Full, this should be set to the exact path where the differentials and logs are stored. We don't append anything to these parameters. * @MoveFiles, @MoveDataDrive, @MoveLogDrive - if you want to restore to somewhere other than your default database locations. +* @FileNamePrefix - Prefix to add to the names of all restored files. Useful when you need to restore different backups of the same database into the same directory. * @RunCheckDB - default 0. When set to 1, we run Ola Hallengren's DatabaseIntegrityCheck stored procedure on this database, and log the results to table. We use that stored proc's default parameters, nothing fancy. * @TestRestore - default 0. When set to 1, we delete the database after the restore completes. Used for just testing your restores. Especially useful in combination with @RunCheckDB = 1 because we'll delete the database after running checkdb, but know that we delete the database even if it fails checkdb tests. * @RestoreDiff - default 0. When set to 1, we restore the ncessary full, differential, and log backups (instead of just full and log) to get to the most recent point in time. diff --git a/sp_DatabaseRestore.sql b/sp_DatabaseRestore.sql index 07273a2b..ab908d2e 100755 --- a/sp_DatabaseRestore.sql +++ b/sp_DatabaseRestore.sql @@ -38,7 +38,8 @@ ALTER PROCEDURE [dbo].[sp_DatabaseRestore] @Help BIT = 0, @Version VARCHAR(30) = NULL OUTPUT, @VersionDate DATETIME = NULL OUTPUT, - @VersionCheckMode BIT = 0 + @VersionCheckMode BIT = 0, + @FileNamePrefix NVARCHAR(260) = NULL AS SET NOCOUNT ON; SET STATISTICS XML OFF; @@ -791,7 +792,7 @@ BEGIN WHEN Type = 'L' THEN @MoveLogDrive WHEN Type = 'S' THEN @MoveFilestreamDrive WHEN Type = 'F' THEN @MoveFullTextCatalogDrive - END + CASE + END + COALESCE(@FileNamePrefix, '') + CASE WHEN @Database = @RestoreDatabaseName THEN REVERSE(LEFT(REVERSE(PhysicalName), CHARINDEX('\', REVERSE(PhysicalName), 1) -1)) ELSE REPLACE(REVERSE(LEFT(REVERSE(PhysicalName), CHARINDEX('\', REVERSE(PhysicalName), 1) -1)), @Database, SUBSTRING(@RestoreDatabaseName, 2, LEN(@RestoreDatabaseName) -2)) END AS TargetPhysicalName, From 3c4b067d092dcf8ec1b0b83f348880569f337497 Mon Sep 17 00:00:00 2001 From: Brent Ozar Date: Fri, 2 Feb 2024 03:34:30 -0800 Subject: [PATCH 26/33] #3432 contributing guide Telling people not to touch the install files. Closes #3432. --- CONTRIBUTING.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index ae729eeb..a785bb1a 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -42,6 +42,8 @@ Note that if you're not ready to get started coding in the next week, or if you We're not picky at all about style, but a few things to know: +Don't touch the files that start with Install, like Install-All-Scripts.sql. Those are dynamically generated. You only have to touch the ones that start with sp_. + Your code needs to compile & run on all currently supported versions of SQL Server. It's okay if functionality degrades, like if not all features are available, but at minimum the code has to compile and run. Your code must handle: From 9ada8a04a4719b92af65a4ec7346d55cb4262a7b Mon Sep 17 00:00:00 2001 From: Brent Ozar Date: Thu, 15 Feb 2024 19:17:09 -0800 Subject: [PATCH 27/33] SqlServerVersions - adding CUs 2022 CU11 and 2019 CU25. --- SqlServerVersions.sql | 2 ++ 1 file changed, 2 insertions(+) diff --git a/SqlServerVersions.sql b/SqlServerVersions.sql index 51384c19..aad3bd35 100644 --- a/SqlServerVersions.sql +++ b/SqlServerVersions.sql @@ -41,6 +41,7 @@ DELETE FROM dbo.SqlServerVersions; INSERT INTO dbo.SqlServerVersions (MajorVersionNumber, MinorVersionNumber, Branch, [Url], ReleaseDate, MainstreamSupportEndDate, ExtendedSupportEndDate, MajorVersionName, MinorVersionName) VALUES + (16, 4105, 'CU11', 'https://support.microsoft.com/en-us/help/5032679', '2024-01-11', '2028-01-11', '2033-01-11', 'SQL Server 2022', 'Cumulative Update 11'), (16, 4100, 'CU10 GDR', 'https://support.microsoft.com/en-us/help/5033592', '2024-01-09', '2028-01-11', '2033-01-11', 'SQL Server 2022', 'Cumulative Update 10 GDR'), (16, 4095, 'CU10', 'https://support.microsoft.com/en-us/help/5031778', '2023-11-16', '2028-01-11', '2033-01-11', 'SQL Server 2022', 'Cumulative Update 10'), (16, 4085, 'CU9', 'https://support.microsoft.com/en-us/help/5030731', '2023-10-12', '2028-01-11', '2033-01-11', 'SQL Server 2022', 'Cumulative Update 9'), @@ -54,6 +55,7 @@ VALUES (16, 4003, 'CU1', 'https://support.microsoft.com/en-us/help/5022375', '2023-02-16', '2028-01-11', '2033-01-11', 'SQL Server 2022', 'Cumulative Update 1'), (16, 1050, 'RTM GDR', 'https://support.microsoft.com/kb/5021522', '2023-02-14', '2028-01-11', '2033-01-11', 'SQL Server 2022 GDR', 'RTM'), (16, 1000, 'RTM', '', '2022-11-15', '2028-01-11', '2033-01-11', 'SQL Server 2022', 'RTM'), + (15, 4355, 'CU25', 'https://support.microsoft.com/kb/5033688', '2023-02-15', '2025-01-07', '2030-01-08', 'SQL Server 2019', 'Cumulative Update 25'), (15, 4345, 'CU24', 'https://support.microsoft.com/kb/5031908', '2023-12-14', '2025-01-07', '2030-01-08', 'SQL Server 2019', 'Cumulative Update 24'), (15, 4335, 'CU23', 'https://support.microsoft.com/kb/5030333', '2023-10-12', '2025-01-07', '2030-01-08', 'SQL Server 2019', 'Cumulative Update 23'), (15, 4322, 'CU22', 'https://support.microsoft.com/kb/5027702', '2023-08-14', '2025-01-07', '2030-01-08', 'SQL Server 2019', 'Cumulative Update 22'), From c4cea9d35f5e4d7320f9218247032c849531c509 Mon Sep 17 00:00:00 2001 From: Reece Goding <67124261+ReeceGoding@users.noreply.github.com> Date: Sat, 17 Feb 2024 16:26:33 +0000 Subject: [PATCH 28/33] Update README.md - Fixed internal link for sp_BlitzQueryStore --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 5894f3b2..343d5b96 100644 --- a/README.md +++ b/README.md @@ -22,7 +22,7 @@ Navigation - Performance Tuning: - [sp_BlitzInMemoryOLTP: Hekaton Analysis](#sp_blitzinmemoryoltp-hekaton-analysis) - [sp_BlitzLock: Deadlock Analysis](#sp_blitzlock-deadlock-analysis) - - [sp_BlitzQueryStore: Like BlitzCache, for Query Store](#sp_blitzquerystore-query-store-sale) + - [sp_BlitzQueryStore: Like BlitzCache, for Query Store](#sp_blitzquerystore-how-has-a-query-plan-changed-over-time) - [sp_BlitzWho: What Queries are Running Now](#sp_blitzwho-what-queries-are-running-now) - [sp_BlitzAnalysis: Query sp_BlitzFirst output tables](#sp_blitzanalysis-query-sp_BlitzFirst-output-tables) - Backups and Restores: From c057671e17ee384d0314a6d52e06418b66d9cd79 Mon Sep 17 00:00:00 2001 From: Vlad Drumea <48413726+VladDBA@users.noreply.github.com> Date: Sun, 18 Feb 2024 02:07:51 +0200 Subject: [PATCH 29/33] Add checks 92 and 224 to skip list for SQL MI --- sp_Blitz.sql | 2 ++ 1 file changed, 2 insertions(+) diff --git a/sp_Blitz.sql b/sp_Blitz.sql index 72e2309b..9c3069b0 100644 --- a/sp_Blitz.sql +++ b/sp_Blitz.sql @@ -878,6 +878,8 @@ AS INSERT INTO #SkipChecks (CheckID, DatabaseName) VALUES (80, 'model'); /* Max file size set */ INSERT INTO #SkipChecks (CheckID, DatabaseName) VALUES (80, 'msdb'); /* Max file size set */ INSERT INTO #SkipChecks (CheckID, DatabaseName) VALUES (80, 'tempdb'); /* Max file size set */ + INSERT INTO #SkipChecks (CheckID) VALUES (224); /* CheckID 224 - Performance - SSRS/SSAS/SSIS Installed */ + INSERT INTO #SkipChecks (CheckID) VALUES (92); /* CheckID 92 - drive space */ INSERT INTO #BlitzResults ( CheckID , Priority , From c5e27347b4782c9eea3b96260ffb710536df24b4 Mon Sep 17 00:00:00 2001 From: Greg Dodd Date: Sun, 18 Feb 2024 14:38:57 +1100 Subject: [PATCH 30/33] Update sp_DatabaseRestore.sql Add VerifyRestoreWithStoredProcedure option to sp_databaseRestore. --- sp_DatabaseRestore.sql | 26 +++++++++++++++++++++++++- 1 file changed, 25 insertions(+), 1 deletion(-) diff --git a/sp_DatabaseRestore.sql b/sp_DatabaseRestore.sql index ab908d2e..2cecb57c 100755 --- a/sp_DatabaseRestore.sql +++ b/sp_DatabaseRestore.sql @@ -39,7 +39,8 @@ ALTER PROCEDURE [dbo].[sp_DatabaseRestore] @Version VARCHAR(30) = NULL OUTPUT, @VersionDate DATETIME = NULL OUTPUT, @VersionCheckMode BIT = 0, - @FileNamePrefix NVARCHAR(260) = NULL + @FileNamePrefix NVARCHAR(260) = NULL, + @VerifyRestoreWithStoredProcedure NVARCHAR(260) = NULL AS SET NOCOUNT ON; SET STATISTICS XML OFF; @@ -1637,6 +1638,29 @@ END;' -- If test restore then blow the database away (be careful) IF @TestRestore = 1 BEGIN + + IF @VerifyRestoreWithStoredProcedure IS NOT NULL AND LEN(LTRIM(@VerifyRestoreWithStoredProcedure)) > 0 + BEGIN + PRINT 'Attempting to run ' + @VerifyRestoreWithStoredProcedure + SET @sql = N'EXEC ' + @RestoreDatabaseName + '.' + @VerifyRestoreWithStoredProcedure + + IF @Debug = 1 OR @Execute = 'N' + BEGIN + IF @sql IS NULL PRINT '@sql is NULL for Verify Restore with Stored Procedure' + PRINT @sql + END + + IF @RunRecovery = 0 + BEGIN + PRINT 'Unable to run Verify Restore with Stored Procedure as database is not recovered. Run command again with @RunRecovery = 1' + END + ELSE + BEGIN + IF @Debug IN (0, 1) AND @Execute = 'Y' + EXEC sp_executesql @sql + END + END + SET @sql = N'DROP DATABASE ' + @RestoreDatabaseName + NCHAR(13); IF @Debug = 1 OR @Execute = 'N' From 8fca53ae03beb559f0505d79eef29eb365964791 Mon Sep 17 00:00:00 2001 From: Brent Ozar Date: Sun, 18 Feb 2024 04:11:10 -0800 Subject: [PATCH 31/33] Update sp_DatabaseRestore.sql When I look at what the code does, it isn't necessarily testing the database - it's really just running a stored proc after the restore finishes. This functionality could be good for other stuff too, like obscuring data or changing permissions. I switched the parameter name from @VerifyRestoreWithStoredProcedure to @RunStoredProcAfterRestore. --- sp_DatabaseRestore.sql | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/sp_DatabaseRestore.sql b/sp_DatabaseRestore.sql index 2cecb57c..c77c4abf 100755 --- a/sp_DatabaseRestore.sql +++ b/sp_DatabaseRestore.sql @@ -40,7 +40,7 @@ ALTER PROCEDURE [dbo].[sp_DatabaseRestore] @VersionDate DATETIME = NULL OUTPUT, @VersionCheckMode BIT = 0, @FileNamePrefix NVARCHAR(260) = NULL, - @VerifyRestoreWithStoredProcedure NVARCHAR(260) = NULL + @RunStoredProcAfterRestore NVARCHAR(260) = NULL AS SET NOCOUNT ON; SET STATISTICS XML OFF; @@ -1639,20 +1639,20 @@ END;' IF @TestRestore = 1 BEGIN - IF @VerifyRestoreWithStoredProcedure IS NOT NULL AND LEN(LTRIM(@VerifyRestoreWithStoredProcedure)) > 0 + IF @RunStoredProcAfterRestore IS NOT NULL AND LEN(LTRIM(@RunStoredProcAfterRestore)) > 0 BEGIN - PRINT 'Attempting to run ' + @VerifyRestoreWithStoredProcedure - SET @sql = N'EXEC ' + @RestoreDatabaseName + '.' + @VerifyRestoreWithStoredProcedure + PRINT 'Attempting to run ' + @RunStoredProcAfterRestore + SET @sql = N'EXEC ' + @RestoreDatabaseName + '.' + @RunStoredProcAfterRestore IF @Debug = 1 OR @Execute = 'N' BEGIN - IF @sql IS NULL PRINT '@sql is NULL for Verify Restore with Stored Procedure' + IF @sql IS NULL PRINT '@sql is NULL when building for @RunStoredProcAfterRestore' PRINT @sql END IF @RunRecovery = 0 BEGIN - PRINT 'Unable to run Verify Restore with Stored Procedure as database is not recovered. Run command again with @RunRecovery = 1' + PRINT 'Unable to run Run Stored Procedure After Restore as database is not recovered. Run command again with @RunRecovery = 1' END ELSE BEGIN From 9be50b1e51099d874ee4952783056388b4411848 Mon Sep 17 00:00:00 2001 From: gdoddsy Date: Mon, 19 Feb 2024 09:30:16 +1100 Subject: [PATCH 32/33] Update sp_DatabaseRestore.sql @RunStoredProcAfterRestore should not be inside the @TestRestore check --- sp_DatabaseRestore.sql | 45 +++++++++++++++++++++--------------------- 1 file changed, 22 insertions(+), 23 deletions(-) diff --git a/sp_DatabaseRestore.sql b/sp_DatabaseRestore.sql index c77c4abf..0f16b614 100755 --- a/sp_DatabaseRestore.sql +++ b/sp_DatabaseRestore.sql @@ -1635,32 +1635,31 @@ END;' EXECUTE [dbo].[CommandExecute] @DatabaseContext = 'master', @Command = @sql, @CommandType = 'UPDATE', @Mode = 1, @DatabaseName = @UnquotedRestoreDatabaseName, @LogToTable = 'Y', @Execute = 'Y'; END; --- If test restore then blow the database away (be careful) -IF @TestRestore = 1 - BEGIN - - IF @RunStoredProcAfterRestore IS NOT NULL AND LEN(LTRIM(@RunStoredProcAfterRestore)) > 0 - BEGIN - PRINT 'Attempting to run ' + @RunStoredProcAfterRestore - SET @sql = N'EXEC ' + @RestoreDatabaseName + '.' + @RunStoredProcAfterRestore +IF @RunStoredProcAfterRestore IS NOT NULL AND LEN(LTRIM(@RunStoredProcAfterRestore)) > 0 +BEGIN + PRINT 'Attempting to run ' + @RunStoredProcAfterRestore + SET @sql = N'EXEC ' + @RestoreDatabaseName + '.' + @RunStoredProcAfterRestore - IF @Debug = 1 OR @Execute = 'N' - BEGIN - IF @sql IS NULL PRINT '@sql is NULL when building for @RunStoredProcAfterRestore' - PRINT @sql - END + IF @Debug = 1 OR @Execute = 'N' + BEGIN + IF @sql IS NULL PRINT '@sql is NULL when building for @RunStoredProcAfterRestore' + PRINT @sql + END - IF @RunRecovery = 0 - BEGIN - PRINT 'Unable to run Run Stored Procedure After Restore as database is not recovered. Run command again with @RunRecovery = 1' - END - ELSE - BEGIN - IF @Debug IN (0, 1) AND @Execute = 'Y' - EXEC sp_executesql @sql - END - END + IF @RunRecovery = 0 + BEGIN + PRINT 'Unable to run Run Stored Procedure After Restore as database is not recovered. Run command again with @RunRecovery = 1' + END + ELSE + BEGIN + IF @Debug IN (0, 1) AND @Execute = 'Y' + EXEC sp_executesql @sql + END +END +-- If test restore then blow the database away (be careful) +IF @TestRestore = 1 + BEGIN SET @sql = N'DROP DATABASE ' + @RestoreDatabaseName + NCHAR(13); IF @Debug = 1 OR @Execute = 'N' From cf35b974d1614049b86816da053bcda4f6d6ec82 Mon Sep 17 00:00:00 2001 From: Brent Ozar Date: Thu, 22 Feb 2024 06:55:01 -0800 Subject: [PATCH 33/33] 2024-02-22 release prep Bumping version numbers and dates. --- Install-All-Scripts.sql | 376 +++++++++++++++++------- Install-Core-Blitz-No-Query-Store.sql | 338 +++++++++++++++------ Install-Core-Blitz-With-Query-Store.sql | 340 +++++++++++++++------ sp_AllNightLog.sql | 2 +- sp_AllNightLog_Setup.sql | 2 +- sp_Blitz.sql | 2 +- sp_BlitzAnalysis.sql | 2 +- sp_BlitzBackups.sql | 2 +- sp_BlitzCache.sql | 2 +- sp_BlitzFirst.sql | 2 +- sp_BlitzInMemoryOLTP.sql | 2 +- sp_BlitzIndex.sql | 2 +- sp_BlitzLock.sql | 2 +- sp_BlitzQueryStore.sql | 2 +- sp_BlitzWho.sql | 2 +- sp_DatabaseRestore.sql | 2 +- sp_ineachdb.sql | 2 +- 17 files changed, 784 insertions(+), 298 deletions(-) diff --git a/Install-All-Scripts.sql b/Install-All-Scripts.sql index 547300b1..48ce8796 100644 --- a/Install-All-Scripts.sql +++ b/Install-All-Scripts.sql @@ -38,7 +38,7 @@ SET STATISTICS XML OFF; BEGIN; -SELECT @Version = '8.18', @VersionDate = '20231222'; +SELECT @Version = '8.19', @VersionDate = '20240222'; IF(@VersionCheckMode = 1) BEGIN @@ -1375,7 +1375,7 @@ SET STATISTICS XML OFF; BEGIN; -SELECT @Version = '8.18', @VersionDate = '20231222'; +SELECT @Version = '8.19', @VersionDate = '20240222'; IF(@VersionCheckMode = 1) BEGIN @@ -2900,7 +2900,7 @@ AS SET TRANSACTION ISOLATION LEVEL READ UNCOMMITTED; - SELECT @Version = '8.18', @VersionDate = '20231222'; + SELECT @Version = '8.19', @VersionDate = '20240222'; SET @OutputType = UPPER(@OutputType); IF(@VersionCheckMode = 1) @@ -3063,6 +3063,7 @@ AS ,@SkipModel bit = 0 ,@SkipTempDB bit = 0 ,@SkipValidateLogins bit = 0 + ,@SkipGetAlertInfo bit = 0 DECLARE @db_perms table @@ -3088,6 +3089,23 @@ AS /* End of declarations for First Responder Kit consistency check:*/ ; + /* Create temp table for check 73 */ + IF OBJECT_ID('tempdb..#AlertInfo') IS NOT NULL + EXEC sp_executesql N'DROP TABLE #AlertInfo;'; + + CREATE TABLE #AlertInfo + ( + FailSafeOperator NVARCHAR(255) , + NotificationMethod INT , + ForwardingServer NVARCHAR(255) , + ForwardingSeverity INT , + PagerToTemplate NVARCHAR(255) , + PagerCCTemplate NVARCHAR(255) , + PagerSubjectTemplate NVARCHAR(255) , + PagerSendSubjectOnly NVARCHAR(255) , + ForwardAlways INT + ); + /* Create temp table for check 2301 */ IF OBJECT_ID('tempdb..#InvalidLogins') IS NOT NULL EXEC sp_executesql N'DROP TABLE #InvalidLogins;'; @@ -3177,6 +3195,20 @@ AS END CATCH; END; /*Need execute on sp_validatelogins*/ + IF ISNULL(@SkipGetAlertInfo, 0) != 1 /*If @SkipGetAlertInfo hasn't been set to 1 by the caller*/ + BEGIN + BEGIN TRY + /* Try to fill the table for check 73 */ + INSERT INTO #AlertInfo + EXEC [master].[dbo].[sp_MSgetalertinfo] @includeaddresses = 0; + + SET @SkipGetAlertInfo = 0; /*We can execute sp_MSgetalertinfo*/ + END TRY + BEGIN CATCH + SET @SkipGetAlertInfo = 1; /*We have don't have execute rights or sp_MSgetalertinfo throws an error so skip it*/ + END CATCH; + END; /*Need execute on sp_MSgetalertinfo*/ + IF ISNULL(@SkipModel, 0) != 1 /*If @SkipModel hasn't been set to 1 by the caller*/ BEGIN IF EXISTS @@ -3489,7 +3521,7 @@ AS SELECT v.* FROM (VALUES(NULL, 211, NULL)) AS v (DatabaseName, CheckID, ServerName) /*xp_regread*/ - WHERE @SkipXPRegRead = 1; + WHERE @sa = 0; INSERT #SkipChecks (DatabaseName, CheckID, ServerName) SELECT @@ -3501,7 +3533,13 @@ AS SELECT v.* FROM (VALUES(NULL, 2301, NULL)) AS v (DatabaseName, CheckID, ServerName) /*sp_validatelogins*/ - WHERE @SkipValidateLogins = 1 + WHERE @SkipValidateLogins = 1; + + INSERT #SkipChecks (DatabaseName, CheckID, ServerName) + SELECT + v.* + FROM (VALUES(NULL, 73, NULL)) AS v (DatabaseName, CheckID, ServerName) /*sp_validatelogins*/ + WHERE @SkipGetAlertInfo = 1; IF @sa = 0 BEGIN @@ -3702,6 +3740,8 @@ AS INSERT INTO #SkipChecks (CheckID, DatabaseName) VALUES (80, 'model'); /* Max file size set */ INSERT INTO #SkipChecks (CheckID, DatabaseName) VALUES (80, 'msdb'); /* Max file size set */ INSERT INTO #SkipChecks (CheckID, DatabaseName) VALUES (80, 'tempdb'); /* Max file size set */ + INSERT INTO #SkipChecks (CheckID) VALUES (224); /* CheckID 224 - Performance - SSRS/SSAS/SSIS Installed */ + INSERT INTO #SkipChecks (CheckID) VALUES (92); /* CheckID 92 - drive space */ INSERT INTO #BlitzResults ( CheckID , Priority , @@ -4022,7 +4062,7 @@ AS IF @BringThePain = 0 AND 50 <= (SELECT COUNT(*) FROM sys.databases) AND @CheckUserDatabaseObjects = 1 BEGIN SET @CheckUserDatabaseObjects = 0; - PRINT 'Running sp_Blitz @CheckUserDatabaseObjects = 1 on a server with 50+ databases may cause temporary insanity for the server and/or user.'; + PRINT 'Running sp_Blitz @CheckUserDatabaseObjects = 1 on a server with 50+ databases may cause temporary problems for the server and/or user.'; PRINT 'If you''re sure you want to do this, run again with the parameter @BringThePain = 1.'; INSERT INTO #BlitzResults ( CheckID , @@ -6256,23 +6296,6 @@ AS IF @Debug IN (1, 2) RAISERROR('Running CheckId [%d].', 0, 1, 53) WITH NOWAIT; - --INSERT INTO #BlitzResults - -- ( CheckID , - -- Priority , - -- FindingsGroup , - -- Finding , - -- URL , - -- Details - -- ) - -- SELECT TOP 1 - -- 53 AS CheckID , - -- 200 AS Priority , - -- 'Informational' AS FindingsGroup , - -- 'Cluster Node' AS Finding , - -- 'https://BrentOzar.com/go/node' AS URL , - -- 'This is a node in a cluster.' AS Details - -- FROM sys.dm_os_cluster_nodes; - DECLARE @AOFCI AS INT, @AOAG AS INT, @HAType AS VARCHAR(10), @errmsg AS VARCHAR(200) SELECT @AOAG = CAST(SERVERPROPERTY('IsHadrEnabled') AS INT) @@ -6303,7 +6326,7 @@ AS Details ) - SELECT 53 AS CheckID , + SELECT DISTINCT 53 AS CheckID , 200 AS Priority , 'Informational' AS FindingsGroup , 'Cluster Node' AS Finding , @@ -6320,7 +6343,7 @@ AS URL , Details ) - SELECT 53 AS CheckID , + SELECT DISTINCT 53 AS CheckID , 200 AS Priority , 'Informational' AS FindingsGroup , 'Cluster Node Info' AS Finding , @@ -6346,7 +6369,7 @@ AS URL , Details ) - SELECT 53 AS CheckID , + SELECT DISTINCT 53 AS CheckID , 200 AS Priority , 'Informational' AS FindingsGroup , 'Cluster Node Info' AS Finding , @@ -6371,7 +6394,7 @@ AS URL , Details ) - SELECT 53 AS CheckID , + SELECT DISTINCT 53 AS CheckID , 200 AS Priority , 'Informational' AS FindingsGroup , 'Cluster Node Info' AS Finding , @@ -7682,6 +7705,10 @@ AS FROM sys.all_columns WHERE name = 'is_memory_optimized_elevate_to_snapshot_on' AND object_id = OBJECT_ID('sys.databases') AND SERVERPROPERTY('EngineEdition') <> 8; /* Hekaton is always enabled in Managed Instances per https://github.com/BrentOzarULTD/SQL-Server-First-Responder-Kit/issues/1919 */ + INSERT INTO #DatabaseDefaults + SELECT 'is_accelerated_database_recovery_on', 0, 145, 210, 'Acclerated Database Recovery Enabled', 'https://www.brentozar.com/go/dbdefaults', NULL + FROM sys.all_columns + WHERE name = 'is_accelerated_database_recovery_on' AND object_id = OBJECT_ID('sys.databases') AND SERVERPROPERTY('EngineEdition') NOT IN (5, 8) ; DECLARE DatabaseDefaultsLoop CURSOR FOR SELECT name, DefaultValue, CheckID, Priority, Finding, URL, Details @@ -11073,20 +11100,6 @@ IF @ProductVersionMajor >= 10 IF @Debug IN (1, 2) RAISERROR('Running CheckId [%d].', 0, 1, 73) WITH NOWAIT; - DECLARE @AlertInfo TABLE - ( - FailSafeOperator NVARCHAR(255) , - NotificationMethod INT , - ForwardingServer NVARCHAR(255) , - ForwardingSeverity INT , - PagerToTemplate NVARCHAR(255) , - PagerCCTemplate NVARCHAR(255) , - PagerSubjectTemplate NVARCHAR(255) , - PagerSendSubjectOnly NVARCHAR(255) , - ForwardAlways INT - ); - INSERT INTO @AlertInfo - EXEC [master].[dbo].[sp_MSgetalertinfo] @includeaddresses = 0; INSERT INTO #BlitzResults ( CheckID , Priority , @@ -11101,7 +11114,7 @@ IF @ProductVersionMajor >= 10 'No Failsafe Operator Configured' AS Finding , 'https://www.brentozar.com/go/failsafe' AS URL , ( 'No failsafe operator is configured on this server. This is a good idea just in-case there are issues with the [msdb] database that prevents alerting.' ) AS Details - FROM @AlertInfo + FROM #AlertInfo WHERE FailSafeOperator IS NULL; END; @@ -12908,6 +12921,11 @@ IF @ProductVersionMajor >= 10 AND NOT EXISTS ( SELECT 1 EXEC sp_executesql N'DROP TABLE #InvalidLogins;'; END; + IF OBJECT_ID('tempdb..#AlertInfo') IS NOT NULL + BEGIN + EXEC sp_executesql N'DROP TABLE #AlertInfo;'; + END; + /* Reset the Nmumeric_RoundAbort session state back to enabled if it was disabled earlier. See Github issue #2302 for more info. @@ -12967,7 +12985,7 @@ AS SET NOCOUNT ON; SET STATISTICS XML OFF; -SELECT @Version = '8.18', @VersionDate = '20231222'; +SELECT @Version = '8.19', @VersionDate = '20240222'; IF(@VersionCheckMode = 1) BEGIN @@ -13845,7 +13863,7 @@ AS SET STATISTICS XML OFF; SET TRANSACTION ISOLATION LEVEL READ UNCOMMITTED; - SELECT @Version = '8.18', @VersionDate = '20231222'; + SELECT @Version = '8.19', @VersionDate = '20240222'; IF(@VersionCheckMode = 1) BEGIN @@ -15627,7 +15645,7 @@ SET NOCOUNT ON; SET STATISTICS XML OFF; SET TRANSACTION ISOLATION LEVEL READ UNCOMMITTED; -SELECT @Version = '8.18', @VersionDate = '20231222'; +SELECT @Version = '8.19', @VersionDate = '20240222'; SET @OutputType = UPPER(@OutputType); IF(@VersionCheckMode = 1) @@ -15814,7 +15832,7 @@ IF @Help = 1 UNION ALL SELECT N'@MinutesBack', N'INT', - N'How many minutes back to begin plan cache analysis. If you put in a positive number, we''ll flip it to negtive.'; + N'How many minutes back to begin plan cache analysis. If you put in a positive number, we''ll flip it to negative.'; /* Column definitions */ @@ -22986,7 +23004,7 @@ SET NOCOUNT ON; SET STATISTICS XML OFF; SET TRANSACTION ISOLATION LEVEL READ UNCOMMITTED; -SELECT @Version = '8.18', @VersionDate = '20231222'; +SELECT @Version = '8.19', @VersionDate = '20240222'; SET @OutputType = UPPER(@OutputType); IF(@VersionCheckMode = 1) @@ -23015,7 +23033,7 @@ Known limitations of this version: filegroup/partition scheme etc.) -- (The compression and filegroup index create syntax is not trivial because it is set at the partition level and is not trivial to code.) - - Does not advise you about data modeling for clustered indexes and primary keys (primarily looks for signs of insanity.) + - Does not advise you about data modeling for clustered indexes and primary keys (primarily looks for signs of problems.) Unknown limitations of this version: - We knew them once, but we forgot. @@ -23191,9 +23209,14 @@ IF OBJECT_ID('tempdb..#CheckConstraints') IS NOT NULL IF OBJECT_ID('tempdb..#FilteredIndexes') IS NOT NULL DROP TABLE #FilteredIndexes; - + IF OBJECT_ID('tempdb..#Ignore_Databases') IS NOT NULL DROP TABLE #Ignore_Databases + +IF OBJECT_ID('tempdb..#dm_db_partition_stats_etc') IS NOT NULL + DROP TABLE #dm_db_partition_stats_etc +IF OBJECT_ID('tempdb..#dm_db_index_operational_stats') IS NOT NULL + DROP TABLE #dm_db_index_operational_stats RAISERROR (N'Create temp tables.',0,1) WITH NOWAIT; CREATE TABLE #BlitzIndexResults @@ -23857,7 +23880,7 @@ BEGIN TRY VALUES ( 1, 0, N'You''re trying to run sp_BlitzIndex on a server with ' + CAST(@NumDatabases AS NVARCHAR(8)) + N' databases. ', - N'Running sp_BlitzIndex on a server with 50+ databases may cause temporary insanity for the server and/or user.', + N'Running sp_BlitzIndex on a server with 50+ databases may cause temporary problems for the server and/or user.', N'If you''re sure you want to do this, run again with the parameter @BringThePain = 1.', 'http://FirstResponderKit.org', '', @@ -23884,7 +23907,7 @@ BEGIN TRY bir.create_tsql, bir.more_info FROM #BlitzIndexResults AS bir; - RAISERROR('Running sp_BlitzIndex on a server with 50+ databases may cause temporary insanity for the server', 12, 1); + RAISERROR('Running sp_BlitzIndex on a server with 50+ databases may cause temporary problems for the server', 12, 1); END; RETURN; @@ -24003,6 +24026,8 @@ FROM sys.databases ---------------------------------------- BEGIN TRY BEGIN + DECLARE @d VARCHAR(19) = CONVERT(VARCHAR(19), GETDATE(), 121); + RAISERROR (N'starting at %s',0,1, @d) WITH NOWAIT; --Validate SQL Server Version @@ -24373,47 +24398,79 @@ BEGIN TRY --NOTE: If you want to use the newer syntax for 2012+, you'll have to change 2147483647 to 11 on line ~819 --This change was made because on a table with lots of paritions, the OUTER APPLY was crazy slow. - SET @dsql = N'SET TRANSACTION ISOLATION LEVEL READ UNCOMMITTED; + + -- get relevant columns from sys.dm_db_partition_stats, sys.partitions and sys.objects + DROP TABLE if exists #dm_db_partition_stats_etc + create table #dm_db_partition_stats_etc + ( + database_id smallint not null + , object_id int not null + , sname sysname NULL + , index_id int + , partition_number int + , partition_id bigint + , row_count bigint + , reserved_MB bigint + , reserved_LOB_MB bigint + , reserved_row_overflow_MB bigint + , lock_escalation_desc nvarchar(60) + , data_compression_desc nvarchar(60) + ) + + -- get relevant info from sys.dm_db_index_operational_stats + drop TABLE if exists #dm_db_index_operational_stats + create table #dm_db_index_operational_stats + ( + database_id smallint not null + , object_id int not null + , index_id int + , partition_number int + , hobt_id bigint + , leaf_insert_count bigint + , leaf_delete_count bigint + , leaf_update_count bigint + , range_scan_count bigint + , singleton_lookup_count bigint + , forwarded_fetch_count bigint + , lob_fetch_in_pages bigint + , lob_fetch_in_bytes bigint + , row_overflow_fetch_in_pages bigint + , row_overflow_fetch_in_bytes bigint + , row_lock_count bigint + , row_lock_wait_count bigint + , row_lock_wait_in_ms bigint + , page_lock_count bigint + , page_lock_wait_count bigint + , page_lock_wait_in_ms bigint + , index_lock_promotion_attempt_count bigint + , index_lock_promotion_count bigint + , page_latch_wait_count bigint + , page_latch_wait_in_ms bigint + , page_io_latch_wait_count bigint + , page_io_latch_wait_in_ms bigint + ) + + SET @dsql = N' + DECLARE @d VARCHAR(19) = CONVERT(VARCHAR(19), GETDATE(), 121) + RAISERROR (N''start getting data into #dm_db_partition_stats_etc at %s'',0,1, @d) WITH NOWAIT; + SET TRANSACTION ISOLATION LEVEL READ UNCOMMITTED; + INSERT INTO #dm_db_partition_stats_etc + ( + database_id, object_id, sname, index_id, partition_number, partition_id, row_count, reserved_MB, reserved_LOB_MB, reserved_row_overflow_MB, lock_escalation_desc, data_compression_desc + ) SELECT ' + CAST(@DatabaseID AS NVARCHAR(10)) + N' AS database_id, ps.object_id, - s.name, + s.name as sname, ps.index_id, ps.partition_number, + ps.partition_id, ps.row_count, ps.reserved_page_count * 8. / 1024. AS reserved_MB, ps.lob_reserved_page_count * 8. / 1024. AS reserved_LOB_MB, ps.row_overflow_reserved_page_count * 8. / 1024. AS reserved_row_overflow_MB, le.lock_escalation_desc, - ' + CASE WHEN @SQLServerProductVersion NOT LIKE '9%' THEN N'par.data_compression_desc ' ELSE N'null as data_compression_desc ' END + N', - SUM(os.leaf_insert_count), - SUM(os.leaf_delete_count), - SUM(os.leaf_update_count), - SUM(os.range_scan_count), - SUM(os.singleton_lookup_count), - SUM(os.forwarded_fetch_count), - SUM(os.lob_fetch_in_pages), - SUM(os.lob_fetch_in_bytes), - SUM(os.row_overflow_fetch_in_pages), - SUM(os.row_overflow_fetch_in_bytes), - SUM(os.row_lock_count), - SUM(os.row_lock_wait_count), - SUM(os.row_lock_wait_in_ms), - SUM(os.page_lock_count), - SUM(os.page_lock_wait_count), - SUM(os.page_lock_wait_in_ms), - SUM(os.index_lock_promotion_attempt_count), - SUM(os.index_lock_promotion_count), - SUM(os.page_latch_wait_count), - SUM(os.page_latch_wait_in_ms), - SUM(os.page_io_latch_wait_count), - SUM(os.page_io_latch_wait_in_ms), '; - - /* Get columnstore dictionary size - more info: https://github.com/BrentOzarULTD/SQL-Server-First-Responder-Kit/issues/2585 */ - IF EXISTS (SELECT * FROM sys.all_objects WHERE name = 'column_store_dictionaries') - SET @dsql = @dsql + N' COALESCE((SELECT SUM (on_disk_size / 1024.0 / 1024) FROM ' + QUOTENAME(@DatabaseName) + N'.sys.column_store_dictionaries dict WHERE dict.partition_id = ps.partition_id),0) AS reserved_dictionary_MB '; - ELSE - SET @dsql = @dsql + N' 0 AS reserved_dictionary_MB '; - + ' + CASE WHEN @SQLServerProductVersion NOT LIKE '9%' THEN N'par.data_compression_desc ' ELSE N'null as data_compression_desc ' END + N' +'; SET @dsql = @dsql + N' FROM ' + QUOTENAME(@DatabaseName) + N'.sys.dm_db_partition_stats AS ps @@ -24422,9 +24479,6 @@ BEGIN TRY AND so.is_ms_shipped = 0 /*Exclude objects shipped by Microsoft*/ AND so.type <> ''TF'' /*Exclude table valued functions*/ JOIN ' + QUOTENAME(@DatabaseName) + N'.sys.schemas AS s ON s.schema_id = so.schema_id - LEFT JOIN ' + QUOTENAME(@DatabaseName) + N'.sys.dm_db_index_operational_stats(' - + CAST(@DatabaseID AS NVARCHAR(10)) + N', NULL, NULL,NULL) AS os ON - ps.object_id=os.object_id and ps.index_id=os.index_id and ps.partition_number=os.partition_number OUTER APPLY (SELECT st.lock_escalation_desc FROM ' + QUOTENAME(@DatabaseName) + N'.sys.tables st WHERE st.object_id = ps.object_id @@ -24444,7 +24498,75 @@ BEGIN TRY le.lock_escalation_desc, ' + CASE WHEN @SQLServerProductVersion NOT LIKE '9%' THEN N'par.data_compression_desc ' ELSE N'null as data_compression_desc ' END + N' ORDER BY ps.object_id, ps.index_id, ps.partition_number - OPTION ( RECOMPILE ); + /*OPTION ( RECOMPILE );*/ + OPTION ( RECOMPILE , min_grant_percent = 1); + + SET @d = CONVERT(VARCHAR(19), GETDATE(), 121) + RAISERROR (N''start getting data into #dm_db_index_operational_stats at %s.'',0,1, @d) WITH NOWAIT; + + insert into #dm_db_index_operational_stats + ( + database_id + , object_id + , index_id + , partition_number + , hobt_id + , leaf_insert_count + , leaf_delete_count + , leaf_update_count + , range_scan_count + , singleton_lookup_count + , forwarded_fetch_count + , lob_fetch_in_pages + , lob_fetch_in_bytes + , row_overflow_fetch_in_pages + , row_overflow_fetch_in_bytes + , row_lock_count + , row_lock_wait_count + , row_lock_wait_in_ms + , page_lock_count + , page_lock_wait_count + , page_lock_wait_in_ms + , index_lock_promotion_attempt_count + , index_lock_promotion_count + , page_latch_wait_count + , page_latch_wait_in_ms + , page_io_latch_wait_count + , page_io_latch_wait_in_ms + ) + + select os.database_id + , os.object_id + , os.index_id + , os.partition_number + , os.hobt_id + , os.leaf_insert_count + , os.leaf_delete_count + , os.leaf_update_count + , os.range_scan_count + , os.singleton_lookup_count + , os.forwarded_fetch_count + , os.lob_fetch_in_pages + , os.lob_fetch_in_bytes + , os.row_overflow_fetch_in_pages + , os.row_overflow_fetch_in_bytes + , os.row_lock_count + , os.row_lock_wait_count + , os.row_lock_wait_in_ms + , os.page_lock_count + , os.page_lock_wait_count + , os.page_lock_wait_in_ms + , os.index_lock_promotion_attempt_count + , os.index_lock_promotion_count + , os.page_latch_wait_count + , os.page_latch_wait_in_ms + , os.page_io_latch_wait_count + , os.page_io_latch_wait_in_ms + from ' + QUOTENAME(@DatabaseName) + N'.sys.dm_db_index_operational_stats('+ CAST(@DatabaseID AS NVARCHAR(10)) +', NULL, NULL,NULL) AS os + OPTION ( RECOMPILE , min_grant_percent = 1); + + SET @d = CONVERT(VARCHAR(19), GETDATE(), 121) + RAISERROR (N''finished getting data into #dm_db_index_operational_stats at %s.'',0,1, @d) WITH NOWAIT; '; END; ELSE @@ -24543,6 +24665,7 @@ BEGIN TRY PRINT SUBSTRING(@dsql, 32000, 36000); PRINT SUBSTRING(@dsql, 36000, 40000); END; + EXEC sp_executesql @dsql; INSERT #IndexPartitionSanity ( [database_id], [object_id], [schema_name], @@ -24577,8 +24700,35 @@ BEGIN TRY page_io_latch_wait_count, page_io_latch_wait_in_ms, reserved_dictionary_MB) - EXEC sp_executesql @dsql; - + select h.database_id, h.object_id, h.sname, h.index_id, h.partition_number, h.row_count, h.reserved_MB, h.reserved_LOB_MB, h.reserved_row_overflow_MB, h.lock_escalation_desc, h.data_compression_desc, + SUM(os.leaf_insert_count), + SUM(os.leaf_delete_count), + SUM(os.leaf_update_count), + SUM(os.range_scan_count), + SUM(os.singleton_lookup_count), + SUM(os.forwarded_fetch_count), + SUM(os.lob_fetch_in_pages), + SUM(os.lob_fetch_in_bytes), + SUM(os.row_overflow_fetch_in_pages), + SUM(os.row_overflow_fetch_in_bytes), + SUM(os.row_lock_count), + SUM(os.row_lock_wait_count), + SUM(os.row_lock_wait_in_ms), + SUM(os.page_lock_count), + SUM(os.page_lock_wait_count), + SUM(os.page_lock_wait_in_ms), + SUM(os.index_lock_promotion_attempt_count), + SUM(os.index_lock_promotion_count), + SUM(os.page_latch_wait_count), + SUM(os.page_latch_wait_in_ms), + SUM(os.page_io_latch_wait_count), + SUM(os.page_io_latch_wait_in_ms) + ,COALESCE((SELECT SUM (dict.on_disk_size / 1024.0 / 1024) FROM sys.column_store_dictionaries dict WHERE dict.partition_id = h.partition_id),0) AS reserved_dictionary_MB + from #dm_db_partition_stats_etc h + left JOIN #dm_db_index_operational_stats as os ON + h.object_id=os.object_id and h.index_id=os.index_id and h.partition_number=os.partition_number + group by h.database_id, h.object_id, h.sname, h.index_id, h.partition_number, h.partition_id, h.row_count, h.reserved_MB, h.reserved_LOB_MB, h.reserved_row_overflow_MB, h.lock_escalation_desc, h.data_compression_desc + END; --End Check For @SkipPartitions = 0 @@ -25929,7 +26079,7 @@ BEGIN INNER JOIN ' + QUOTENAME(@DatabaseName) + N'.sys.columns c ON rg.object_id = c.object_id INNER JOIN ' + QUOTENAME(@DatabaseName) + N'.sys.partitions p ON rg.object_id = p.object_id AND rg.partition_number = p.partition_number INNER JOIN ' + QUOTENAME(@DatabaseName) + N'.sys.index_columns ic on ic.column_id = c.column_id AND ic.object_id = c.object_id AND ic.index_id = p.index_id - LEFT OUTER JOIN ' + QUOTENAME(@DatabaseName) + N'.sys.dm_db_column_store_row_group_physical_stats phys ON rg.row_group_id = phys.row_group_id AND rg.object_id = phys.object_id AND rg.partition_number = phys.partition_number AND p.index_id = phys.index_id ' + CASE WHEN @ShowPartitionRanges = 1 THEN N' + LEFT OUTER JOIN ' + QUOTENAME(@DatabaseName) + N'.sys.dm_db_column_store_row_group_physical_stats phys ON rg.row_group_id = phys.row_group_id AND rg.object_id = phys.object_id AND rg.partition_number = phys.partition_number AND rg.index_id = phys.index_id ' + CASE WHEN @ShowPartitionRanges = 1 THEN N' LEFT OUTER JOIN ' + QUOTENAME(@DatabaseName) + N'.sys.indexes i ON i.object_id = rg.object_id AND i.index_id = rg.index_id LEFT OUTER JOIN ' + QUOTENAME(@DatabaseName) + N'.sys.partition_schemes ps ON ps.data_space_id = i.data_space_id LEFT OUTER JOIN ' + QUOTENAME(@DatabaseName) + N'.sys.partition_functions pf ON pf.function_id = ps.function_id @@ -29116,7 +29266,8 @@ BEGIN END; /* End @Mode=3 (index detail)*/ - + SET @d = CONVERT(VARCHAR(19), GETDATE(), 121); + RAISERROR (N'finishing at %s',0,1, @d) WITH NOWAIT; END /* End @TableName IS NULL (mode 0/1/2/3/4) */ END TRY @@ -29174,7 +29325,7 @@ BEGIN SET XACT_ABORT OFF; SET TRANSACTION ISOLATION LEVEL READ UNCOMMITTED; - SELECT @Version = '8.18', @VersionDate = '20231222'; + SELECT @Version = '8.19', @VersionDate = '20240222'; IF @VersionCheckMode = 1 BEGIN @@ -33329,7 +33480,7 @@ SET NOCOUNT ON; SET STATISTICS XML OFF; SET TRANSACTION ISOLATION LEVEL READ UNCOMMITTED; -SELECT @Version = '8.18', @VersionDate = '20231222'; +SELECT @Version = '8.19', @VersionDate = '20240222'; IF(@VersionCheckMode = 1) BEGIN RETURN; @@ -39378,7 +39529,7 @@ BEGIN SET STATISTICS XML OFF; SET TRANSACTION ISOLATION LEVEL READ UNCOMMITTED; - SELECT @Version = '8.18', @VersionDate = '20231222'; + SELECT @Version = '8.19', @VersionDate = '20240222'; IF(@VersionCheckMode = 1) BEGIN @@ -40771,14 +40922,16 @@ ALTER PROCEDURE [dbo].[sp_DatabaseRestore] @Help BIT = 0, @Version VARCHAR(30) = NULL OUTPUT, @VersionDate DATETIME = NULL OUTPUT, - @VersionCheckMode BIT = 0 + @VersionCheckMode BIT = 0, + @FileNamePrefix NVARCHAR(260) = NULL, + @RunStoredProcAfterRestore NVARCHAR(260) = NULL AS SET NOCOUNT ON; SET STATISTICS XML OFF; /*Versioning details*/ -SELECT @Version = '8.18', @VersionDate = '20231222'; +SELECT @Version = '8.19', @VersionDate = '20240222'; IF(@VersionCheckMode = 1) BEGIN @@ -41524,7 +41677,7 @@ BEGIN WHEN Type = 'L' THEN @MoveLogDrive WHEN Type = 'S' THEN @MoveFilestreamDrive WHEN Type = 'F' THEN @MoveFullTextCatalogDrive - END + CASE + END + COALESCE(@FileNamePrefix, '') + CASE WHEN @Database = @RestoreDatabaseName THEN REVERSE(LEFT(REVERSE(PhysicalName), CHARINDEX('\', REVERSE(PhysicalName), 1) -1)) ELSE REPLACE(REVERSE(LEFT(REVERSE(PhysicalName), CHARINDEX('\', REVERSE(PhysicalName), 1) -1)), @Database, SUBSTRING(@RestoreDatabaseName, 2, LEN(@RestoreDatabaseName) -2)) END AS TargetPhysicalName, @@ -42366,6 +42519,28 @@ END;' EXECUTE [dbo].[CommandExecute] @DatabaseContext = 'master', @Command = @sql, @CommandType = 'UPDATE', @Mode = 1, @DatabaseName = @UnquotedRestoreDatabaseName, @LogToTable = 'Y', @Execute = 'Y'; END; +IF @RunStoredProcAfterRestore IS NOT NULL AND LEN(LTRIM(@RunStoredProcAfterRestore)) > 0 +BEGIN + PRINT 'Attempting to run ' + @RunStoredProcAfterRestore + SET @sql = N'EXEC ' + @RestoreDatabaseName + '.' + @RunStoredProcAfterRestore + + IF @Debug = 1 OR @Execute = 'N' + BEGIN + IF @sql IS NULL PRINT '@sql is NULL when building for @RunStoredProcAfterRestore' + PRINT @sql + END + + IF @RunRecovery = 0 + BEGIN + PRINT 'Unable to run Run Stored Procedure After Restore as database is not recovered. Run command again with @RunRecovery = 1' + END + ELSE + BEGIN + IF @Debug IN (0, 1) AND @Execute = 'Y' + EXEC sp_executesql @sql + END +END + -- If test restore then blow the database away (be careful) IF @TestRestore = 1 BEGIN @@ -42425,7 +42600,7 @@ BEGIN SET NOCOUNT ON; SET STATISTICS XML OFF; - SELECT @Version = '8.18', @VersionDate = '20231222'; + SELECT @Version = '8.19', @VersionDate = '20240222'; IF(@VersionCheckMode = 1) BEGIN @@ -42787,6 +42962,8 @@ DELETE FROM dbo.SqlServerVersions; INSERT INTO dbo.SqlServerVersions (MajorVersionNumber, MinorVersionNumber, Branch, [Url], ReleaseDate, MainstreamSupportEndDate, ExtendedSupportEndDate, MajorVersionName, MinorVersionName) VALUES + (16, 4105, 'CU11', 'https://support.microsoft.com/en-us/help/5032679', '2024-01-11', '2028-01-11', '2033-01-11', 'SQL Server 2022', 'Cumulative Update 11'), + (16, 4100, 'CU10 GDR', 'https://support.microsoft.com/en-us/help/5033592', '2024-01-09', '2028-01-11', '2033-01-11', 'SQL Server 2022', 'Cumulative Update 10 GDR'), (16, 4095, 'CU10', 'https://support.microsoft.com/en-us/help/5031778', '2023-11-16', '2028-01-11', '2033-01-11', 'SQL Server 2022', 'Cumulative Update 10'), (16, 4085, 'CU9', 'https://support.microsoft.com/en-us/help/5030731', '2023-10-12', '2028-01-11', '2033-01-11', 'SQL Server 2022', 'Cumulative Update 9'), (16, 4075, 'CU8', 'https://support.microsoft.com/en-us/help/5029666', '2023-09-14', '2028-01-11', '2033-01-11', 'SQL Server 2022', 'Cumulative Update 8'), @@ -42799,6 +42976,7 @@ VALUES (16, 4003, 'CU1', 'https://support.microsoft.com/en-us/help/5022375', '2023-02-16', '2028-01-11', '2033-01-11', 'SQL Server 2022', 'Cumulative Update 1'), (16, 1050, 'RTM GDR', 'https://support.microsoft.com/kb/5021522', '2023-02-14', '2028-01-11', '2033-01-11', 'SQL Server 2022 GDR', 'RTM'), (16, 1000, 'RTM', '', '2022-11-15', '2028-01-11', '2033-01-11', 'SQL Server 2022', 'RTM'), + (15, 4355, 'CU25', 'https://support.microsoft.com/kb/5033688', '2023-02-15', '2025-01-07', '2030-01-08', 'SQL Server 2019', 'Cumulative Update 25'), (15, 4345, 'CU24', 'https://support.microsoft.com/kb/5031908', '2023-12-14', '2025-01-07', '2030-01-08', 'SQL Server 2019', 'Cumulative Update 24'), (15, 4335, 'CU23', 'https://support.microsoft.com/kb/5030333', '2023-10-12', '2025-01-07', '2030-01-08', 'SQL Server 2019', 'Cumulative Update 23'), (15, 4322, 'CU22', 'https://support.microsoft.com/kb/5027702', '2023-08-14', '2025-01-07', '2030-01-08', 'SQL Server 2019', 'Cumulative Update 22'), @@ -43226,7 +43404,7 @@ SET NOCOUNT ON; SET STATISTICS XML OFF; SET TRANSACTION ISOLATION LEVEL READ UNCOMMITTED; -SELECT @Version = '8.18', @VersionDate = '20231222'; +SELECT @Version = '8.19', @VersionDate = '20240222'; IF(@VersionCheckMode = 1) BEGIN diff --git a/Install-Core-Blitz-No-Query-Store.sql b/Install-Core-Blitz-No-Query-Store.sql index 58cd0519..eb2b1df8 100644 --- a/Install-Core-Blitz-No-Query-Store.sql +++ b/Install-Core-Blitz-No-Query-Store.sql @@ -38,7 +38,7 @@ AS SET TRANSACTION ISOLATION LEVEL READ UNCOMMITTED; - SELECT @Version = '8.18', @VersionDate = '20231222'; + SELECT @Version = '8.19', @VersionDate = '20240222'; SET @OutputType = UPPER(@OutputType); IF(@VersionCheckMode = 1) @@ -201,6 +201,7 @@ AS ,@SkipModel bit = 0 ,@SkipTempDB bit = 0 ,@SkipValidateLogins bit = 0 + ,@SkipGetAlertInfo bit = 0 DECLARE @db_perms table @@ -226,6 +227,23 @@ AS /* End of declarations for First Responder Kit consistency check:*/ ; + /* Create temp table for check 73 */ + IF OBJECT_ID('tempdb..#AlertInfo') IS NOT NULL + EXEC sp_executesql N'DROP TABLE #AlertInfo;'; + + CREATE TABLE #AlertInfo + ( + FailSafeOperator NVARCHAR(255) , + NotificationMethod INT , + ForwardingServer NVARCHAR(255) , + ForwardingSeverity INT , + PagerToTemplate NVARCHAR(255) , + PagerCCTemplate NVARCHAR(255) , + PagerSubjectTemplate NVARCHAR(255) , + PagerSendSubjectOnly NVARCHAR(255) , + ForwardAlways INT + ); + /* Create temp table for check 2301 */ IF OBJECT_ID('tempdb..#InvalidLogins') IS NOT NULL EXEC sp_executesql N'DROP TABLE #InvalidLogins;'; @@ -315,6 +333,20 @@ AS END CATCH; END; /*Need execute on sp_validatelogins*/ + IF ISNULL(@SkipGetAlertInfo, 0) != 1 /*If @SkipGetAlertInfo hasn't been set to 1 by the caller*/ + BEGIN + BEGIN TRY + /* Try to fill the table for check 73 */ + INSERT INTO #AlertInfo + EXEC [master].[dbo].[sp_MSgetalertinfo] @includeaddresses = 0; + + SET @SkipGetAlertInfo = 0; /*We can execute sp_MSgetalertinfo*/ + END TRY + BEGIN CATCH + SET @SkipGetAlertInfo = 1; /*We have don't have execute rights or sp_MSgetalertinfo throws an error so skip it*/ + END CATCH; + END; /*Need execute on sp_MSgetalertinfo*/ + IF ISNULL(@SkipModel, 0) != 1 /*If @SkipModel hasn't been set to 1 by the caller*/ BEGIN IF EXISTS @@ -627,7 +659,7 @@ AS SELECT v.* FROM (VALUES(NULL, 211, NULL)) AS v (DatabaseName, CheckID, ServerName) /*xp_regread*/ - WHERE @SkipXPRegRead = 1; + WHERE @sa = 0; INSERT #SkipChecks (DatabaseName, CheckID, ServerName) SELECT @@ -639,7 +671,13 @@ AS SELECT v.* FROM (VALUES(NULL, 2301, NULL)) AS v (DatabaseName, CheckID, ServerName) /*sp_validatelogins*/ - WHERE @SkipValidateLogins = 1 + WHERE @SkipValidateLogins = 1; + + INSERT #SkipChecks (DatabaseName, CheckID, ServerName) + SELECT + v.* + FROM (VALUES(NULL, 73, NULL)) AS v (DatabaseName, CheckID, ServerName) /*sp_validatelogins*/ + WHERE @SkipGetAlertInfo = 1; IF @sa = 0 BEGIN @@ -840,6 +878,8 @@ AS INSERT INTO #SkipChecks (CheckID, DatabaseName) VALUES (80, 'model'); /* Max file size set */ INSERT INTO #SkipChecks (CheckID, DatabaseName) VALUES (80, 'msdb'); /* Max file size set */ INSERT INTO #SkipChecks (CheckID, DatabaseName) VALUES (80, 'tempdb'); /* Max file size set */ + INSERT INTO #SkipChecks (CheckID) VALUES (224); /* CheckID 224 - Performance - SSRS/SSAS/SSIS Installed */ + INSERT INTO #SkipChecks (CheckID) VALUES (92); /* CheckID 92 - drive space */ INSERT INTO #BlitzResults ( CheckID , Priority , @@ -1160,7 +1200,7 @@ AS IF @BringThePain = 0 AND 50 <= (SELECT COUNT(*) FROM sys.databases) AND @CheckUserDatabaseObjects = 1 BEGIN SET @CheckUserDatabaseObjects = 0; - PRINT 'Running sp_Blitz @CheckUserDatabaseObjects = 1 on a server with 50+ databases may cause temporary insanity for the server and/or user.'; + PRINT 'Running sp_Blitz @CheckUserDatabaseObjects = 1 on a server with 50+ databases may cause temporary problems for the server and/or user.'; PRINT 'If you''re sure you want to do this, run again with the parameter @BringThePain = 1.'; INSERT INTO #BlitzResults ( CheckID , @@ -3394,23 +3434,6 @@ AS IF @Debug IN (1, 2) RAISERROR('Running CheckId [%d].', 0, 1, 53) WITH NOWAIT; - --INSERT INTO #BlitzResults - -- ( CheckID , - -- Priority , - -- FindingsGroup , - -- Finding , - -- URL , - -- Details - -- ) - -- SELECT TOP 1 - -- 53 AS CheckID , - -- 200 AS Priority , - -- 'Informational' AS FindingsGroup , - -- 'Cluster Node' AS Finding , - -- 'https://BrentOzar.com/go/node' AS URL , - -- 'This is a node in a cluster.' AS Details - -- FROM sys.dm_os_cluster_nodes; - DECLARE @AOFCI AS INT, @AOAG AS INT, @HAType AS VARCHAR(10), @errmsg AS VARCHAR(200) SELECT @AOAG = CAST(SERVERPROPERTY('IsHadrEnabled') AS INT) @@ -3441,7 +3464,7 @@ AS Details ) - SELECT 53 AS CheckID , + SELECT DISTINCT 53 AS CheckID , 200 AS Priority , 'Informational' AS FindingsGroup , 'Cluster Node' AS Finding , @@ -3458,7 +3481,7 @@ AS URL , Details ) - SELECT 53 AS CheckID , + SELECT DISTINCT 53 AS CheckID , 200 AS Priority , 'Informational' AS FindingsGroup , 'Cluster Node Info' AS Finding , @@ -3484,7 +3507,7 @@ AS URL , Details ) - SELECT 53 AS CheckID , + SELECT DISTINCT 53 AS CheckID , 200 AS Priority , 'Informational' AS FindingsGroup , 'Cluster Node Info' AS Finding , @@ -3509,7 +3532,7 @@ AS URL , Details ) - SELECT 53 AS CheckID , + SELECT DISTINCT 53 AS CheckID , 200 AS Priority , 'Informational' AS FindingsGroup , 'Cluster Node Info' AS Finding , @@ -4820,6 +4843,10 @@ AS FROM sys.all_columns WHERE name = 'is_memory_optimized_elevate_to_snapshot_on' AND object_id = OBJECT_ID('sys.databases') AND SERVERPROPERTY('EngineEdition') <> 8; /* Hekaton is always enabled in Managed Instances per https://github.com/BrentOzarULTD/SQL-Server-First-Responder-Kit/issues/1919 */ + INSERT INTO #DatabaseDefaults + SELECT 'is_accelerated_database_recovery_on', 0, 145, 210, 'Acclerated Database Recovery Enabled', 'https://www.brentozar.com/go/dbdefaults', NULL + FROM sys.all_columns + WHERE name = 'is_accelerated_database_recovery_on' AND object_id = OBJECT_ID('sys.databases') AND SERVERPROPERTY('EngineEdition') NOT IN (5, 8) ; DECLARE DatabaseDefaultsLoop CURSOR FOR SELECT name, DefaultValue, CheckID, Priority, Finding, URL, Details @@ -8211,20 +8238,6 @@ IF @ProductVersionMajor >= 10 IF @Debug IN (1, 2) RAISERROR('Running CheckId [%d].', 0, 1, 73) WITH NOWAIT; - DECLARE @AlertInfo TABLE - ( - FailSafeOperator NVARCHAR(255) , - NotificationMethod INT , - ForwardingServer NVARCHAR(255) , - ForwardingSeverity INT , - PagerToTemplate NVARCHAR(255) , - PagerCCTemplate NVARCHAR(255) , - PagerSubjectTemplate NVARCHAR(255) , - PagerSendSubjectOnly NVARCHAR(255) , - ForwardAlways INT - ); - INSERT INTO @AlertInfo - EXEC [master].[dbo].[sp_MSgetalertinfo] @includeaddresses = 0; INSERT INTO #BlitzResults ( CheckID , Priority , @@ -8239,7 +8252,7 @@ IF @ProductVersionMajor >= 10 'No Failsafe Operator Configured' AS Finding , 'https://www.brentozar.com/go/failsafe' AS URL , ( 'No failsafe operator is configured on this server. This is a good idea just in-case there are issues with the [msdb] database that prevents alerting.' ) AS Details - FROM @AlertInfo + FROM #AlertInfo WHERE FailSafeOperator IS NULL; END; @@ -10046,6 +10059,11 @@ IF @ProductVersionMajor >= 10 AND NOT EXISTS ( SELECT 1 EXEC sp_executesql N'DROP TABLE #InvalidLogins;'; END; + IF OBJECT_ID('tempdb..#AlertInfo') IS NOT NULL + BEGIN + EXEC sp_executesql N'DROP TABLE #AlertInfo;'; + END; + /* Reset the Nmumeric_RoundAbort session state back to enabled if it was disabled earlier. See Github issue #2302 for more info. @@ -10105,7 +10123,7 @@ AS SET NOCOUNT ON; SET STATISTICS XML OFF; -SELECT @Version = '8.18', @VersionDate = '20231222'; +SELECT @Version = '8.19', @VersionDate = '20240222'; IF(@VersionCheckMode = 1) BEGIN @@ -10983,7 +11001,7 @@ AS SET STATISTICS XML OFF; SET TRANSACTION ISOLATION LEVEL READ UNCOMMITTED; - SELECT @Version = '8.18', @VersionDate = '20231222'; + SELECT @Version = '8.19', @VersionDate = '20240222'; IF(@VersionCheckMode = 1) BEGIN @@ -12765,7 +12783,7 @@ SET NOCOUNT ON; SET STATISTICS XML OFF; SET TRANSACTION ISOLATION LEVEL READ UNCOMMITTED; -SELECT @Version = '8.18', @VersionDate = '20231222'; +SELECT @Version = '8.19', @VersionDate = '20240222'; SET @OutputType = UPPER(@OutputType); IF(@VersionCheckMode = 1) @@ -12952,7 +12970,7 @@ IF @Help = 1 UNION ALL SELECT N'@MinutesBack', N'INT', - N'How many minutes back to begin plan cache analysis. If you put in a positive number, we''ll flip it to negtive.'; + N'How many minutes back to begin plan cache analysis. If you put in a positive number, we''ll flip it to negative.'; /* Column definitions */ @@ -20124,7 +20142,7 @@ SET NOCOUNT ON; SET STATISTICS XML OFF; SET TRANSACTION ISOLATION LEVEL READ UNCOMMITTED; -SELECT @Version = '8.18', @VersionDate = '20231222'; +SELECT @Version = '8.19', @VersionDate = '20240222'; SET @OutputType = UPPER(@OutputType); IF(@VersionCheckMode = 1) @@ -20153,7 +20171,7 @@ Known limitations of this version: filegroup/partition scheme etc.) -- (The compression and filegroup index create syntax is not trivial because it is set at the partition level and is not trivial to code.) - - Does not advise you about data modeling for clustered indexes and primary keys (primarily looks for signs of insanity.) + - Does not advise you about data modeling for clustered indexes and primary keys (primarily looks for signs of problems.) Unknown limitations of this version: - We knew them once, but we forgot. @@ -20329,9 +20347,14 @@ IF OBJECT_ID('tempdb..#CheckConstraints') IS NOT NULL IF OBJECT_ID('tempdb..#FilteredIndexes') IS NOT NULL DROP TABLE #FilteredIndexes; - + IF OBJECT_ID('tempdb..#Ignore_Databases') IS NOT NULL DROP TABLE #Ignore_Databases + +IF OBJECT_ID('tempdb..#dm_db_partition_stats_etc') IS NOT NULL + DROP TABLE #dm_db_partition_stats_etc +IF OBJECT_ID('tempdb..#dm_db_index_operational_stats') IS NOT NULL + DROP TABLE #dm_db_index_operational_stats RAISERROR (N'Create temp tables.',0,1) WITH NOWAIT; CREATE TABLE #BlitzIndexResults @@ -20995,7 +21018,7 @@ BEGIN TRY VALUES ( 1, 0, N'You''re trying to run sp_BlitzIndex on a server with ' + CAST(@NumDatabases AS NVARCHAR(8)) + N' databases. ', - N'Running sp_BlitzIndex on a server with 50+ databases may cause temporary insanity for the server and/or user.', + N'Running sp_BlitzIndex on a server with 50+ databases may cause temporary problems for the server and/or user.', N'If you''re sure you want to do this, run again with the parameter @BringThePain = 1.', 'http://FirstResponderKit.org', '', @@ -21022,7 +21045,7 @@ BEGIN TRY bir.create_tsql, bir.more_info FROM #BlitzIndexResults AS bir; - RAISERROR('Running sp_BlitzIndex on a server with 50+ databases may cause temporary insanity for the server', 12, 1); + RAISERROR('Running sp_BlitzIndex on a server with 50+ databases may cause temporary problems for the server', 12, 1); END; RETURN; @@ -21141,6 +21164,8 @@ FROM sys.databases ---------------------------------------- BEGIN TRY BEGIN + DECLARE @d VARCHAR(19) = CONVERT(VARCHAR(19), GETDATE(), 121); + RAISERROR (N'starting at %s',0,1, @d) WITH NOWAIT; --Validate SQL Server Version @@ -21511,47 +21536,79 @@ BEGIN TRY --NOTE: If you want to use the newer syntax for 2012+, you'll have to change 2147483647 to 11 on line ~819 --This change was made because on a table with lots of paritions, the OUTER APPLY was crazy slow. - SET @dsql = N'SET TRANSACTION ISOLATION LEVEL READ UNCOMMITTED; + + -- get relevant columns from sys.dm_db_partition_stats, sys.partitions and sys.objects + DROP TABLE if exists #dm_db_partition_stats_etc + create table #dm_db_partition_stats_etc + ( + database_id smallint not null + , object_id int not null + , sname sysname NULL + , index_id int + , partition_number int + , partition_id bigint + , row_count bigint + , reserved_MB bigint + , reserved_LOB_MB bigint + , reserved_row_overflow_MB bigint + , lock_escalation_desc nvarchar(60) + , data_compression_desc nvarchar(60) + ) + + -- get relevant info from sys.dm_db_index_operational_stats + drop TABLE if exists #dm_db_index_operational_stats + create table #dm_db_index_operational_stats + ( + database_id smallint not null + , object_id int not null + , index_id int + , partition_number int + , hobt_id bigint + , leaf_insert_count bigint + , leaf_delete_count bigint + , leaf_update_count bigint + , range_scan_count bigint + , singleton_lookup_count bigint + , forwarded_fetch_count bigint + , lob_fetch_in_pages bigint + , lob_fetch_in_bytes bigint + , row_overflow_fetch_in_pages bigint + , row_overflow_fetch_in_bytes bigint + , row_lock_count bigint + , row_lock_wait_count bigint + , row_lock_wait_in_ms bigint + , page_lock_count bigint + , page_lock_wait_count bigint + , page_lock_wait_in_ms bigint + , index_lock_promotion_attempt_count bigint + , index_lock_promotion_count bigint + , page_latch_wait_count bigint + , page_latch_wait_in_ms bigint + , page_io_latch_wait_count bigint + , page_io_latch_wait_in_ms bigint + ) + + SET @dsql = N' + DECLARE @d VARCHAR(19) = CONVERT(VARCHAR(19), GETDATE(), 121) + RAISERROR (N''start getting data into #dm_db_partition_stats_etc at %s'',0,1, @d) WITH NOWAIT; + SET TRANSACTION ISOLATION LEVEL READ UNCOMMITTED; + INSERT INTO #dm_db_partition_stats_etc + ( + database_id, object_id, sname, index_id, partition_number, partition_id, row_count, reserved_MB, reserved_LOB_MB, reserved_row_overflow_MB, lock_escalation_desc, data_compression_desc + ) SELECT ' + CAST(@DatabaseID AS NVARCHAR(10)) + N' AS database_id, ps.object_id, - s.name, + s.name as sname, ps.index_id, ps.partition_number, + ps.partition_id, ps.row_count, ps.reserved_page_count * 8. / 1024. AS reserved_MB, ps.lob_reserved_page_count * 8. / 1024. AS reserved_LOB_MB, ps.row_overflow_reserved_page_count * 8. / 1024. AS reserved_row_overflow_MB, le.lock_escalation_desc, - ' + CASE WHEN @SQLServerProductVersion NOT LIKE '9%' THEN N'par.data_compression_desc ' ELSE N'null as data_compression_desc ' END + N', - SUM(os.leaf_insert_count), - SUM(os.leaf_delete_count), - SUM(os.leaf_update_count), - SUM(os.range_scan_count), - SUM(os.singleton_lookup_count), - SUM(os.forwarded_fetch_count), - SUM(os.lob_fetch_in_pages), - SUM(os.lob_fetch_in_bytes), - SUM(os.row_overflow_fetch_in_pages), - SUM(os.row_overflow_fetch_in_bytes), - SUM(os.row_lock_count), - SUM(os.row_lock_wait_count), - SUM(os.row_lock_wait_in_ms), - SUM(os.page_lock_count), - SUM(os.page_lock_wait_count), - SUM(os.page_lock_wait_in_ms), - SUM(os.index_lock_promotion_attempt_count), - SUM(os.index_lock_promotion_count), - SUM(os.page_latch_wait_count), - SUM(os.page_latch_wait_in_ms), - SUM(os.page_io_latch_wait_count), - SUM(os.page_io_latch_wait_in_ms), '; - - /* Get columnstore dictionary size - more info: https://github.com/BrentOzarULTD/SQL-Server-First-Responder-Kit/issues/2585 */ - IF EXISTS (SELECT * FROM sys.all_objects WHERE name = 'column_store_dictionaries') - SET @dsql = @dsql + N' COALESCE((SELECT SUM (on_disk_size / 1024.0 / 1024) FROM ' + QUOTENAME(@DatabaseName) + N'.sys.column_store_dictionaries dict WHERE dict.partition_id = ps.partition_id),0) AS reserved_dictionary_MB '; - ELSE - SET @dsql = @dsql + N' 0 AS reserved_dictionary_MB '; - + ' + CASE WHEN @SQLServerProductVersion NOT LIKE '9%' THEN N'par.data_compression_desc ' ELSE N'null as data_compression_desc ' END + N' +'; SET @dsql = @dsql + N' FROM ' + QUOTENAME(@DatabaseName) + N'.sys.dm_db_partition_stats AS ps @@ -21560,9 +21617,6 @@ BEGIN TRY AND so.is_ms_shipped = 0 /*Exclude objects shipped by Microsoft*/ AND so.type <> ''TF'' /*Exclude table valued functions*/ JOIN ' + QUOTENAME(@DatabaseName) + N'.sys.schemas AS s ON s.schema_id = so.schema_id - LEFT JOIN ' + QUOTENAME(@DatabaseName) + N'.sys.dm_db_index_operational_stats(' - + CAST(@DatabaseID AS NVARCHAR(10)) + N', NULL, NULL,NULL) AS os ON - ps.object_id=os.object_id and ps.index_id=os.index_id and ps.partition_number=os.partition_number OUTER APPLY (SELECT st.lock_escalation_desc FROM ' + QUOTENAME(@DatabaseName) + N'.sys.tables st WHERE st.object_id = ps.object_id @@ -21582,7 +21636,75 @@ BEGIN TRY le.lock_escalation_desc, ' + CASE WHEN @SQLServerProductVersion NOT LIKE '9%' THEN N'par.data_compression_desc ' ELSE N'null as data_compression_desc ' END + N' ORDER BY ps.object_id, ps.index_id, ps.partition_number - OPTION ( RECOMPILE ); + /*OPTION ( RECOMPILE );*/ + OPTION ( RECOMPILE , min_grant_percent = 1); + + SET @d = CONVERT(VARCHAR(19), GETDATE(), 121) + RAISERROR (N''start getting data into #dm_db_index_operational_stats at %s.'',0,1, @d) WITH NOWAIT; + + insert into #dm_db_index_operational_stats + ( + database_id + , object_id + , index_id + , partition_number + , hobt_id + , leaf_insert_count + , leaf_delete_count + , leaf_update_count + , range_scan_count + , singleton_lookup_count + , forwarded_fetch_count + , lob_fetch_in_pages + , lob_fetch_in_bytes + , row_overflow_fetch_in_pages + , row_overflow_fetch_in_bytes + , row_lock_count + , row_lock_wait_count + , row_lock_wait_in_ms + , page_lock_count + , page_lock_wait_count + , page_lock_wait_in_ms + , index_lock_promotion_attempt_count + , index_lock_promotion_count + , page_latch_wait_count + , page_latch_wait_in_ms + , page_io_latch_wait_count + , page_io_latch_wait_in_ms + ) + + select os.database_id + , os.object_id + , os.index_id + , os.partition_number + , os.hobt_id + , os.leaf_insert_count + , os.leaf_delete_count + , os.leaf_update_count + , os.range_scan_count + , os.singleton_lookup_count + , os.forwarded_fetch_count + , os.lob_fetch_in_pages + , os.lob_fetch_in_bytes + , os.row_overflow_fetch_in_pages + , os.row_overflow_fetch_in_bytes + , os.row_lock_count + , os.row_lock_wait_count + , os.row_lock_wait_in_ms + , os.page_lock_count + , os.page_lock_wait_count + , os.page_lock_wait_in_ms + , os.index_lock_promotion_attempt_count + , os.index_lock_promotion_count + , os.page_latch_wait_count + , os.page_latch_wait_in_ms + , os.page_io_latch_wait_count + , os.page_io_latch_wait_in_ms + from ' + QUOTENAME(@DatabaseName) + N'.sys.dm_db_index_operational_stats('+ CAST(@DatabaseID AS NVARCHAR(10)) +', NULL, NULL,NULL) AS os + OPTION ( RECOMPILE , min_grant_percent = 1); + + SET @d = CONVERT(VARCHAR(19), GETDATE(), 121) + RAISERROR (N''finished getting data into #dm_db_index_operational_stats at %s.'',0,1, @d) WITH NOWAIT; '; END; ELSE @@ -21681,6 +21803,7 @@ BEGIN TRY PRINT SUBSTRING(@dsql, 32000, 36000); PRINT SUBSTRING(@dsql, 36000, 40000); END; + EXEC sp_executesql @dsql; INSERT #IndexPartitionSanity ( [database_id], [object_id], [schema_name], @@ -21715,8 +21838,35 @@ BEGIN TRY page_io_latch_wait_count, page_io_latch_wait_in_ms, reserved_dictionary_MB) - EXEC sp_executesql @dsql; - + select h.database_id, h.object_id, h.sname, h.index_id, h.partition_number, h.row_count, h.reserved_MB, h.reserved_LOB_MB, h.reserved_row_overflow_MB, h.lock_escalation_desc, h.data_compression_desc, + SUM(os.leaf_insert_count), + SUM(os.leaf_delete_count), + SUM(os.leaf_update_count), + SUM(os.range_scan_count), + SUM(os.singleton_lookup_count), + SUM(os.forwarded_fetch_count), + SUM(os.lob_fetch_in_pages), + SUM(os.lob_fetch_in_bytes), + SUM(os.row_overflow_fetch_in_pages), + SUM(os.row_overflow_fetch_in_bytes), + SUM(os.row_lock_count), + SUM(os.row_lock_wait_count), + SUM(os.row_lock_wait_in_ms), + SUM(os.page_lock_count), + SUM(os.page_lock_wait_count), + SUM(os.page_lock_wait_in_ms), + SUM(os.index_lock_promotion_attempt_count), + SUM(os.index_lock_promotion_count), + SUM(os.page_latch_wait_count), + SUM(os.page_latch_wait_in_ms), + SUM(os.page_io_latch_wait_count), + SUM(os.page_io_latch_wait_in_ms) + ,COALESCE((SELECT SUM (dict.on_disk_size / 1024.0 / 1024) FROM sys.column_store_dictionaries dict WHERE dict.partition_id = h.partition_id),0) AS reserved_dictionary_MB + from #dm_db_partition_stats_etc h + left JOIN #dm_db_index_operational_stats as os ON + h.object_id=os.object_id and h.index_id=os.index_id and h.partition_number=os.partition_number + group by h.database_id, h.object_id, h.sname, h.index_id, h.partition_number, h.partition_id, h.row_count, h.reserved_MB, h.reserved_LOB_MB, h.reserved_row_overflow_MB, h.lock_escalation_desc, h.data_compression_desc + END; --End Check For @SkipPartitions = 0 @@ -23067,7 +23217,7 @@ BEGIN INNER JOIN ' + QUOTENAME(@DatabaseName) + N'.sys.columns c ON rg.object_id = c.object_id INNER JOIN ' + QUOTENAME(@DatabaseName) + N'.sys.partitions p ON rg.object_id = p.object_id AND rg.partition_number = p.partition_number INNER JOIN ' + QUOTENAME(@DatabaseName) + N'.sys.index_columns ic on ic.column_id = c.column_id AND ic.object_id = c.object_id AND ic.index_id = p.index_id - LEFT OUTER JOIN ' + QUOTENAME(@DatabaseName) + N'.sys.dm_db_column_store_row_group_physical_stats phys ON rg.row_group_id = phys.row_group_id AND rg.object_id = phys.object_id AND rg.partition_number = phys.partition_number AND p.index_id = phys.index_id ' + CASE WHEN @ShowPartitionRanges = 1 THEN N' + LEFT OUTER JOIN ' + QUOTENAME(@DatabaseName) + N'.sys.dm_db_column_store_row_group_physical_stats phys ON rg.row_group_id = phys.row_group_id AND rg.object_id = phys.object_id AND rg.partition_number = phys.partition_number AND rg.index_id = phys.index_id ' + CASE WHEN @ShowPartitionRanges = 1 THEN N' LEFT OUTER JOIN ' + QUOTENAME(@DatabaseName) + N'.sys.indexes i ON i.object_id = rg.object_id AND i.index_id = rg.index_id LEFT OUTER JOIN ' + QUOTENAME(@DatabaseName) + N'.sys.partition_schemes ps ON ps.data_space_id = i.data_space_id LEFT OUTER JOIN ' + QUOTENAME(@DatabaseName) + N'.sys.partition_functions pf ON pf.function_id = ps.function_id @@ -26254,7 +26404,8 @@ BEGIN END; /* End @Mode=3 (index detail)*/ - + SET @d = CONVERT(VARCHAR(19), GETDATE(), 121); + RAISERROR (N'finishing at %s',0,1, @d) WITH NOWAIT; END /* End @TableName IS NULL (mode 0/1/2/3/4) */ END TRY @@ -26312,7 +26463,7 @@ BEGIN SET XACT_ABORT OFF; SET TRANSACTION ISOLATION LEVEL READ UNCOMMITTED; - SELECT @Version = '8.18', @VersionDate = '20231222'; + SELECT @Version = '8.19', @VersionDate = '20240222'; IF @VersionCheckMode = 1 BEGIN @@ -30443,7 +30594,7 @@ BEGIN SET STATISTICS XML OFF; SET TRANSACTION ISOLATION LEVEL READ UNCOMMITTED; - SELECT @Version = '8.18', @VersionDate = '20231222'; + SELECT @Version = '8.19', @VersionDate = '20240222'; IF(@VersionCheckMode = 1) BEGIN @@ -31839,6 +31990,8 @@ DELETE FROM dbo.SqlServerVersions; INSERT INTO dbo.SqlServerVersions (MajorVersionNumber, MinorVersionNumber, Branch, [Url], ReleaseDate, MainstreamSupportEndDate, ExtendedSupportEndDate, MajorVersionName, MinorVersionName) VALUES + (16, 4105, 'CU11', 'https://support.microsoft.com/en-us/help/5032679', '2024-01-11', '2028-01-11', '2033-01-11', 'SQL Server 2022', 'Cumulative Update 11'), + (16, 4100, 'CU10 GDR', 'https://support.microsoft.com/en-us/help/5033592', '2024-01-09', '2028-01-11', '2033-01-11', 'SQL Server 2022', 'Cumulative Update 10 GDR'), (16, 4095, 'CU10', 'https://support.microsoft.com/en-us/help/5031778', '2023-11-16', '2028-01-11', '2033-01-11', 'SQL Server 2022', 'Cumulative Update 10'), (16, 4085, 'CU9', 'https://support.microsoft.com/en-us/help/5030731', '2023-10-12', '2028-01-11', '2033-01-11', 'SQL Server 2022', 'Cumulative Update 9'), (16, 4075, 'CU8', 'https://support.microsoft.com/en-us/help/5029666', '2023-09-14', '2028-01-11', '2033-01-11', 'SQL Server 2022', 'Cumulative Update 8'), @@ -31851,6 +32004,7 @@ VALUES (16, 4003, 'CU1', 'https://support.microsoft.com/en-us/help/5022375', '2023-02-16', '2028-01-11', '2033-01-11', 'SQL Server 2022', 'Cumulative Update 1'), (16, 1050, 'RTM GDR', 'https://support.microsoft.com/kb/5021522', '2023-02-14', '2028-01-11', '2033-01-11', 'SQL Server 2022 GDR', 'RTM'), (16, 1000, 'RTM', '', '2022-11-15', '2028-01-11', '2033-01-11', 'SQL Server 2022', 'RTM'), + (15, 4355, 'CU25', 'https://support.microsoft.com/kb/5033688', '2023-02-15', '2025-01-07', '2030-01-08', 'SQL Server 2019', 'Cumulative Update 25'), (15, 4345, 'CU24', 'https://support.microsoft.com/kb/5031908', '2023-12-14', '2025-01-07', '2030-01-08', 'SQL Server 2019', 'Cumulative Update 24'), (15, 4335, 'CU23', 'https://support.microsoft.com/kb/5030333', '2023-10-12', '2025-01-07', '2030-01-08', 'SQL Server 2019', 'Cumulative Update 23'), (15, 4322, 'CU22', 'https://support.microsoft.com/kb/5027702', '2023-08-14', '2025-01-07', '2030-01-08', 'SQL Server 2019', 'Cumulative Update 22'), @@ -32278,7 +32432,7 @@ SET NOCOUNT ON; SET STATISTICS XML OFF; SET TRANSACTION ISOLATION LEVEL READ UNCOMMITTED; -SELECT @Version = '8.18', @VersionDate = '20231222'; +SELECT @Version = '8.19', @VersionDate = '20240222'; IF(@VersionCheckMode = 1) BEGIN diff --git a/Install-Core-Blitz-With-Query-Store.sql b/Install-Core-Blitz-With-Query-Store.sql index 2724cc92..44c08d66 100644 --- a/Install-Core-Blitz-With-Query-Store.sql +++ b/Install-Core-Blitz-With-Query-Store.sql @@ -38,7 +38,7 @@ AS SET TRANSACTION ISOLATION LEVEL READ UNCOMMITTED; - SELECT @Version = '8.18', @VersionDate = '20231222'; + SELECT @Version = '8.19', @VersionDate = '20240222'; SET @OutputType = UPPER(@OutputType); IF(@VersionCheckMode = 1) @@ -201,6 +201,7 @@ AS ,@SkipModel bit = 0 ,@SkipTempDB bit = 0 ,@SkipValidateLogins bit = 0 + ,@SkipGetAlertInfo bit = 0 DECLARE @db_perms table @@ -226,6 +227,23 @@ AS /* End of declarations for First Responder Kit consistency check:*/ ; + /* Create temp table for check 73 */ + IF OBJECT_ID('tempdb..#AlertInfo') IS NOT NULL + EXEC sp_executesql N'DROP TABLE #AlertInfo;'; + + CREATE TABLE #AlertInfo + ( + FailSafeOperator NVARCHAR(255) , + NotificationMethod INT , + ForwardingServer NVARCHAR(255) , + ForwardingSeverity INT , + PagerToTemplate NVARCHAR(255) , + PagerCCTemplate NVARCHAR(255) , + PagerSubjectTemplate NVARCHAR(255) , + PagerSendSubjectOnly NVARCHAR(255) , + ForwardAlways INT + ); + /* Create temp table for check 2301 */ IF OBJECT_ID('tempdb..#InvalidLogins') IS NOT NULL EXEC sp_executesql N'DROP TABLE #InvalidLogins;'; @@ -315,6 +333,20 @@ AS END CATCH; END; /*Need execute on sp_validatelogins*/ + IF ISNULL(@SkipGetAlertInfo, 0) != 1 /*If @SkipGetAlertInfo hasn't been set to 1 by the caller*/ + BEGIN + BEGIN TRY + /* Try to fill the table for check 73 */ + INSERT INTO #AlertInfo + EXEC [master].[dbo].[sp_MSgetalertinfo] @includeaddresses = 0; + + SET @SkipGetAlertInfo = 0; /*We can execute sp_MSgetalertinfo*/ + END TRY + BEGIN CATCH + SET @SkipGetAlertInfo = 1; /*We have don't have execute rights or sp_MSgetalertinfo throws an error so skip it*/ + END CATCH; + END; /*Need execute on sp_MSgetalertinfo*/ + IF ISNULL(@SkipModel, 0) != 1 /*If @SkipModel hasn't been set to 1 by the caller*/ BEGIN IF EXISTS @@ -627,7 +659,7 @@ AS SELECT v.* FROM (VALUES(NULL, 211, NULL)) AS v (DatabaseName, CheckID, ServerName) /*xp_regread*/ - WHERE @SkipXPRegRead = 1; + WHERE @sa = 0; INSERT #SkipChecks (DatabaseName, CheckID, ServerName) SELECT @@ -639,7 +671,13 @@ AS SELECT v.* FROM (VALUES(NULL, 2301, NULL)) AS v (DatabaseName, CheckID, ServerName) /*sp_validatelogins*/ - WHERE @SkipValidateLogins = 1 + WHERE @SkipValidateLogins = 1; + + INSERT #SkipChecks (DatabaseName, CheckID, ServerName) + SELECT + v.* + FROM (VALUES(NULL, 73, NULL)) AS v (DatabaseName, CheckID, ServerName) /*sp_validatelogins*/ + WHERE @SkipGetAlertInfo = 1; IF @sa = 0 BEGIN @@ -840,6 +878,8 @@ AS INSERT INTO #SkipChecks (CheckID, DatabaseName) VALUES (80, 'model'); /* Max file size set */ INSERT INTO #SkipChecks (CheckID, DatabaseName) VALUES (80, 'msdb'); /* Max file size set */ INSERT INTO #SkipChecks (CheckID, DatabaseName) VALUES (80, 'tempdb'); /* Max file size set */ + INSERT INTO #SkipChecks (CheckID) VALUES (224); /* CheckID 224 - Performance - SSRS/SSAS/SSIS Installed */ + INSERT INTO #SkipChecks (CheckID) VALUES (92); /* CheckID 92 - drive space */ INSERT INTO #BlitzResults ( CheckID , Priority , @@ -1160,7 +1200,7 @@ AS IF @BringThePain = 0 AND 50 <= (SELECT COUNT(*) FROM sys.databases) AND @CheckUserDatabaseObjects = 1 BEGIN SET @CheckUserDatabaseObjects = 0; - PRINT 'Running sp_Blitz @CheckUserDatabaseObjects = 1 on a server with 50+ databases may cause temporary insanity for the server and/or user.'; + PRINT 'Running sp_Blitz @CheckUserDatabaseObjects = 1 on a server with 50+ databases may cause temporary problems for the server and/or user.'; PRINT 'If you''re sure you want to do this, run again with the parameter @BringThePain = 1.'; INSERT INTO #BlitzResults ( CheckID , @@ -3394,23 +3434,6 @@ AS IF @Debug IN (1, 2) RAISERROR('Running CheckId [%d].', 0, 1, 53) WITH NOWAIT; - --INSERT INTO #BlitzResults - -- ( CheckID , - -- Priority , - -- FindingsGroup , - -- Finding , - -- URL , - -- Details - -- ) - -- SELECT TOP 1 - -- 53 AS CheckID , - -- 200 AS Priority , - -- 'Informational' AS FindingsGroup , - -- 'Cluster Node' AS Finding , - -- 'https://BrentOzar.com/go/node' AS URL , - -- 'This is a node in a cluster.' AS Details - -- FROM sys.dm_os_cluster_nodes; - DECLARE @AOFCI AS INT, @AOAG AS INT, @HAType AS VARCHAR(10), @errmsg AS VARCHAR(200) SELECT @AOAG = CAST(SERVERPROPERTY('IsHadrEnabled') AS INT) @@ -3441,7 +3464,7 @@ AS Details ) - SELECT 53 AS CheckID , + SELECT DISTINCT 53 AS CheckID , 200 AS Priority , 'Informational' AS FindingsGroup , 'Cluster Node' AS Finding , @@ -3458,7 +3481,7 @@ AS URL , Details ) - SELECT 53 AS CheckID , + SELECT DISTINCT 53 AS CheckID , 200 AS Priority , 'Informational' AS FindingsGroup , 'Cluster Node Info' AS Finding , @@ -3484,7 +3507,7 @@ AS URL , Details ) - SELECT 53 AS CheckID , + SELECT DISTINCT 53 AS CheckID , 200 AS Priority , 'Informational' AS FindingsGroup , 'Cluster Node Info' AS Finding , @@ -3509,7 +3532,7 @@ AS URL , Details ) - SELECT 53 AS CheckID , + SELECT DISTINCT 53 AS CheckID , 200 AS Priority , 'Informational' AS FindingsGroup , 'Cluster Node Info' AS Finding , @@ -4820,6 +4843,10 @@ AS FROM sys.all_columns WHERE name = 'is_memory_optimized_elevate_to_snapshot_on' AND object_id = OBJECT_ID('sys.databases') AND SERVERPROPERTY('EngineEdition') <> 8; /* Hekaton is always enabled in Managed Instances per https://github.com/BrentOzarULTD/SQL-Server-First-Responder-Kit/issues/1919 */ + INSERT INTO #DatabaseDefaults + SELECT 'is_accelerated_database_recovery_on', 0, 145, 210, 'Acclerated Database Recovery Enabled', 'https://www.brentozar.com/go/dbdefaults', NULL + FROM sys.all_columns + WHERE name = 'is_accelerated_database_recovery_on' AND object_id = OBJECT_ID('sys.databases') AND SERVERPROPERTY('EngineEdition') NOT IN (5, 8) ; DECLARE DatabaseDefaultsLoop CURSOR FOR SELECT name, DefaultValue, CheckID, Priority, Finding, URL, Details @@ -8211,20 +8238,6 @@ IF @ProductVersionMajor >= 10 IF @Debug IN (1, 2) RAISERROR('Running CheckId [%d].', 0, 1, 73) WITH NOWAIT; - DECLARE @AlertInfo TABLE - ( - FailSafeOperator NVARCHAR(255) , - NotificationMethod INT , - ForwardingServer NVARCHAR(255) , - ForwardingSeverity INT , - PagerToTemplate NVARCHAR(255) , - PagerCCTemplate NVARCHAR(255) , - PagerSubjectTemplate NVARCHAR(255) , - PagerSendSubjectOnly NVARCHAR(255) , - ForwardAlways INT - ); - INSERT INTO @AlertInfo - EXEC [master].[dbo].[sp_MSgetalertinfo] @includeaddresses = 0; INSERT INTO #BlitzResults ( CheckID , Priority , @@ -8239,7 +8252,7 @@ IF @ProductVersionMajor >= 10 'No Failsafe Operator Configured' AS Finding , 'https://www.brentozar.com/go/failsafe' AS URL , ( 'No failsafe operator is configured on this server. This is a good idea just in-case there are issues with the [msdb] database that prevents alerting.' ) AS Details - FROM @AlertInfo + FROM #AlertInfo WHERE FailSafeOperator IS NULL; END; @@ -10046,6 +10059,11 @@ IF @ProductVersionMajor >= 10 AND NOT EXISTS ( SELECT 1 EXEC sp_executesql N'DROP TABLE #InvalidLogins;'; END; + IF OBJECT_ID('tempdb..#AlertInfo') IS NOT NULL + BEGIN + EXEC sp_executesql N'DROP TABLE #AlertInfo;'; + END; + /* Reset the Nmumeric_RoundAbort session state back to enabled if it was disabled earlier. See Github issue #2302 for more info. @@ -10105,7 +10123,7 @@ AS SET NOCOUNT ON; SET STATISTICS XML OFF; -SELECT @Version = '8.18', @VersionDate = '20231222'; +SELECT @Version = '8.19', @VersionDate = '20240222'; IF(@VersionCheckMode = 1) BEGIN @@ -10983,7 +11001,7 @@ AS SET STATISTICS XML OFF; SET TRANSACTION ISOLATION LEVEL READ UNCOMMITTED; - SELECT @Version = '8.18', @VersionDate = '20231222'; + SELECT @Version = '8.19', @VersionDate = '20240222'; IF(@VersionCheckMode = 1) BEGIN @@ -12765,7 +12783,7 @@ SET NOCOUNT ON; SET STATISTICS XML OFF; SET TRANSACTION ISOLATION LEVEL READ UNCOMMITTED; -SELECT @Version = '8.18', @VersionDate = '20231222'; +SELECT @Version = '8.19', @VersionDate = '20240222'; SET @OutputType = UPPER(@OutputType); IF(@VersionCheckMode = 1) @@ -12952,7 +12970,7 @@ IF @Help = 1 UNION ALL SELECT N'@MinutesBack', N'INT', - N'How many minutes back to begin plan cache analysis. If you put in a positive number, we''ll flip it to negtive.'; + N'How many minutes back to begin plan cache analysis. If you put in a positive number, we''ll flip it to negative.'; /* Column definitions */ @@ -20124,7 +20142,7 @@ SET NOCOUNT ON; SET STATISTICS XML OFF; SET TRANSACTION ISOLATION LEVEL READ UNCOMMITTED; -SELECT @Version = '8.18', @VersionDate = '20231222'; +SELECT @Version = '8.19', @VersionDate = '20240222'; SET @OutputType = UPPER(@OutputType); IF(@VersionCheckMode = 1) @@ -20153,7 +20171,7 @@ Known limitations of this version: filegroup/partition scheme etc.) -- (The compression and filegroup index create syntax is not trivial because it is set at the partition level and is not trivial to code.) - - Does not advise you about data modeling for clustered indexes and primary keys (primarily looks for signs of insanity.) + - Does not advise you about data modeling for clustered indexes and primary keys (primarily looks for signs of problems.) Unknown limitations of this version: - We knew them once, but we forgot. @@ -20329,9 +20347,14 @@ IF OBJECT_ID('tempdb..#CheckConstraints') IS NOT NULL IF OBJECT_ID('tempdb..#FilteredIndexes') IS NOT NULL DROP TABLE #FilteredIndexes; - + IF OBJECT_ID('tempdb..#Ignore_Databases') IS NOT NULL DROP TABLE #Ignore_Databases + +IF OBJECT_ID('tempdb..#dm_db_partition_stats_etc') IS NOT NULL + DROP TABLE #dm_db_partition_stats_etc +IF OBJECT_ID('tempdb..#dm_db_index_operational_stats') IS NOT NULL + DROP TABLE #dm_db_index_operational_stats RAISERROR (N'Create temp tables.',0,1) WITH NOWAIT; CREATE TABLE #BlitzIndexResults @@ -20995,7 +21018,7 @@ BEGIN TRY VALUES ( 1, 0, N'You''re trying to run sp_BlitzIndex on a server with ' + CAST(@NumDatabases AS NVARCHAR(8)) + N' databases. ', - N'Running sp_BlitzIndex on a server with 50+ databases may cause temporary insanity for the server and/or user.', + N'Running sp_BlitzIndex on a server with 50+ databases may cause temporary problems for the server and/or user.', N'If you''re sure you want to do this, run again with the parameter @BringThePain = 1.', 'http://FirstResponderKit.org', '', @@ -21022,7 +21045,7 @@ BEGIN TRY bir.create_tsql, bir.more_info FROM #BlitzIndexResults AS bir; - RAISERROR('Running sp_BlitzIndex on a server with 50+ databases may cause temporary insanity for the server', 12, 1); + RAISERROR('Running sp_BlitzIndex on a server with 50+ databases may cause temporary problems for the server', 12, 1); END; RETURN; @@ -21141,6 +21164,8 @@ FROM sys.databases ---------------------------------------- BEGIN TRY BEGIN + DECLARE @d VARCHAR(19) = CONVERT(VARCHAR(19), GETDATE(), 121); + RAISERROR (N'starting at %s',0,1, @d) WITH NOWAIT; --Validate SQL Server Version @@ -21511,47 +21536,79 @@ BEGIN TRY --NOTE: If you want to use the newer syntax for 2012+, you'll have to change 2147483647 to 11 on line ~819 --This change was made because on a table with lots of paritions, the OUTER APPLY was crazy slow. - SET @dsql = N'SET TRANSACTION ISOLATION LEVEL READ UNCOMMITTED; + + -- get relevant columns from sys.dm_db_partition_stats, sys.partitions and sys.objects + DROP TABLE if exists #dm_db_partition_stats_etc + create table #dm_db_partition_stats_etc + ( + database_id smallint not null + , object_id int not null + , sname sysname NULL + , index_id int + , partition_number int + , partition_id bigint + , row_count bigint + , reserved_MB bigint + , reserved_LOB_MB bigint + , reserved_row_overflow_MB bigint + , lock_escalation_desc nvarchar(60) + , data_compression_desc nvarchar(60) + ) + + -- get relevant info from sys.dm_db_index_operational_stats + drop TABLE if exists #dm_db_index_operational_stats + create table #dm_db_index_operational_stats + ( + database_id smallint not null + , object_id int not null + , index_id int + , partition_number int + , hobt_id bigint + , leaf_insert_count bigint + , leaf_delete_count bigint + , leaf_update_count bigint + , range_scan_count bigint + , singleton_lookup_count bigint + , forwarded_fetch_count bigint + , lob_fetch_in_pages bigint + , lob_fetch_in_bytes bigint + , row_overflow_fetch_in_pages bigint + , row_overflow_fetch_in_bytes bigint + , row_lock_count bigint + , row_lock_wait_count bigint + , row_lock_wait_in_ms bigint + , page_lock_count bigint + , page_lock_wait_count bigint + , page_lock_wait_in_ms bigint + , index_lock_promotion_attempt_count bigint + , index_lock_promotion_count bigint + , page_latch_wait_count bigint + , page_latch_wait_in_ms bigint + , page_io_latch_wait_count bigint + , page_io_latch_wait_in_ms bigint + ) + + SET @dsql = N' + DECLARE @d VARCHAR(19) = CONVERT(VARCHAR(19), GETDATE(), 121) + RAISERROR (N''start getting data into #dm_db_partition_stats_etc at %s'',0,1, @d) WITH NOWAIT; + SET TRANSACTION ISOLATION LEVEL READ UNCOMMITTED; + INSERT INTO #dm_db_partition_stats_etc + ( + database_id, object_id, sname, index_id, partition_number, partition_id, row_count, reserved_MB, reserved_LOB_MB, reserved_row_overflow_MB, lock_escalation_desc, data_compression_desc + ) SELECT ' + CAST(@DatabaseID AS NVARCHAR(10)) + N' AS database_id, ps.object_id, - s.name, + s.name as sname, ps.index_id, ps.partition_number, + ps.partition_id, ps.row_count, ps.reserved_page_count * 8. / 1024. AS reserved_MB, ps.lob_reserved_page_count * 8. / 1024. AS reserved_LOB_MB, ps.row_overflow_reserved_page_count * 8. / 1024. AS reserved_row_overflow_MB, le.lock_escalation_desc, - ' + CASE WHEN @SQLServerProductVersion NOT LIKE '9%' THEN N'par.data_compression_desc ' ELSE N'null as data_compression_desc ' END + N', - SUM(os.leaf_insert_count), - SUM(os.leaf_delete_count), - SUM(os.leaf_update_count), - SUM(os.range_scan_count), - SUM(os.singleton_lookup_count), - SUM(os.forwarded_fetch_count), - SUM(os.lob_fetch_in_pages), - SUM(os.lob_fetch_in_bytes), - SUM(os.row_overflow_fetch_in_pages), - SUM(os.row_overflow_fetch_in_bytes), - SUM(os.row_lock_count), - SUM(os.row_lock_wait_count), - SUM(os.row_lock_wait_in_ms), - SUM(os.page_lock_count), - SUM(os.page_lock_wait_count), - SUM(os.page_lock_wait_in_ms), - SUM(os.index_lock_promotion_attempt_count), - SUM(os.index_lock_promotion_count), - SUM(os.page_latch_wait_count), - SUM(os.page_latch_wait_in_ms), - SUM(os.page_io_latch_wait_count), - SUM(os.page_io_latch_wait_in_ms), '; - - /* Get columnstore dictionary size - more info: https://github.com/BrentOzarULTD/SQL-Server-First-Responder-Kit/issues/2585 */ - IF EXISTS (SELECT * FROM sys.all_objects WHERE name = 'column_store_dictionaries') - SET @dsql = @dsql + N' COALESCE((SELECT SUM (on_disk_size / 1024.0 / 1024) FROM ' + QUOTENAME(@DatabaseName) + N'.sys.column_store_dictionaries dict WHERE dict.partition_id = ps.partition_id),0) AS reserved_dictionary_MB '; - ELSE - SET @dsql = @dsql + N' 0 AS reserved_dictionary_MB '; - + ' + CASE WHEN @SQLServerProductVersion NOT LIKE '9%' THEN N'par.data_compression_desc ' ELSE N'null as data_compression_desc ' END + N' +'; SET @dsql = @dsql + N' FROM ' + QUOTENAME(@DatabaseName) + N'.sys.dm_db_partition_stats AS ps @@ -21560,9 +21617,6 @@ BEGIN TRY AND so.is_ms_shipped = 0 /*Exclude objects shipped by Microsoft*/ AND so.type <> ''TF'' /*Exclude table valued functions*/ JOIN ' + QUOTENAME(@DatabaseName) + N'.sys.schemas AS s ON s.schema_id = so.schema_id - LEFT JOIN ' + QUOTENAME(@DatabaseName) + N'.sys.dm_db_index_operational_stats(' - + CAST(@DatabaseID AS NVARCHAR(10)) + N', NULL, NULL,NULL) AS os ON - ps.object_id=os.object_id and ps.index_id=os.index_id and ps.partition_number=os.partition_number OUTER APPLY (SELECT st.lock_escalation_desc FROM ' + QUOTENAME(@DatabaseName) + N'.sys.tables st WHERE st.object_id = ps.object_id @@ -21582,7 +21636,75 @@ BEGIN TRY le.lock_escalation_desc, ' + CASE WHEN @SQLServerProductVersion NOT LIKE '9%' THEN N'par.data_compression_desc ' ELSE N'null as data_compression_desc ' END + N' ORDER BY ps.object_id, ps.index_id, ps.partition_number - OPTION ( RECOMPILE ); + /*OPTION ( RECOMPILE );*/ + OPTION ( RECOMPILE , min_grant_percent = 1); + + SET @d = CONVERT(VARCHAR(19), GETDATE(), 121) + RAISERROR (N''start getting data into #dm_db_index_operational_stats at %s.'',0,1, @d) WITH NOWAIT; + + insert into #dm_db_index_operational_stats + ( + database_id + , object_id + , index_id + , partition_number + , hobt_id + , leaf_insert_count + , leaf_delete_count + , leaf_update_count + , range_scan_count + , singleton_lookup_count + , forwarded_fetch_count + , lob_fetch_in_pages + , lob_fetch_in_bytes + , row_overflow_fetch_in_pages + , row_overflow_fetch_in_bytes + , row_lock_count + , row_lock_wait_count + , row_lock_wait_in_ms + , page_lock_count + , page_lock_wait_count + , page_lock_wait_in_ms + , index_lock_promotion_attempt_count + , index_lock_promotion_count + , page_latch_wait_count + , page_latch_wait_in_ms + , page_io_latch_wait_count + , page_io_latch_wait_in_ms + ) + + select os.database_id + , os.object_id + , os.index_id + , os.partition_number + , os.hobt_id + , os.leaf_insert_count + , os.leaf_delete_count + , os.leaf_update_count + , os.range_scan_count + , os.singleton_lookup_count + , os.forwarded_fetch_count + , os.lob_fetch_in_pages + , os.lob_fetch_in_bytes + , os.row_overflow_fetch_in_pages + , os.row_overflow_fetch_in_bytes + , os.row_lock_count + , os.row_lock_wait_count + , os.row_lock_wait_in_ms + , os.page_lock_count + , os.page_lock_wait_count + , os.page_lock_wait_in_ms + , os.index_lock_promotion_attempt_count + , os.index_lock_promotion_count + , os.page_latch_wait_count + , os.page_latch_wait_in_ms + , os.page_io_latch_wait_count + , os.page_io_latch_wait_in_ms + from ' + QUOTENAME(@DatabaseName) + N'.sys.dm_db_index_operational_stats('+ CAST(@DatabaseID AS NVARCHAR(10)) +', NULL, NULL,NULL) AS os + OPTION ( RECOMPILE , min_grant_percent = 1); + + SET @d = CONVERT(VARCHAR(19), GETDATE(), 121) + RAISERROR (N''finished getting data into #dm_db_index_operational_stats at %s.'',0,1, @d) WITH NOWAIT; '; END; ELSE @@ -21681,6 +21803,7 @@ BEGIN TRY PRINT SUBSTRING(@dsql, 32000, 36000); PRINT SUBSTRING(@dsql, 36000, 40000); END; + EXEC sp_executesql @dsql; INSERT #IndexPartitionSanity ( [database_id], [object_id], [schema_name], @@ -21715,8 +21838,35 @@ BEGIN TRY page_io_latch_wait_count, page_io_latch_wait_in_ms, reserved_dictionary_MB) - EXEC sp_executesql @dsql; - + select h.database_id, h.object_id, h.sname, h.index_id, h.partition_number, h.row_count, h.reserved_MB, h.reserved_LOB_MB, h.reserved_row_overflow_MB, h.lock_escalation_desc, h.data_compression_desc, + SUM(os.leaf_insert_count), + SUM(os.leaf_delete_count), + SUM(os.leaf_update_count), + SUM(os.range_scan_count), + SUM(os.singleton_lookup_count), + SUM(os.forwarded_fetch_count), + SUM(os.lob_fetch_in_pages), + SUM(os.lob_fetch_in_bytes), + SUM(os.row_overflow_fetch_in_pages), + SUM(os.row_overflow_fetch_in_bytes), + SUM(os.row_lock_count), + SUM(os.row_lock_wait_count), + SUM(os.row_lock_wait_in_ms), + SUM(os.page_lock_count), + SUM(os.page_lock_wait_count), + SUM(os.page_lock_wait_in_ms), + SUM(os.index_lock_promotion_attempt_count), + SUM(os.index_lock_promotion_count), + SUM(os.page_latch_wait_count), + SUM(os.page_latch_wait_in_ms), + SUM(os.page_io_latch_wait_count), + SUM(os.page_io_latch_wait_in_ms) + ,COALESCE((SELECT SUM (dict.on_disk_size / 1024.0 / 1024) FROM sys.column_store_dictionaries dict WHERE dict.partition_id = h.partition_id),0) AS reserved_dictionary_MB + from #dm_db_partition_stats_etc h + left JOIN #dm_db_index_operational_stats as os ON + h.object_id=os.object_id and h.index_id=os.index_id and h.partition_number=os.partition_number + group by h.database_id, h.object_id, h.sname, h.index_id, h.partition_number, h.partition_id, h.row_count, h.reserved_MB, h.reserved_LOB_MB, h.reserved_row_overflow_MB, h.lock_escalation_desc, h.data_compression_desc + END; --End Check For @SkipPartitions = 0 @@ -23067,7 +23217,7 @@ BEGIN INNER JOIN ' + QUOTENAME(@DatabaseName) + N'.sys.columns c ON rg.object_id = c.object_id INNER JOIN ' + QUOTENAME(@DatabaseName) + N'.sys.partitions p ON rg.object_id = p.object_id AND rg.partition_number = p.partition_number INNER JOIN ' + QUOTENAME(@DatabaseName) + N'.sys.index_columns ic on ic.column_id = c.column_id AND ic.object_id = c.object_id AND ic.index_id = p.index_id - LEFT OUTER JOIN ' + QUOTENAME(@DatabaseName) + N'.sys.dm_db_column_store_row_group_physical_stats phys ON rg.row_group_id = phys.row_group_id AND rg.object_id = phys.object_id AND rg.partition_number = phys.partition_number AND p.index_id = phys.index_id ' + CASE WHEN @ShowPartitionRanges = 1 THEN N' + LEFT OUTER JOIN ' + QUOTENAME(@DatabaseName) + N'.sys.dm_db_column_store_row_group_physical_stats phys ON rg.row_group_id = phys.row_group_id AND rg.object_id = phys.object_id AND rg.partition_number = phys.partition_number AND rg.index_id = phys.index_id ' + CASE WHEN @ShowPartitionRanges = 1 THEN N' LEFT OUTER JOIN ' + QUOTENAME(@DatabaseName) + N'.sys.indexes i ON i.object_id = rg.object_id AND i.index_id = rg.index_id LEFT OUTER JOIN ' + QUOTENAME(@DatabaseName) + N'.sys.partition_schemes ps ON ps.data_space_id = i.data_space_id LEFT OUTER JOIN ' + QUOTENAME(@DatabaseName) + N'.sys.partition_functions pf ON pf.function_id = ps.function_id @@ -26254,7 +26404,8 @@ BEGIN END; /* End @Mode=3 (index detail)*/ - + SET @d = CONVERT(VARCHAR(19), GETDATE(), 121); + RAISERROR (N'finishing at %s',0,1, @d) WITH NOWAIT; END /* End @TableName IS NULL (mode 0/1/2/3/4) */ END TRY @@ -26312,7 +26463,7 @@ BEGIN SET XACT_ABORT OFF; SET TRANSACTION ISOLATION LEVEL READ UNCOMMITTED; - SELECT @Version = '8.18', @VersionDate = '20231222'; + SELECT @Version = '8.19', @VersionDate = '20240222'; IF @VersionCheckMode = 1 BEGIN @@ -30467,7 +30618,7 @@ SET NOCOUNT ON; SET STATISTICS XML OFF; SET TRANSACTION ISOLATION LEVEL READ UNCOMMITTED; -SELECT @Version = '8.18', @VersionDate = '20231222'; +SELECT @Version = '8.19', @VersionDate = '20240222'; IF(@VersionCheckMode = 1) BEGIN RETURN; @@ -36516,7 +36667,7 @@ BEGIN SET STATISTICS XML OFF; SET TRANSACTION ISOLATION LEVEL READ UNCOMMITTED; - SELECT @Version = '8.18', @VersionDate = '20231222'; + SELECT @Version = '8.19', @VersionDate = '20240222'; IF(@VersionCheckMode = 1) BEGIN @@ -37912,6 +38063,8 @@ DELETE FROM dbo.SqlServerVersions; INSERT INTO dbo.SqlServerVersions (MajorVersionNumber, MinorVersionNumber, Branch, [Url], ReleaseDate, MainstreamSupportEndDate, ExtendedSupportEndDate, MajorVersionName, MinorVersionName) VALUES + (16, 4105, 'CU11', 'https://support.microsoft.com/en-us/help/5032679', '2024-01-11', '2028-01-11', '2033-01-11', 'SQL Server 2022', 'Cumulative Update 11'), + (16, 4100, 'CU10 GDR', 'https://support.microsoft.com/en-us/help/5033592', '2024-01-09', '2028-01-11', '2033-01-11', 'SQL Server 2022', 'Cumulative Update 10 GDR'), (16, 4095, 'CU10', 'https://support.microsoft.com/en-us/help/5031778', '2023-11-16', '2028-01-11', '2033-01-11', 'SQL Server 2022', 'Cumulative Update 10'), (16, 4085, 'CU9', 'https://support.microsoft.com/en-us/help/5030731', '2023-10-12', '2028-01-11', '2033-01-11', 'SQL Server 2022', 'Cumulative Update 9'), (16, 4075, 'CU8', 'https://support.microsoft.com/en-us/help/5029666', '2023-09-14', '2028-01-11', '2033-01-11', 'SQL Server 2022', 'Cumulative Update 8'), @@ -37924,6 +38077,7 @@ VALUES (16, 4003, 'CU1', 'https://support.microsoft.com/en-us/help/5022375', '2023-02-16', '2028-01-11', '2033-01-11', 'SQL Server 2022', 'Cumulative Update 1'), (16, 1050, 'RTM GDR', 'https://support.microsoft.com/kb/5021522', '2023-02-14', '2028-01-11', '2033-01-11', 'SQL Server 2022 GDR', 'RTM'), (16, 1000, 'RTM', '', '2022-11-15', '2028-01-11', '2033-01-11', 'SQL Server 2022', 'RTM'), + (15, 4355, 'CU25', 'https://support.microsoft.com/kb/5033688', '2023-02-15', '2025-01-07', '2030-01-08', 'SQL Server 2019', 'Cumulative Update 25'), (15, 4345, 'CU24', 'https://support.microsoft.com/kb/5031908', '2023-12-14', '2025-01-07', '2030-01-08', 'SQL Server 2019', 'Cumulative Update 24'), (15, 4335, 'CU23', 'https://support.microsoft.com/kb/5030333', '2023-10-12', '2025-01-07', '2030-01-08', 'SQL Server 2019', 'Cumulative Update 23'), (15, 4322, 'CU22', 'https://support.microsoft.com/kb/5027702', '2023-08-14', '2025-01-07', '2030-01-08', 'SQL Server 2019', 'Cumulative Update 22'), @@ -38351,7 +38505,7 @@ SET NOCOUNT ON; SET STATISTICS XML OFF; SET TRANSACTION ISOLATION LEVEL READ UNCOMMITTED; -SELECT @Version = '8.18', @VersionDate = '20231222'; +SELECT @Version = '8.19', @VersionDate = '20240222'; IF(@VersionCheckMode = 1) BEGIN diff --git a/sp_AllNightLog.sql b/sp_AllNightLog.sql index 1e7b1ddd..e886de70 100644 --- a/sp_AllNightLog.sql +++ b/sp_AllNightLog.sql @@ -31,7 +31,7 @@ SET STATISTICS XML OFF; BEGIN; -SELECT @Version = '8.18', @VersionDate = '20231222'; +SELECT @Version = '8.19', @VersionDate = '20240222'; IF(@VersionCheckMode = 1) BEGIN diff --git a/sp_AllNightLog_Setup.sql b/sp_AllNightLog_Setup.sql index 8238c897..0925414d 100644 --- a/sp_AllNightLog_Setup.sql +++ b/sp_AllNightLog_Setup.sql @@ -38,7 +38,7 @@ SET STATISTICS XML OFF; BEGIN; -SELECT @Version = '8.18', @VersionDate = '20231222'; +SELECT @Version = '8.19', @VersionDate = '20240222'; IF(@VersionCheckMode = 1) BEGIN diff --git a/sp_Blitz.sql b/sp_Blitz.sql index 9c3069b0..b1304b84 100644 --- a/sp_Blitz.sql +++ b/sp_Blitz.sql @@ -38,7 +38,7 @@ AS SET TRANSACTION ISOLATION LEVEL READ UNCOMMITTED; - SELECT @Version = '8.18', @VersionDate = '20231222'; + SELECT @Version = '8.19', @VersionDate = '20240222'; SET @OutputType = UPPER(@OutputType); IF(@VersionCheckMode = 1) diff --git a/sp_BlitzAnalysis.sql b/sp_BlitzAnalysis.sql index f96c56b9..52256e65 100644 --- a/sp_BlitzAnalysis.sql +++ b/sp_BlitzAnalysis.sql @@ -37,7 +37,7 @@ AS SET NOCOUNT ON; SET STATISTICS XML OFF; -SELECT @Version = '8.18', @VersionDate = '20231222'; +SELECT @Version = '8.19', @VersionDate = '20240222'; IF(@VersionCheckMode = 1) BEGIN diff --git a/sp_BlitzBackups.sql b/sp_BlitzBackups.sql index b11b48d2..8fc7fa29 100755 --- a/sp_BlitzBackups.sql +++ b/sp_BlitzBackups.sql @@ -24,7 +24,7 @@ AS SET STATISTICS XML OFF; SET TRANSACTION ISOLATION LEVEL READ UNCOMMITTED; - SELECT @Version = '8.18', @VersionDate = '20231222'; + SELECT @Version = '8.19', @VersionDate = '20240222'; IF(@VersionCheckMode = 1) BEGIN diff --git a/sp_BlitzCache.sql b/sp_BlitzCache.sql index 3279e178..4b5ec1a4 100644 --- a/sp_BlitzCache.sql +++ b/sp_BlitzCache.sql @@ -281,7 +281,7 @@ SET NOCOUNT ON; SET STATISTICS XML OFF; SET TRANSACTION ISOLATION LEVEL READ UNCOMMITTED; -SELECT @Version = '8.18', @VersionDate = '20231222'; +SELECT @Version = '8.19', @VersionDate = '20240222'; SET @OutputType = UPPER(@OutputType); IF(@VersionCheckMode = 1) diff --git a/sp_BlitzFirst.sql b/sp_BlitzFirst.sql index 3b1624e6..fed15f31 100644 --- a/sp_BlitzFirst.sql +++ b/sp_BlitzFirst.sql @@ -47,7 +47,7 @@ SET NOCOUNT ON; SET STATISTICS XML OFF; SET TRANSACTION ISOLATION LEVEL READ UNCOMMITTED; -SELECT @Version = '8.18', @VersionDate = '20231222'; +SELECT @Version = '8.19', @VersionDate = '20240222'; IF(@VersionCheckMode = 1) BEGIN diff --git a/sp_BlitzInMemoryOLTP.sql b/sp_BlitzInMemoryOLTP.sql index fc56a3cc..fd622d9f 100644 --- a/sp_BlitzInMemoryOLTP.sql +++ b/sp_BlitzInMemoryOLTP.sql @@ -82,7 +82,7 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI */ AS DECLARE @ScriptVersion VARCHAR(30); -SELECT @ScriptVersion = '1.8', @VersionDate = '20231222'; +SELECT @ScriptVersion = '1.8', @VersionDate = '20240222'; IF(@VersionCheckMode = 1) BEGIN diff --git a/sp_BlitzIndex.sql b/sp_BlitzIndex.sql index a3409527..131c3155 100644 --- a/sp_BlitzIndex.sql +++ b/sp_BlitzIndex.sql @@ -48,7 +48,7 @@ SET NOCOUNT ON; SET STATISTICS XML OFF; SET TRANSACTION ISOLATION LEVEL READ UNCOMMITTED; -SELECT @Version = '8.18', @VersionDate = '20231222'; +SELECT @Version = '8.19', @VersionDate = '20240222'; SET @OutputType = UPPER(@OutputType); IF(@VersionCheckMode = 1) diff --git a/sp_BlitzLock.sql b/sp_BlitzLock.sql index 848a324c..313887b9 100644 --- a/sp_BlitzLock.sql +++ b/sp_BlitzLock.sql @@ -36,7 +36,7 @@ BEGIN SET XACT_ABORT OFF; SET TRANSACTION ISOLATION LEVEL READ UNCOMMITTED; - SELECT @Version = '8.18', @VersionDate = '20231222'; + SELECT @Version = '8.19', @VersionDate = '20240222'; IF @VersionCheckMode = 1 BEGIN diff --git a/sp_BlitzQueryStore.sql b/sp_BlitzQueryStore.sql index 084e988f..991a7dec 100644 --- a/sp_BlitzQueryStore.sql +++ b/sp_BlitzQueryStore.sql @@ -57,7 +57,7 @@ SET NOCOUNT ON; SET STATISTICS XML OFF; SET TRANSACTION ISOLATION LEVEL READ UNCOMMITTED; -SELECT @Version = '8.18', @VersionDate = '20231222'; +SELECT @Version = '8.19', @VersionDate = '20240222'; IF(@VersionCheckMode = 1) BEGIN RETURN; diff --git a/sp_BlitzWho.sql b/sp_BlitzWho.sql index d623706c..a6728be9 100644 --- a/sp_BlitzWho.sql +++ b/sp_BlitzWho.sql @@ -33,7 +33,7 @@ BEGIN SET STATISTICS XML OFF; SET TRANSACTION ISOLATION LEVEL READ UNCOMMITTED; - SELECT @Version = '8.18', @VersionDate = '20231222'; + SELECT @Version = '8.19', @VersionDate = '20240222'; IF(@VersionCheckMode = 1) BEGIN diff --git a/sp_DatabaseRestore.sql b/sp_DatabaseRestore.sql index 0f16b614..43805aee 100755 --- a/sp_DatabaseRestore.sql +++ b/sp_DatabaseRestore.sql @@ -47,7 +47,7 @@ SET STATISTICS XML OFF; /*Versioning details*/ -SELECT @Version = '8.18', @VersionDate = '20231222'; +SELECT @Version = '8.19', @VersionDate = '20240222'; IF(@VersionCheckMode = 1) BEGIN diff --git a/sp_ineachdb.sql b/sp_ineachdb.sql index 9cf874ba..06c84e07 100644 --- a/sp_ineachdb.sql +++ b/sp_ineachdb.sql @@ -36,7 +36,7 @@ BEGIN SET NOCOUNT ON; SET STATISTICS XML OFF; - SELECT @Version = '8.18', @VersionDate = '20231222'; + SELECT @Version = '8.19', @VersionDate = '20240222'; IF(@VersionCheckMode = 1) BEGIN