Skip to content

Commit 012c213

Browse files
authored
Merge pull request #2959 from BrentOzarULTD/dev
2021-07-25 Release
2 parents 60352a5 + 81cc9bb commit 012c213

19 files changed

+1767
-358
lines changed

Documentation/sp_Blitz_Checks_by_Priority.md

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,8 @@ Before adding a new check, make sure to add a Github issue for it first, and hav
66

77
If you want to change anything about a check - the priority, finding, URL, or ID - open a Github issue first. The relevant scripts have to be updated too.
88

9-
CURRENT HIGH CHECKID: 256.
10-
If you want to add a new one, start at 257.
9+
CURRENT HIGH CHECKID: 257.
10+
If you want to add a new one, start at 258.
1111

1212
| Priority | FindingsGroup | Finding | URL | CheckID |
1313
|----------|-----------------------------|---------------------------------------------------------|------------------------------------------------------------------------|----------|
@@ -61,6 +61,7 @@ If you want to add a new one, start at 257.
6161
| 50 | Performance | Poison Wait Detected | https://www.BrentOzar.com/go/poison | 107 |
6262
| 50 | Performance | Poison Wait Detected: CMEMTHREAD & NUMA | https://www.BrentOzar.com/go/poison | 162 |
6363
| 50 | Performance | Poison Wait Detected: Serializable Locking | https://www.BrentOzar.com/go/serializable | 121 |
64+
| 50 | Performance | Recovery Interval Not Optimal| https://sqlperformance.com/2020/05/system-configuration/0-to-60-switching-to-indirect-checkpoints | 257 |
6465
| 50 | Performance | Snapshotting Too Many Databases | https://www.BrentOzar.com/go/toomanysnaps | 236 |
6566
| 50 | Performance | Too Much Free Memory | https://www.BrentOzar.com/go/freememory | 165 |
6667
| 50 | Performance | Wait Stats Cleared Recently| | 205 |

Install-All-Scripts.sql

Lines changed: 466 additions & 114 deletions
Large diffs are not rendered by default.

Install-Core-Blitz-No-Query-Store.sql

Lines changed: 415 additions & 63 deletions
Large diffs are not rendered by default.

Install-Core-Blitz-With-Query-Store.sql

Lines changed: 416 additions & 64 deletions
Large diffs are not rendered by default.

SqlServerVersions.sql

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,7 @@ DELETE FROM dbo.SqlServerVersions;
4141
INSERT INTO dbo.SqlServerVersions
4242
(MajorVersionNumber, MinorVersionNumber, Branch, [Url], ReleaseDate, MainstreamSupportEndDate, ExtendedSupportEndDate, MajorVersionName, MinorVersionName)
4343
VALUES
44+
(15, 4138, 'CU11', 'https://support.microsoft.com/en-us/help/5003249', '2021-06-10', '2025-01-01', '2030-01-08', 'SQL Server 2019', 'Cumulative Update 11'),
4445
(15, 4123, 'CU10', 'https://support.microsoft.com/en-us/help/5001090', '2021-04-06', '2025-01-07', '2030-01-08', 'SQL Server 2019', 'Cumulative Update 10'),
4546
(15, 4102, 'CU9', 'https://support.microsoft.com/en-us/help/5000642', '2021-02-11', '2025-01-07', '2030-01-08', 'SQL Server 2019', 'Cumulative Update 9 '),
4647
(15, 4073, 'CU8 GDR', 'https://support.microsoft.com/en-us/help/4583459', '2021-01-12', '2025-01-07', '2030-01-08', 'SQL Server 2019', 'Cumulative Update 8 GDR '),
@@ -54,6 +55,7 @@ VALUES
5455
(15, 4003, 'CU1', 'https://support.microsoft.com/en-us/help/4527376', '2020-01-07', '2025-01-07', '2030-01-08', 'SQL Server 2019', 'Cumulative Update 1 '),
5556
(15, 2070, 'GDR', 'https://support.microsoft.com/en-us/help/4517790', '2019-11-04', '2025-01-07', '2030-01-08', 'SQL Server 2019', 'RTM GDR '),
5657
(15, 2000, 'RTM ', '', '2019-11-04', '2025-01-07', '2030-01-08', 'SQL Server 2019', 'RTM '),
58+
(14, 3410, 'RTM CU25', 'https://support.microsoft.com/en-us/help/5003830', '2021-07-12', '2022-10-11', '2027-10-12', 'SQL Server 2017', 'RTM Cumulative Update 25'),
5759
(14, 3391, 'RTM CU24', 'https://support.microsoft.com/en-us/help/5001228', '2021-05-10', '2022-10-11', '2027-10-12', 'SQL Server 2017', 'RTM Cumulative Update 24'),
5860
(14, 3381, 'RTM CU23', 'https://support.microsoft.com/en-us/help/5000685', '2021-02-25', '2022-10-11', '2027-10-12', 'SQL Server 2017', 'RTM Cumulative Update 23'),
5961
(14, 3370, 'RTM CU22 GDR', 'https://support.microsoft.com/en-us/help/4583457', '2021-01-12', '2022-10-11', '2027-10-12', 'SQL Server 2017', 'RTM Cumulative Update 22 GDR'),

sp_AllNightLog.sql

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ SET STATISTICS XML OFF;
3131
BEGIN;
3232

3333

34-
SELECT @Version = '8.04', @VersionDate = '20210530';
34+
SELECT @Version = '8.05', @VersionDate = '20210725';
3535

3636
IF(@VersionCheckMode = 1)
3737
BEGIN

sp_AllNightLog_Setup.sql

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ SET STATISTICS XML OFF;
3737

3838
BEGIN;
3939

40-
SELECT @Version = '8.04', @VersionDate = '20210530';
40+
SELECT @Version = '8.05', @VersionDate = '20210725';
4141

4242
IF(@VersionCheckMode = 1)
4343
BEGIN

sp_Blitz.sql

Lines changed: 94 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ AS
3838
SET TRANSACTION ISOLATION LEVEL READ UNCOMMITTED;
3939

4040

41-
SELECT @Version = '8.04', @VersionDate = '20210530';
41+
SELECT @Version = '8.05', @VersionDate = '20210725';
4242
SET @OutputType = UPPER(@OutputType);
4343

4444
IF(@VersionCheckMode = 1)
@@ -356,7 +356,7 @@ AS
356356
SET @StringToExecute += QUOTENAME(@SkipChecksServer) + N'.';
357357
END
358358
SET @StringToExecute += QUOTENAME(@SkipChecksDatabase) + N'.' + QUOTENAME(@SkipChecksSchema) + N'.' + QUOTENAME(@SkipChecksTable)
359-
+ N' WHERE ServerName IS NULL OR ServerName = SERVERPROPERTY(''ServerName'') OPTION (RECOMPILE);';
359+
+ N' WHERE ServerName IS NULL OR ServerName = CAST(SERVERPROPERTY(''ServerName'') AS NVARCHAR(128)) OPTION (RECOMPILE);';
360360
EXEC(@StringToExecute);
361361
END;
362362

@@ -4312,10 +4312,10 @@ AS
43124312
SELECT 'containment', 0, 141, 210, 'Containment Enabled', 'https://www.brentozar.com/go/dbdefaults', NULL
43134313
FROM sys.all_columns
43144314
WHERE name = 'containment' AND object_id = OBJECT_ID('sys.databases');
4315-
INSERT INTO #DatabaseDefaults
4316-
SELECT 'target_recovery_time_in_seconds', 0, 142, 210, 'Target Recovery Time Changed', 'https://www.brentozar.com/go/dbdefaults', NULL
4317-
FROM sys.all_columns
4318-
WHERE name = 'target_recovery_time_in_seconds' AND object_id = OBJECT_ID('sys.databases');
4315+
--INSERT INTO #DatabaseDefaults
4316+
-- SELECT 'target_recovery_time_in_seconds', 0, 142, 210, 'Target Recovery Time Changed', 'https://www.brentozar.com/go/dbdefaults', NULL
4317+
-- FROM sys.all_columns
4318+
-- WHERE name = 'target_recovery_time_in_seconds' AND object_id = OBJECT_ID('sys.databases');
43194319
INSERT INTO #DatabaseDefaults
43204320
SELECT 'delayed_durability', 0, 143, 210, 'Delayed Durability Enabled', 'https://www.brentozar.com/go/dbdefaults', NULL
43214321
FROM sys.all_columns
@@ -4359,6 +4359,79 @@ AS
43594359

43604360
CLOSE DatabaseDefaultsLoop;
43614361
DEALLOCATE DatabaseDefaultsLoop;
4362+
4363+
/* Check if target recovery interval <> 60 */
4364+
IF
4365+
@ProductVersionMajor >= 10
4366+
AND NOT EXISTS
4367+
(
4368+
SELECT
4369+
1/0
4370+
FROM #SkipChecks AS sc
4371+
WHERE sc.DatabaseName IS NULL
4372+
AND sc.CheckID = 257
4373+
)
4374+
BEGIN
4375+
IF EXISTS
4376+
(
4377+
SELECT
4378+
1/0
4379+
FROM sys.all_columns AS ac
4380+
WHERE ac.name = 'target_recovery_time_in_seconds'
4381+
AND ac.object_id = OBJECT_ID('sys.databases')
4382+
)
4383+
BEGIN
4384+
IF @Debug IN (1, 2) RAISERROR('Running CheckId [%d].', 0, 1, 257) WITH NOWAIT;
4385+
4386+
DECLARE
4387+
@tri nvarchar(max) = N'
4388+
SELECT
4389+
DatabaseName =
4390+
d.name,
4391+
CheckId =
4392+
257,
4393+
Priority =
4394+
50,
4395+
FindingsGroup =
4396+
N''Performance'',
4397+
Finding =
4398+
N''Recovery Interval Not Optimal'',
4399+
URL =
4400+
N''https://sqlperformance.com/2020/05/system-configuration/0-to-60-switching-to-indirect-checkpoints'',
4401+
Details =
4402+
N''The database '' +
4403+
QUOTENAME(d.name) +
4404+
N'' has a target recovery interval of '' +
4405+
RTRIM(d.target_recovery_time_in_seconds) +
4406+
CASE
4407+
WHEN d.target_recovery_time_in_seconds = 0
4408+
THEN N'', which is a legacy default, and should be changed to 60.''
4409+
WHEN d.target_recovery_time_in_seconds <> 0
4410+
THEN N'', which is probably a mistake, and should be changed to 60.''
4411+
END
4412+
FROM sys.databases AS d
4413+
WHERE d.database_id > 4
4414+
AND d.is_read_only = 0
4415+
AND d.is_in_standby = 0
4416+
AND d.target_recovery_time_in_seconds <> 60;
4417+
';
4418+
4419+
INSERT INTO
4420+
#BlitzResults
4421+
(
4422+
DatabaseName,
4423+
CheckID,
4424+
Priority,
4425+
FindingsGroup,
4426+
Finding,
4427+
URL,
4428+
Details
4429+
)
4430+
EXEC sys.sp_executesql
4431+
@tri;
4432+
4433+
END;
4434+
END;
43624435

43634436

43644437
/*This checks to see if Agent is Offline*/
@@ -6085,7 +6158,7 @@ IF @ProductVersionMajor >= 10
60856158
END;
60866159

60876160

6088-
IF @ProductVersionMajor >= 13 AND @ProductVersionMinor < 2149 --CU1 has the fix in it
6161+
IF @ProductVersionMajor = 13 AND @ProductVersionMinor < 2149 --2016 CU1 has the fix in it
60896162
AND NOT EXISTS ( SELECT 1
60906163
FROM #SkipChecks
60916164
WHERE DatabaseName IS NULL AND CheckID = 182 )
@@ -8180,6 +8253,7 @@ IF @ProductVersionMajor >= 10 AND NOT EXISTS ( SELECT 1
81808253
WHERE o.name = 'dm_server_services'
81818254
AND c.name = 'instant_file_initialization_enabled' )
81828255
begin
8256+
SET @StringToExecute = N'
81838257
INSERT INTO #BlitzResults
81848258
( CheckID ,
81858259
[Priority] ,
@@ -8191,14 +8265,15 @@ IF @ProductVersionMajor >= 10 AND NOT EXISTS ( SELECT 1
81918265
SELECT
81928266
193 AS [CheckID] ,
81938267
250 AS [Priority] ,
8194-
'Server Info' AS [FindingsGroup] ,
8195-
'Instant File Initialization Enabled' AS [Finding] ,
8196-
'https://www.brentozar.com/go/instant' AS [URL] ,
8197-
'The service account has the Perform Volume Maintenance Tasks permission.'
8268+
''Server Info'' AS [FindingsGroup] ,
8269+
''Instant File Initialization Enabled'' AS [Finding] ,
8270+
''https://www.brentozar.com/go/instant'' AS [URL] ,
8271+
''The service account has the Perform Volume Maintenance Tasks permission.''
81988272
where exists (select 1 FROM sys.dm_server_services
8199-
WHERE instant_file_initialization_enabled = 'Y'
8200-
AND filename LIKE '%sqlservr.exe%')
8201-
OPTION (RECOMPILE);
8273+
WHERE instant_file_initialization_enabled = ''Y''
8274+
AND filename LIKE ''%sqlservr.exe%'')
8275+
OPTION (RECOMPILE);';
8276+
EXEC(@StringToExecute);
82028277
end;
82038278
end;
82048279
END;
@@ -9027,7 +9102,7 @@ IF @ProductVersionMajor >= 10 AND NOT EXISTS ( SELECT 1
90279102
IF (OBJECT_ID('tempdb..##BlitzResults', 'U') IS NOT NULL) DROP TABLE ##BlitzResults;
90289103
SELECT * INTO ##BlitzResults FROM #BlitzResults;
90299104
SET @query_result_separator = char(9);
9030-
SET @StringToExecute = 'SET NOCOUNT ON;SELECT [Priority] , [FindingsGroup] , [Finding] , [DatabaseName] , [URL] , [Details] , CheckID FROM ##BlitzResults ORDER BY Priority , FindingsGroup, Finding, Details; SET NOCOUNT OFF;';
9105+
SET @StringToExecute = 'SET NOCOUNT ON;SELECT [Priority] , [FindingsGroup] , [Finding] , [DatabaseName] , [URL] , [Details] , CheckID FROM ##BlitzResults ORDER BY Priority , FindingsGroup , Finding , DatabaseName , Details; SET NOCOUNT OFF;';
90319106
SET @EmailSubject = 'sp_Blitz Results for ' + @@SERVERNAME;
90329107
SET @EmailBody = 'sp_Blitz ' + CAST(CONVERT(DATETIME, @VersionDate, 102) AS VARCHAR(100)) + '. http://FirstResponderKit.org';
90339108
IF @EmailProfile IS NULL
@@ -9172,7 +9247,7 @@ IF @ProductVersionMajor >= 10 AND NOT EXISTS ( SELECT 1
91729247
+ @OutputTableName
91739248
+ ' (ServerName, CheckDate, CheckID, DatabaseName, Priority, FindingsGroup, Finding, URL, Details, QueryPlan, QueryPlanFiltered) SELECT '''
91749249
+ CAST(SERVERPROPERTY('ServerName') AS NVARCHAR(128))
9175-
+ ''', SYSDATETIMEOFFSET(), CheckID, DatabaseName, Priority, FindingsGroup, Finding, URL, Details, CAST(QueryPlan AS NVARCHAR(MAX)), QueryPlanFiltered FROM #BlitzResults ORDER BY Priority , FindingsGroup , Finding , Details';
9250+
+ ''', SYSDATETIMEOFFSET(), CheckID, DatabaseName, Priority, FindingsGroup, Finding, URL, Details, CAST(QueryPlan AS NVARCHAR(MAX)), QueryPlanFiltered FROM #BlitzResults ORDER BY Priority , FindingsGroup , Finding , DatabaseName , Details';
91769251

91779252
EXEC(@StringToExecute);
91789253
END;
@@ -9189,7 +9264,7 @@ IF @ProductVersionMajor >= 10 AND NOT EXISTS ( SELECT 1
91899264
+ @OutputTableName
91909265
+ ' (ServerName, CheckDate, CheckID, DatabaseName, Priority, FindingsGroup, Finding, URL, Details, QueryPlan, QueryPlanFiltered) SELECT '''
91919266
+ CAST(SERVERPROPERTY('ServerName') AS NVARCHAR(128))
9192-
+ ''', SYSDATETIMEOFFSET(), CheckID, DatabaseName, Priority, FindingsGroup, Finding, URL, Details, CAST(QueryPlan AS NVARCHAR(MAX)), QueryPlanFiltered FROM #BlitzResults ORDER BY Priority , FindingsGroup , Finding , Details';
9267+
+ ''', SYSDATETIMEOFFSET(), CheckID, DatabaseName, Priority, FindingsGroup, Finding, URL, Details, CAST(QueryPlan AS NVARCHAR(MAX)), QueryPlanFiltered FROM #BlitzResults ORDER BY Priority , FindingsGroup , Finding , DatabaseName , Details';
91939268
END;
91949269
ELSE
91959270
begin
@@ -9202,7 +9277,7 @@ IF @ProductVersionMajor >= 10 AND NOT EXISTS ( SELECT 1
92029277
+ @OutputTableName
92039278
+ ' (ServerName, CheckDate, CheckID, DatabaseName, Priority, FindingsGroup, Finding, URL, Details, QueryPlan, QueryPlanFiltered) SELECT '''
92049279
+ CAST(SERVERPROPERTY('ServerName') AS NVARCHAR(128))
9205-
+ ''', SYSDATETIMEOFFSET(), CheckID, DatabaseName, Priority, FindingsGroup, Finding, URL, Details, QueryPlan, QueryPlanFiltered FROM #BlitzResults ORDER BY Priority , FindingsGroup , Finding , Details';
9280+
+ ''', SYSDATETIMEOFFSET(), CheckID, DatabaseName, Priority, FindingsGroup, Finding, URL, Details, QueryPlan, QueryPlanFiltered FROM #BlitzResults ORDER BY Priority , FindingsGroup , Finding , DatabaseName , Details';
92069281
END;
92079282
EXEC(@StringToExecute);
92089283

@@ -9238,7 +9313,7 @@ IF @ProductVersionMajor >= 10 AND NOT EXISTS ( SELECT 1
92389313
+ @OutputTableName
92399314
+ ' (ServerName, CheckDate, CheckID, DatabaseName, Priority, FindingsGroup, Finding, URL, Details, QueryPlan, QueryPlanFiltered) SELECT '''
92409315
+ CAST(SERVERPROPERTY('ServerName') AS NVARCHAR(128))
9241-
+ ''', SYSDATETIMEOFFSET(), CheckID, DatabaseName, Priority, FindingsGroup, Finding, URL, Details, QueryPlan, QueryPlanFiltered FROM #BlitzResults ORDER BY Priority , FindingsGroup , Finding , Details';
9316+
+ ''', SYSDATETIMEOFFSET(), CheckID, DatabaseName, Priority, FindingsGroup, Finding, URL, Details, QueryPlan, QueryPlanFiltered FROM #BlitzResults ORDER BY Priority , FindingsGroup , Finding , DatabaseName , Details';
92429317

92439318
EXEC(@StringToExecute);
92449319
END;

sp_BlitzAnalysis.sql

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ AS
3737
SET NOCOUNT ON;
3838
SET STATISTICS XML OFF;
3939

40-
SELECT @Version = '8.04', @VersionDate = '20210530';
40+
SELECT @Version = '8.05', @VersionDate = '20210725';
4141

4242
IF(@VersionCheckMode = 1)
4343
BEGIN

sp_BlitzBackups.sql

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ AS
2424
SET STATISTICS XML OFF;
2525
SET TRANSACTION ISOLATION LEVEL READ UNCOMMITTED;
2626

27-
SELECT @Version = '8.04', @VersionDate = '20210530';
27+
SELECT @Version = '8.05', @VersionDate = '20210725';
2828

2929
IF(@VersionCheckMode = 1)
3030
BEGIN

0 commit comments

Comments
 (0)