3838 SET TRANSACTION ISOLATION LEVEL READ UNCOMMITTED;
3939
4040
41- SELECT @Version = '8.14 ', @VersionDate = '20230420 ';
41+ SELECT @Version = '8.15 ', @VersionDate = '20230613 ';
4242 SET @OutputType = UPPER(@OutputType);
4343
4444 IF(@VersionCheckMode = 1)
12651265 db_name(dek.database_id) AS DatabaseName,
12661266 ''https://www.brentozar.com/go/tde'' AS URL,
12671267 ''The certificate '' + c.name + '' is used to encrypt database '' + db_name(dek.database_id) + ''. Last backup date: '' + COALESCE(CAST(c.pvt_key_last_backup_date AS VARCHAR(100)), ''Never'') AS Details
1268- FROM sys.certificates c INNER JOIN sys.dm_database_encryption_keys dek ON c.thumbprint = dek.encryptor_thumbprint
1268+ FROM master. sys.certificates c INNER JOIN sys.dm_database_encryption_keys dek ON c.thumbprint = dek.encryptor_thumbprint
12691269 WHERE pvt_key_last_backup_date IS NULL OR pvt_key_last_backup_date <= DATEADD(dd, -30, GETDATE()) OPTION (RECOMPILE);';
12701270
12711271 IF @Debug = 2 AND @StringToExecute IS NOT NULL PRINT @StringToExecute;
38793879
38803880 IF (@ProductVersionMajor = 15 AND @ProductVersionMinor < 2000) OR
38813881 (@ProductVersionMajor = 14 AND @ProductVersionMinor < 1000) OR
3882- (@ProductVersionMajor = 13 AND @ProductVersionMinor < 5026 ) OR
3882+ (@ProductVersionMajor = 13 AND @ProductVersionMinor < 6300 ) OR
38833883 (@ProductVersionMajor = 12 AND @ProductVersionMinor < 6024) OR
3884- (@ProductVersionMajor = 11 AND @ProductVersionMinor < 7001) OR
3884+ (@ProductVersionMajor = 11 /* AND @ProductVersionMinor < 7001)*/ ) OR
38853885 (@ProductVersionMajor = 10.5 /*AND @ProductVersionMinor < 6000*/) OR
38863886 (@ProductVersionMajor = 10 /*AND @ProductVersionMinor < 6000*/) OR
38873887 (@ProductVersionMajor = 9 /*AND @ProductVersionMinor <= 5000*/)
38923892 INSERT INTO #BlitzResults(CheckID, Priority, FindingsGroup, Finding, URL, Details)
38933893 VALUES(128, 20, 'Reliability', 'Unsupported Build of SQL Server', 'https://www.brentozar.com/go/unsupported',
38943894 'Version ' + CAST(@ProductVersionMajor AS VARCHAR(100)) +
3895- CASE WHEN @ProductVersionMajor >= 11 THEN
3895+ CASE WHEN @ProductVersionMajor >= 12 THEN
38963896 '.' + CAST(@ProductVersionMinor AS VARCHAR(100)) + ' is no longer supported by Microsoft. You need to apply a service pack.'
38973897 ELSE ' is no longer supported by Microsoft. You should be making plans to upgrade to a modern version of SQL Server.' END);
38983898 END;
97379737SET NOCOUNT ON;
97389738SET STATISTICS XML OFF;
97399739
9740- SELECT @Version = '8.14 ', @VersionDate = '20230420 ';
9740+ SELECT @Version = '8.15 ', @VersionDate = '20230613 ';
97419741
97429742IF(@VersionCheckMode = 1)
97439743BEGIN
@@ -10615,7 +10615,7 @@ AS
1061510615 SET STATISTICS XML OFF;
1061610616 SET TRANSACTION ISOLATION LEVEL READ UNCOMMITTED;
1061710617
10618- SELECT @Version = '8.14 ', @VersionDate = '20230420 ';
10618+ SELECT @Version = '8.15 ', @VersionDate = '20230613 ';
1061910619
1062010620 IF(@VersionCheckMode = 1)
1062110621 BEGIN
@@ -12397,7 +12397,7 @@ SET NOCOUNT ON;
1239712397SET STATISTICS XML OFF;
1239812398SET TRANSACTION ISOLATION LEVEL READ UNCOMMITTED;
1239912399
12400- SELECT @Version = '8.14 ', @VersionDate = '20230420 ';
12400+ SELECT @Version = '8.15 ', @VersionDate = '20230613 ';
1240112401SET @OutputType = UPPER(@OutputType);
1240212402
1240312403IF(@VersionCheckMode = 1)
@@ -19715,7 +19715,7 @@ SET NOCOUNT ON;
1971519715SET STATISTICS XML OFF;
1971619716SET TRANSACTION ISOLATION LEVEL READ UNCOMMITTED;
1971719717
19718- SELECT @Version = '8.14 ', @VersionDate = '20230420 ';
19718+ SELECT @Version = '8.15 ', @VersionDate = '20230613 ';
1971919719SET @OutputType = UPPER(@OutputType);
1972019720
1972119721IF(@VersionCheckMode = 1)
@@ -25892,7 +25892,7 @@ BEGIN
2589225892 SET NOCOUNT, XACT_ABORT ON;
2589325893 SET TRANSACTION ISOLATION LEVEL READ UNCOMMITTED;
2589425894
25895- SELECT @Version = '8.14 ', @VersionDate = '20230420 ';
25895+ SELECT @Version = '8.15 ', @VersionDate = '20230613 ';
2589625896
2589725897 IF @VersionCheckMode = 1
2589825898 BEGIN
@@ -26007,8 +26007,12 @@ BEGIN
2600726007 WHEN
2600826008 (
2600926009 SELECT
26010- SERVERPROPERTY('EDITION')
26011- ) = 'SQL Azure'
26010+ CONVERT
26011+ (
26012+ integer,
26013+ SERVERPROPERTY('EngineEdition')
26014+ )
26015+ ) = 5
2601226016 THEN 1
2601326017 ELSE 0
2601426018 END,
@@ -26236,7 +26240,7 @@ BEGIN
2623626240 /*Add wait_resource column*/
2623726241 ALTER TABLE ' +
2623826242 @ObjectFullName +
26239- N' ADD client_option_1 nvarchar(8000 ) NULL;';
26243+ N' ADD client_option_1 varchar(500 ) NULL;';
2624026244
2624126245 IF @Debug = 1 BEGIN PRINT @StringToExecute; END;
2624226246 EXEC sys.sp_executesql
@@ -26252,7 +26256,7 @@ BEGIN
2625226256 /*Add wait_resource column*/
2625326257 ALTER TABLE ' +
2625426258 @ObjectFullName +
26255- N' ADD client_option_2 nvarchar(8000 ) NULL;';
26259+ N' ADD client_option_2 varchar(500 ) NULL;';
2625626260
2625726261 IF @Debug = 1 BEGIN PRINT @StringToExecute; END;
2625826262 EXEC sys.sp_executesql
@@ -26315,8 +26319,8 @@ BEGIN
2631526319 waiter_mode nvarchar(256),
2631626320 lock_mode nvarchar(256),
2631726321 transaction_count bigint,
26318- client_option_1 varchar(2000 ),
26319- client_option_2 varchar(2000 ),
26322+ client_option_1 varchar(500 ),
26323+ client_option_2 varchar(500 ),
2632026324 login_name nvarchar(256),
2632126325 host_name nvarchar(256),
2632226326 client_app nvarchar(1024),
@@ -26702,7 +26706,12 @@ BEGIN
2670226706 LEFT JOIN #t AS t
2670326707 ON 1 = 1
2670426708 CROSS APPLY x.x.nodes('/RingBufferTarget/event') AS e(x)
26705- WHERE e.x.exist('@name[ .= "xml_deadlock_report"]') = 1
26709+ WHERE
26710+ (
26711+ e.x.exist('@name[ .= "xml_deadlock_report"]') = 1
26712+ OR e.x.exist('@name[ .= "database_xml_deadlock_report"]') = 1
26713+ OR e.x.exist('@name[ .= "xml_deadlock_report_filtered"]') = 1
26714+ )
2670626715 AND e.x.exist('@timestamp[. >= sql:variable("@StartDate")]') = 1
2670726716 AND e.x.exist('@timestamp[. < sql:variable("@EndDate")]') = 1
2670826717 OPTION(RECOMPILE);
@@ -26721,7 +26730,9 @@ BEGIN
2672126730 SET @d = CONVERT(varchar(40), GETDATE(), 109);
2672226731 RAISERROR('Inserting to #deadlock_data for event file data', 0, 1) WITH NOWAIT;
2672326732
26724- INSERT
26733+ IF @Debug = 1 BEGIN SET STATISTICS XML ON; END;
26734+
26735+ INSERT
2672526736 #deadlock_data WITH(TABLOCKX)
2672626737 (
2672726738 deadlock_xml
@@ -26733,12 +26744,19 @@ BEGIN
2673326744 LEFT JOIN #t AS t
2673426745 ON 1 = 1
2673526746 CROSS APPLY x.x.nodes('/event') AS e(x)
26736- WHERE e.x.exist('/event/@name[ .= "xml_deadlock_report"]') = 1
26737- AND e.x.exist('/event/@timestamp[. >= sql:variable("@StartDate")]') = 1
26738- AND e.x.exist('/event/@timestamp[. < sql:variable("@EndDate")]') = 1
26747+ WHERE
26748+ (
26749+ e.x.exist('@name[ .= "xml_deadlock_report"]') = 1
26750+ OR e.x.exist('@name[ .= "database_xml_deadlock_report"]') = 1
26751+ OR e.x.exist('@name[ .= "xml_deadlock_report_filtered"]') = 1
26752+ )
26753+ AND e.x.exist('@timestamp[. >= sql:variable("@StartDate")]') = 1
26754+ AND e.x.exist('@timestamp[. < sql:variable("@EndDate")]') = 1
2673926755 OPTION(RECOMPILE);
2674026756
26741- SET @d = CONVERT(varchar(40), GETDATE(), 109);
26757+ IF @Debug = 1 BEGIN SET STATISTICS XML OFF; END;
26758+
26759+ SET @d = CONVERT(varchar(40), GETDATE(), 109);
2674226760 RAISERROR('Finished at %s', 0, 1, @d) WITH NOWAIT;
2674326761 END;
2674426762
@@ -26765,7 +26783,7 @@ BEGIN
2676526783 FROM sys.fn_xe_file_target_read_file(N'system_health*.xel', NULL, NULL, NULL) AS fx
2676626784 LEFT JOIN #t AS t
2676726785 ON 1 = 1
26768- WHERE fx.object_name = N'xml_deadlock_report'
26786+ WHERE fx.object_name = N'xml_deadlock_report'
2676926787 ) AS xml
2677026788 CROSS APPLY xml.deadlock_xml.nodes('/event') AS e(x)
2677126789 WHERE 1 = 1
@@ -26863,7 +26881,7 @@ BEGIN
2686326881 CASE WHEN q.clientoption1 & 8192 = 8192 THEN ', NUMERIC_ROUNDABORT' ELSE '' END +
2686426882 CASE WHEN q.clientoption1 & 16384 = 16384 THEN ', XACT_ABORT' ELSE '' END,
2686526883 3,
26866- 8000
26884+ 500
2686726885 ),
2686826886 client_option_2 =
2686926887 SUBSTRING
@@ -26885,7 +26903,7 @@ BEGIN
2688526903 CASE WHEN q.clientoption2 & 1073741824 = 1073741824 THEN ', AUTO UPDATE STATISTICS' ELSE '' END +
2688626904 CASE WHEN q.clientoption2 & 1469283328 = 1469283328 THEN ', ALL SETTABLE OPTIONS' ELSE '' END,
2688726905 3,
26888- 8000
26906+ 500
2688926907 ),
2689026908 q.process_xml
2689126909 INTO #deadlock_process
@@ -27652,6 +27670,16 @@ BEGIN
2765227670 N'S',
2765327671 N'IS'
2765427672 )
27673+ OR dow.owner_mode IN
27674+ (
27675+ N'S',
27676+ N'IS'
27677+ )
27678+ OR dow.waiter_mode IN
27679+ (
27680+ N'S',
27681+ N'IS'
27682+ )
2765527683 AND (dow.database_id = @DatabaseId OR @DatabaseName IS NULL)
2765627684 AND (dow.event_date >= @StartDate OR @StartDate IS NULL)
2765727685 AND (dow.event_date < @EndDate OR @EndDate IS NULL)
@@ -28389,7 +28417,7 @@ BEGIN
2838928417 ),
2839028418 14
2839128419 )
28392- END
28420+ END
2839328421 FROM #deadlock_owner_waiter AS dow
2839428422 JOIN #deadlock_process AS dp
2839528423 ON (dp.id = dow.owner_id
@@ -29377,38 +29405,40 @@ BEGIN
2937729405 DROP SYNONYM DeadlockFindings; /*done with inserting.*/
2937829406 END;
2937929407 ELSE /*Output to database is not set output to client app*/
29380- SET @d = CONVERT(varchar(40), GETDATE(), 109);
29381- RAISERROR('Results to client %s', 0, 1, @d) WITH NOWAIT;
29382-
29383- IF @Debug = 1 BEGIN SET STATISTICS XML ON; END;
29384-
29385- EXEC sys.sp_executesql
29386- @deadlock_result;
29387-
29388- IF @Debug = 1
29389- BEGIN
29390- SET STATISTICS XML OFF;
29391- PRINT @deadlock_result;
29392- END;
29393-
29394- RAISERROR('Finished at %s', 0, 1, @d) WITH NOWAIT;
29395-
29396- SET @d = CONVERT(varchar(40), GETDATE(), 109);
29397- RAISERROR('Returning findings %s', 0, 1, @d) WITH NOWAIT;
29398-
29399- SELECT
29400- df.check_id,
29401- df.database_name,
29402- df.object_name,
29403- df.finding_group,
29404- df.finding
29405- FROM #deadlock_findings AS df
29406- ORDER BY df.check_id
29407- OPTION(RECOMPILE);
29408-
29409- SET @d = CONVERT(varchar(40), GETDATE(), 109);
29410- RAISERROR('Finished at %s', 0, 1, @d) WITH NOWAIT;
29411- END; /*done with output to client app.*/
29408+ BEGIN
29409+ SET @d = CONVERT(varchar(40), GETDATE(), 109);
29410+ RAISERROR('Results to client %s', 0, 1, @d) WITH NOWAIT;
29411+
29412+ IF @Debug = 1 BEGIN SET STATISTICS XML ON; END;
29413+
29414+ EXEC sys.sp_executesql
29415+ @deadlock_result;
29416+
29417+ IF @Debug = 1
29418+ BEGIN
29419+ SET STATISTICS XML OFF;
29420+ PRINT @deadlock_result;
29421+ END;
29422+
29423+ RAISERROR('Finished at %s', 0, 1, @d) WITH NOWAIT;
29424+
29425+ SET @d = CONVERT(varchar(40), GETDATE(), 109);
29426+ RAISERROR('Returning findings %s', 0, 1, @d) WITH NOWAIT;
29427+
29428+ SELECT
29429+ df.check_id,
29430+ df.database_name,
29431+ df.object_name,
29432+ df.finding_group,
29433+ df.finding
29434+ FROM #deadlock_findings AS df
29435+ ORDER BY df.check_id
29436+ OPTION(RECOMPILE);
29437+
29438+ SET @d = CONVERT(varchar(40), GETDATE(), 109);
29439+ RAISERROR('Finished at %s', 0, 1, @d) WITH NOWAIT;
29440+ END; /*done with output to client app.*/
29441+ END;
2941229442
2941329443 IF @Debug = 1
2941429444 BEGIN
@@ -29517,7 +29547,7 @@ BEGIN
2951729547 SET STATISTICS XML OFF;
2951829548 SET TRANSACTION ISOLATION LEVEL READ UNCOMMITTED;
2951929549
29520- SELECT @Version = '8.14 ', @VersionDate = '20230420 ';
29550+ SELECT @Version = '8.15 ', @VersionDate = '20230613 ';
2952129551
2952229552 IF(@VersionCheckMode = 1)
2952329553 BEGIN
@@ -30913,9 +30943,10 @@ DELETE FROM dbo.SqlServerVersions;
3091330943INSERT INTO dbo.SqlServerVersions
3091430944 (MajorVersionNumber, MinorVersionNumber, Branch, [Url], ReleaseDate, MainstreamSupportEndDate, ExtendedSupportEndDate, MajorVersionName, MinorVersionName)
3091530945VALUES
30916- (16, 4025, 'CU3', 'https://learn.microsoft.com/en-us/troubleshoot/sql/releases/sqlserver-2022/cumulativeupdate3', '2023-04-13', '2028-01-11', '2033-01-11', 'SQL Server 2022', 'Cumulative Update 3'),
30917- (16, 4015, 'CU2', 'https://learn.microsoft.com/en-us/troubleshoot/sql/releases/sqlserver-2022/cumulativeupdate2', '2023-03-15', '2028-01-11', '2033-01-11', 'SQL Server 2022', 'Cumulative Update 2'),
30918- (16, 4003, 'CU1', 'https://learn.microsoft.com/en-us/troubleshoot/sql/releases/sqlserver-2022/cumulativeupdate1', '2023-02-16', '2028-01-11', '2033-01-11', 'SQL Server 2022', 'Cumulative Update 1'),
30946+ (16, 4035, 'CU4', 'https://support.microsoft.com/en-us/help/5026717', '2023-05-11', '2028-01-11', '2033-01-11', 'SQL Server 2022', 'Cumulative Update 4'),
30947+ (16, 4025, 'CU3', 'https://support.microsoft.com/en-us/help/5024396', '2023-04-13', '2028-01-11', '2033-01-11', 'SQL Server 2022', 'Cumulative Update 3'),
30948+ (16, 4015, 'CU2', 'https://support.microsoft.com/en-us/help/5023127', '2023-03-15', '2028-01-11', '2033-01-11', 'SQL Server 2022', 'Cumulative Update 2'),
30949+ (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'),
3091930950 (16, 1050, 'RTM GDR', 'https://support.microsoft.com/kb/5021522', '2023-02-14', '2028-01-11', '2033-01-11', 'SQL Server 2022 GDR', 'RTM'),
3092030951 (16, 1000, 'RTM', '', '2022-11-15', '2028-01-11', '2033-01-11', 'SQL Server 2022', 'RTM'),
3092130952 (15, 4312, 'CU20', 'https://support.microsoft.com/kb/5024276', '2023-04-13', '2025-01-07', '2030-01-08', 'SQL Server 2019', 'Cumulative Update 20'),
@@ -31340,7 +31371,7 @@ SET NOCOUNT ON;
3134031371SET STATISTICS XML OFF;
3134131372SET TRANSACTION ISOLATION LEVEL READ UNCOMMITTED;
3134231373
31343- SELECT @Version = '8.14 ', @VersionDate = '20230420 ';
31374+ SELECT @Version = '8.15 ', @VersionDate = '20230613 ';
3134431375
3134531376IF(@VersionCheckMode = 1)
3134631377BEGIN
0 commit comments