Skip to content

Commit

Permalink
Merge pull request #3287 from BrentOzarULTD/dev
Browse files Browse the repository at this point in the history
2023-06-13 Release
  • Loading branch information
BrentOzar authored Jun 13, 2023
2 parents ef1f8a4 + 086d260 commit 4f8b641
Show file tree
Hide file tree
Showing 18 changed files with 502 additions and 292 deletions.
238 changes: 156 additions & 82 deletions Install-All-Scripts.sql

Large diffs are not rendered by default.

157 changes: 94 additions & 63 deletions Install-Core-Blitz-No-Query-Store.sql
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ AS
SET TRANSACTION ISOLATION LEVEL READ UNCOMMITTED;


SELECT @Version = '8.14', @VersionDate = '20230420';
SELECT @Version = '8.15', @VersionDate = '20230613';
SET @OutputType = UPPER(@OutputType);

IF(@VersionCheckMode = 1)
Expand Down Expand Up @@ -1265,7 +1265,7 @@ AS
db_name(dek.database_id) AS DatabaseName,
''https://www.brentozar.com/go/tde'' AS URL,
''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
FROM sys.certificates c INNER JOIN sys.dm_database_encryption_keys dek ON c.thumbprint = dek.encryptor_thumbprint
FROM master.sys.certificates c INNER JOIN sys.dm_database_encryption_keys dek ON c.thumbprint = dek.encryptor_thumbprint
WHERE pvt_key_last_backup_date IS NULL OR pvt_key_last_backup_date <= DATEADD(dd, -30, GETDATE()) OPTION (RECOMPILE);';

IF @Debug = 2 AND @StringToExecute IS NOT NULL PRINT @StringToExecute;
Expand Down Expand Up @@ -3879,9 +3879,9 @@ AS

IF (@ProductVersionMajor = 15 AND @ProductVersionMinor < 2000) OR
(@ProductVersionMajor = 14 AND @ProductVersionMinor < 1000) OR
(@ProductVersionMajor = 13 AND @ProductVersionMinor < 5026) OR
(@ProductVersionMajor = 13 AND @ProductVersionMinor < 6300) OR
(@ProductVersionMajor = 12 AND @ProductVersionMinor < 6024) OR
(@ProductVersionMajor = 11 AND @ProductVersionMinor < 7001) OR
(@ProductVersionMajor = 11 /*AND @ProductVersionMinor < 7001)*/) OR
(@ProductVersionMajor = 10.5 /*AND @ProductVersionMinor < 6000*/) OR
(@ProductVersionMajor = 10 /*AND @ProductVersionMinor < 6000*/) OR
(@ProductVersionMajor = 9 /*AND @ProductVersionMinor <= 5000*/)
Expand All @@ -3892,7 +3892,7 @@ AS
INSERT INTO #BlitzResults(CheckID, Priority, FindingsGroup, Finding, URL, Details)
VALUES(128, 20, 'Reliability', 'Unsupported Build of SQL Server', 'https://www.brentozar.com/go/unsupported',
'Version ' + CAST(@ProductVersionMajor AS VARCHAR(100)) +
CASE WHEN @ProductVersionMajor >= 11 THEN
CASE WHEN @ProductVersionMajor >= 12 THEN
'.' + CAST(@ProductVersionMinor AS VARCHAR(100)) + ' is no longer supported by Microsoft. You need to apply a service pack.'
ELSE ' is no longer supported by Microsoft. You should be making plans to upgrade to a modern version of SQL Server.' END);
END;
Expand Down Expand Up @@ -9737,7 +9737,7 @@ AS
SET NOCOUNT ON;
SET STATISTICS XML OFF;

SELECT @Version = '8.14', @VersionDate = '20230420';
SELECT @Version = '8.15', @VersionDate = '20230613';

IF(@VersionCheckMode = 1)
BEGIN
Expand Down Expand Up @@ -10615,7 +10615,7 @@ AS
SET STATISTICS XML OFF;
SET TRANSACTION ISOLATION LEVEL READ UNCOMMITTED;

SELECT @Version = '8.14', @VersionDate = '20230420';
SELECT @Version = '8.15', @VersionDate = '20230613';

IF(@VersionCheckMode = 1)
BEGIN
Expand Down Expand Up @@ -12397,7 +12397,7 @@ SET NOCOUNT ON;
SET STATISTICS XML OFF;
SET TRANSACTION ISOLATION LEVEL READ UNCOMMITTED;

SELECT @Version = '8.14', @VersionDate = '20230420';
SELECT @Version = '8.15', @VersionDate = '20230613';
SET @OutputType = UPPER(@OutputType);

IF(@VersionCheckMode = 1)
Expand Down Expand Up @@ -19715,7 +19715,7 @@ SET NOCOUNT ON;
SET STATISTICS XML OFF;
SET TRANSACTION ISOLATION LEVEL READ UNCOMMITTED;

SELECT @Version = '8.14', @VersionDate = '20230420';
SELECT @Version = '8.15', @VersionDate = '20230613';
SET @OutputType = UPPER(@OutputType);

IF(@VersionCheckMode = 1)
Expand Down Expand Up @@ -25892,7 +25892,7 @@ BEGIN
SET NOCOUNT, XACT_ABORT ON;
SET TRANSACTION ISOLATION LEVEL READ UNCOMMITTED;

SELECT @Version = '8.14', @VersionDate = '20230420';
SELECT @Version = '8.15', @VersionDate = '20230613';

IF @VersionCheckMode = 1
BEGIN
Expand Down Expand Up @@ -26007,8 +26007,12 @@ BEGIN
WHEN
(
SELECT
SERVERPROPERTY('EDITION')
) = 'SQL Azure'
CONVERT
(
integer,
SERVERPROPERTY('EngineEdition')
)
) = 5
THEN 1
ELSE 0
END,
Expand Down Expand Up @@ -26236,7 +26240,7 @@ BEGIN
/*Add wait_resource column*/
ALTER TABLE ' +
@ObjectFullName +
N' ADD client_option_1 nvarchar(8000) NULL;';
N' ADD client_option_1 varchar(500) NULL;';

IF @Debug = 1 BEGIN PRINT @StringToExecute; END;
EXEC sys.sp_executesql
Expand All @@ -26252,7 +26256,7 @@ BEGIN
/*Add wait_resource column*/
ALTER TABLE ' +
@ObjectFullName +
N' ADD client_option_2 nvarchar(8000) NULL;';
N' ADD client_option_2 varchar(500) NULL;';

IF @Debug = 1 BEGIN PRINT @StringToExecute; END;
EXEC sys.sp_executesql
Expand Down Expand Up @@ -26315,8 +26319,8 @@ BEGIN
waiter_mode nvarchar(256),
lock_mode nvarchar(256),
transaction_count bigint,
client_option_1 varchar(2000),
client_option_2 varchar(2000),
client_option_1 varchar(500),
client_option_2 varchar(500),
login_name nvarchar(256),
host_name nvarchar(256),
client_app nvarchar(1024),
Expand Down Expand Up @@ -26702,7 +26706,12 @@ BEGIN
LEFT JOIN #t AS t
ON 1 = 1
CROSS APPLY x.x.nodes('/RingBufferTarget/event') AS e(x)
WHERE e.x.exist('@name[ .= "xml_deadlock_report"]') = 1
WHERE
(
e.x.exist('@name[ .= "xml_deadlock_report"]') = 1
OR e.x.exist('@name[ .= "database_xml_deadlock_report"]') = 1
OR e.x.exist('@name[ .= "xml_deadlock_report_filtered"]') = 1
)
AND e.x.exist('@timestamp[. >= sql:variable("@StartDate")]') = 1
AND e.x.exist('@timestamp[. < sql:variable("@EndDate")]') = 1
OPTION(RECOMPILE);
Expand All @@ -26721,7 +26730,9 @@ BEGIN
SET @d = CONVERT(varchar(40), GETDATE(), 109);
RAISERROR('Inserting to #deadlock_data for event file data', 0, 1) WITH NOWAIT;

INSERT
IF @Debug = 1 BEGIN SET STATISTICS XML ON; END;

INSERT
#deadlock_data WITH(TABLOCKX)
(
deadlock_xml
Expand All @@ -26733,12 +26744,19 @@ BEGIN
LEFT JOIN #t AS t
ON 1 = 1
CROSS APPLY x.x.nodes('/event') AS e(x)
WHERE e.x.exist('/event/@name[ .= "xml_deadlock_report"]') = 1
AND e.x.exist('/event/@timestamp[. >= sql:variable("@StartDate")]') = 1
AND e.x.exist('/event/@timestamp[. < sql:variable("@EndDate")]') = 1
WHERE
(
e.x.exist('@name[ .= "xml_deadlock_report"]') = 1
OR e.x.exist('@name[ .= "database_xml_deadlock_report"]') = 1
OR e.x.exist('@name[ .= "xml_deadlock_report_filtered"]') = 1
)
AND e.x.exist('@timestamp[. >= sql:variable("@StartDate")]') = 1
AND e.x.exist('@timestamp[. < sql:variable("@EndDate")]') = 1
OPTION(RECOMPILE);

SET @d = CONVERT(varchar(40), GETDATE(), 109);
IF @Debug = 1 BEGIN SET STATISTICS XML OFF; END;

SET @d = CONVERT(varchar(40), GETDATE(), 109);
RAISERROR('Finished at %s', 0, 1, @d) WITH NOWAIT;
END;

Expand All @@ -26765,7 +26783,7 @@ BEGIN
FROM sys.fn_xe_file_target_read_file(N'system_health*.xel', NULL, NULL, NULL) AS fx
LEFT JOIN #t AS t
ON 1 = 1
WHERE fx.object_name = N'xml_deadlock_report'
WHERE fx.object_name = N'xml_deadlock_report'
) AS xml
CROSS APPLY xml.deadlock_xml.nodes('/event') AS e(x)
WHERE 1 = 1
Expand Down Expand Up @@ -26863,7 +26881,7 @@ BEGIN
CASE WHEN q.clientoption1 & 8192 = 8192 THEN ', NUMERIC_ROUNDABORT' ELSE '' END +
CASE WHEN q.clientoption1 & 16384 = 16384 THEN ', XACT_ABORT' ELSE '' END,
3,
8000
500
),
client_option_2 =
SUBSTRING
Expand All @@ -26885,7 +26903,7 @@ BEGIN
CASE WHEN q.clientoption2 & 1073741824 = 1073741824 THEN ', AUTO UPDATE STATISTICS' ELSE '' END +
CASE WHEN q.clientoption2 & 1469283328 = 1469283328 THEN ', ALL SETTABLE OPTIONS' ELSE '' END,
3,
8000
500
),
q.process_xml
INTO #deadlock_process
Expand Down Expand Up @@ -27652,6 +27670,16 @@ BEGIN
N'S',
N'IS'
)
OR dow.owner_mode IN
(
N'S',
N'IS'
)
OR dow.waiter_mode IN
(
N'S',
N'IS'
)
AND (dow.database_id = @DatabaseId OR @DatabaseName IS NULL)
AND (dow.event_date >= @StartDate OR @StartDate IS NULL)
AND (dow.event_date < @EndDate OR @EndDate IS NULL)
Expand Down Expand Up @@ -28389,7 +28417,7 @@ BEGIN
),
14
)
END
END
FROM #deadlock_owner_waiter AS dow
JOIN #deadlock_process AS dp
ON (dp.id = dow.owner_id
Expand Down Expand Up @@ -29377,38 +29405,40 @@ BEGIN
DROP SYNONYM DeadlockFindings; /*done with inserting.*/
END;
ELSE /*Output to database is not set output to client app*/
SET @d = CONVERT(varchar(40), GETDATE(), 109);
RAISERROR('Results to client %s', 0, 1, @d) WITH NOWAIT;

IF @Debug = 1 BEGIN SET STATISTICS XML ON; END;

EXEC sys.sp_executesql
@deadlock_result;

IF @Debug = 1
BEGIN
SET STATISTICS XML OFF;
PRINT @deadlock_result;
END;

RAISERROR('Finished at %s', 0, 1, @d) WITH NOWAIT;

SET @d = CONVERT(varchar(40), GETDATE(), 109);
RAISERROR('Returning findings %s', 0, 1, @d) WITH NOWAIT;

SELECT
df.check_id,
df.database_name,
df.object_name,
df.finding_group,
df.finding
FROM #deadlock_findings AS df
ORDER BY df.check_id
OPTION(RECOMPILE);

SET @d = CONVERT(varchar(40), GETDATE(), 109);
RAISERROR('Finished at %s', 0, 1, @d) WITH NOWAIT;
END; /*done with output to client app.*/
BEGIN
SET @d = CONVERT(varchar(40), GETDATE(), 109);
RAISERROR('Results to client %s', 0, 1, @d) WITH NOWAIT;

IF @Debug = 1 BEGIN SET STATISTICS XML ON; END;

EXEC sys.sp_executesql
@deadlock_result;

IF @Debug = 1
BEGIN
SET STATISTICS XML OFF;
PRINT @deadlock_result;
END;

RAISERROR('Finished at %s', 0, 1, @d) WITH NOWAIT;

SET @d = CONVERT(varchar(40), GETDATE(), 109);
RAISERROR('Returning findings %s', 0, 1, @d) WITH NOWAIT;

SELECT
df.check_id,
df.database_name,
df.object_name,
df.finding_group,
df.finding
FROM #deadlock_findings AS df
ORDER BY df.check_id
OPTION(RECOMPILE);

SET @d = CONVERT(varchar(40), GETDATE(), 109);
RAISERROR('Finished at %s', 0, 1, @d) WITH NOWAIT;
END; /*done with output to client app.*/
END;

IF @Debug = 1
BEGIN
Expand Down Expand Up @@ -29517,7 +29547,7 @@ BEGIN
SET STATISTICS XML OFF;
SET TRANSACTION ISOLATION LEVEL READ UNCOMMITTED;

SELECT @Version = '8.14', @VersionDate = '20230420';
SELECT @Version = '8.15', @VersionDate = '20230613';

IF(@VersionCheckMode = 1)
BEGIN
Expand Down Expand Up @@ -30913,9 +30943,10 @@ DELETE FROM dbo.SqlServerVersions;
INSERT INTO dbo.SqlServerVersions
(MajorVersionNumber, MinorVersionNumber, Branch, [Url], ReleaseDate, MainstreamSupportEndDate, ExtendedSupportEndDate, MajorVersionName, MinorVersionName)
VALUES
(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'),
(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'),
(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'),
(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'),
(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'),
(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'),
(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, 4312, 'CU20', 'https://support.microsoft.com/kb/5024276', '2023-04-13', '2025-01-07', '2030-01-08', 'SQL Server 2019', 'Cumulative Update 20'),
Expand Down Expand Up @@ -31340,7 +31371,7 @@ SET NOCOUNT ON;
SET STATISTICS XML OFF;
SET TRANSACTION ISOLATION LEVEL READ UNCOMMITTED;

SELECT @Version = '8.14', @VersionDate = '20230420';
SELECT @Version = '8.15', @VersionDate = '20230613';

IF(@VersionCheckMode = 1)
BEGIN
Expand Down
Loading

0 comments on commit 4f8b641

Please sign in to comment.