Skip to content

Commit d7b686a

Browse files
authored
Merge pull request #3029 from BrentOzarULTD/dev
2021-11-06 Release
2 parents 47bc8bf + 4f97020 commit d7b686a

20 files changed

+273
-222
lines changed
Lines changed: 27 additions & 48 deletions
Original file line numberDiff line numberDiff line change
@@ -1,30 +1,22 @@
11
/*Blitz*/
22
EXEC dbo.sp_Blitz @CheckUserDatabaseObjects = 1, @CheckServerInfo = 1;
3-
3+
GO
44
EXEC dbo.sp_Blitz @CheckUserDatabaseObjects = 1, @CheckServerInfo = 1, @OutputDatabaseName = 'DBAtools', @OutputSchemaName = 'dbo', @OutputTableName = 'Blitz';
5-
6-
EXEC dbo.sp_Blitz @CheckUserDatabaseObjects = 1, @CheckServerInfo = 1, @Debug = 1;
7-
8-
EXEC dbo.sp_Blitz @CheckUserDatabaseObjects = 1, @CheckServerInfo = 1, @Debug = 2;
5+
GO
96

107
/*BlitzWho*/
11-
12-
EXEC dbo.sp_BlitzWho @ExpertMode = 1, @Debug = 1;
13-
14-
EXEC dbo.sp_BlitzWho @ExpertMode = 0, @Debug = 1;
15-
8+
EXEC dbo.sp_BlitzWho @ExpertMode = 1;
9+
GO
10+
EXEC dbo.sp_BlitzWho @ExpertMode = 0;
11+
GO
1612
EXEC dbo.sp_BlitzWho @OutputDatabaseName = 'DBAtools', @OutputSchemaName = 'dbo', @OutputTableName = 'BlitzWho_Results';
17-
13+
GO
1814

1915
/*BlitzFirst*/
2016
EXEC dbo.sp_BlitzFirst @Seconds = 5, @ExpertMode = 1;
21-
17+
GO
2218
EXEC dbo.sp_BlitzFirst @SinceStartup = 1;
23-
24-
EXEC dbo.sp_BlitzFirst @Seconds = 5, @ExpertMode = 1, @ShowSleepingSPIDs = 1;
25-
26-
CREATE DATABASE DBAtools;
27-
19+
GO
2820
EXEC dbo.sp_BlitzFirst @OutputDatabaseName = 'DBAtools',
2921
@OutputSchemaName = 'dbo',
3022
@OutputTableName = 'BlitzFirst',
@@ -33,52 +25,39 @@ EXEC dbo.sp_BlitzFirst @OutputDatabaseName = 'DBAtools',
3325
@OutputTableNameWaitStats = 'BlitzFirst_WaitStats',
3426
@OutputTableNameBlitzCache = 'BlitzCache',
3527
@OutputTableNameBlitzWho = 'BlitzWho';
36-
37-
SELECT TOP 100 * FROM DBAtools.dbo.BlitzFirst ORDER BY 1 DESC;
38-
SELECT TOP 100 * FROM DBAtools.dbo.BlitzFirst_FileStats ORDER BY 1 DESC;
39-
SELECT TOP 100 * FROM DBAtools.dbo.BlitzFirst_PerfmonStats ORDER BY 1 DESC;
40-
SELECT TOP 100 * FROM DBAtools.dbo.BlitzFirst_WaitStats ORDER BY 1 DESC;
41-
SELECT TOP 100 * FROM DBAtools.dbo.BlitzCache ORDER BY 1 DESC;
42-
SELECT TOP 100 * FROM DBAtools.dbo.BlitzWho ORDER BY 1 DESC;
28+
GO
4329

4430

4531
/*BlitzIndex*/
46-
EXEC dbo.sp_BlitzIndex @GetAllDatabases = 1, @Mode = 4;
47-
48-
EXEC dbo.sp_BlitzIndex @DatabaseName = 'StackOverflow', @Mode = 4;
49-
50-
EXEC dbo.sp_BlitzIndex @DatabaseName = 'StackOverflow', @Mode = 4, @SkipPartitions = 0, @SkipStatistics = 0;
51-
32+
EXEC dbo.sp_BlitzIndex @GetAllDatabases = 1, @Mode = 0;
33+
GO
5234
EXEC dbo.sp_BlitzIndex @GetAllDatabases = 1, @Mode = 1;
53-
35+
GO
5436
EXEC dbo.sp_BlitzIndex @GetAllDatabases = 1, @Mode = 2;
55-
37+
GO
5638
EXEC dbo.sp_BlitzIndex @GetAllDatabases = 1, @Mode = 3;
39+
GO
40+
EXEC dbo.sp_BlitzIndex @GetAllDatabases = 1, @Mode = 4;
41+
GO
42+
EXEC dbo.sp_BlitzIndex @DatabaseName = 'StackOverflow', @TableName = 'Users'
43+
GO
5744

5845

5946
/*BlitzCache*/
6047
EXEC dbo.sp_BlitzCache @SortOrder = 'all';
61-
62-
EXEC dbo.sp_BlitzCache @SortOrder = 'all avg', @Debug = 1;
63-
64-
EXEC dbo.sp_BlitzCache @MinimumExecutionCount = 10;
65-
66-
EXEC dbo.sp_BlitzCache @DatabaseName = N'StackOverflow';
67-
48+
GO
6849
EXEC dbo.sp_BlitzCache @OutputDatabaseName = 'DBAtools', @OutputSchemaName = 'dbo', @OutputTableName = 'BlitzCache';
50+
GO
6951

70-
EXEC dbo.sp_BlitzCache @ExpertMode = 1;
71-
72-
EXEC dbo.sp_BlitzCache @ExpertMode = 2;
73-
74-
/*BlitzQueryStore*/
52+
/*BlitzQueryStore - uncomment this when testing on 2016+ instances:
7553
EXEC dbo.sp_BlitzQueryStore @DatabaseName = 'StackOverflow';
54+
GO
55+
*/
7656

7757
/*BlitzBackups*/
7858
EXEC dbo.sp_BlitzBackups @HoursBack = 1000000;
79-
80-
/*sp_AllNightLog_Setup*/
81-
EXEC dbo.sp_AllNightLog_Setup @RPOSeconds = 30, @RTOSeconds = 30, @BackupPath = 'D:\Backup', @RestorePath = 'D:\Backup', @RunSetup = 1;
59+
GO
8260

8361
/*sp_BlitzLock*/
84-
EXEC dbo.sp_BlitzLock @Debug = 1;
62+
EXEC dbo.sp_BlitzLock;
63+
GO

Install-All-Scripts.sql

Lines changed: 61 additions & 43 deletions
Large diffs are not rendered by default.

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

Lines changed: 56 additions & 38 deletions
Large diffs are not rendered by default.

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

Lines changed: 57 additions & 39 deletions
Large diffs are not rendered by default.

README.md

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -73,9 +73,7 @@ When you have a question about what the scripts found, first make sure you read
7373

7474

7575
## sp_Blitz: Overall Health Check
76-
Run sp_Blitz daily or weekly for an overall health check. Just run it from SQL Server Management Studio, and you'll get a prioritized list of issues on your server right now:
77-
78-
![sp_Blitz](http://u.brentozar.com/github-images/sp_Blitz.png)
76+
Run sp_Blitz daily or weekly for an overall health check. Just run it from SQL Server Management Studio, and you'll get a prioritized list of issues on your server right now.
7977

8078
Output columns include:
8179

@@ -194,6 +192,10 @@ In addition to the [parameters common to many of the stored procedures](#paramet
194192
* @DatabaseName - if you only want to analyze plans in a single database. However, keep in mind that this is only the database context. A single query that runs in Database1 can join across objects in Database2 and Database3, but we can only know that it ran in Database1.
195193
* @SlowlySearchPlansFor - lets you search for strings, but will not find all results due to a [bug in the way SQL Server removes spaces from XML.](https://github.com/BrentOzarULTD/SQL-Server-First-Responder-Kit/issues/2202) If your search string includes spaces, SQL Server may remove those before the search runs, unfortunately.
196194

195+
### sp_BlitzCache Known Issues
196+
197+
* We skip databases in an Availability Group that require read-only intent. If you wanted to contribute code to enable read-only intent databases to work, look for this phrase in the code: "Checking for Read intent databases to exclude".
198+
197199
[*Back to top*](#header1)
198200

199201
## sp_BlitzFirst: Real-Time Performance Advice
@@ -216,7 +218,7 @@ Common sp_BlitzFirst parameters include:
216218

217219
### Logging sp_BlitzFirst to Tables
218220

219-
You can log sp_BlitzFirst performance data to tables and then analyze the results with the Power BI dashboard. To do it, schedule an Agent job to run sp_BlitzFirst every 15 minutes with these parameters populated:
221+
You can log sp_BlitzFirst performance data to tables by scheduling an Agent job to run sp_BlitzFirst every 15 minutes with these parameters populated:
220222

221223
* @OutputDatabaseName = typically 'DBAtools'
222224
* @OutputSchemaName = 'dbo'
@@ -229,16 +231,14 @@ You can log sp_BlitzFirst performance data to tables and then analyze the result
229231

230232
All of the above OutputTableName parameters are optional: if you don't want to collect all of the stats, you don't have to. Keep in mind that the sp_BlitzCache results will get large, fast, because each execution plan is megabytes in size.
231233

232-
Then fire up the [First Responder Kit Power BI dashboard.](https://www.brentozar.com/first-aid/first-responder-kit-power-bi-dashboard/)
233-
234234
### Logging Performance Tuning Activities
235235

236-
On the Power BI Dashboard, you can show lines for your own activities like tuning queries, adding indexes, or changing configuration settings. To do it, run sp_BlitzFirst with these parameters:
236+
You can also log your own activities like tuning queries, adding indexes, or changing configuration settings. To do it, run sp_BlitzFirst with these parameters:
237237

238238
* @OutputDatabaseName = typically 'DBAtools'
239239
* @OutputSchemaName = 'dbo'
240240
* @OutputTableName = 'BlitzFirst' - the quick diagnosis result set goes here
241-
* @LogMessage = 'Whatever you wanna show in the Power BI dashboard'
241+
* @LogMessage = 'Whatever you wanna show in your monitoring tool'
242242

243243
Optionally, you can also pass in:
244244

@@ -443,7 +443,7 @@ ORDER BY
443443
[CheckDate] ASC,
444444
[counter_name] ASC
445445
```
446-
446+
447447
[*Back to top*](#header1)
448448

449449

SqlServerVersions.sql

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -41,8 +41,9 @@ DELETE FROM dbo.SqlServerVersions;
4141
INSERT INTO dbo.SqlServerVersions
4242
(MajorVersionNumber, MinorVersionNumber, Branch, [Url], ReleaseDate, MainstreamSupportEndDate, ExtendedSupportEndDate, MajorVersionName, MinorVersionName)
4343
VALUES
44-
(15, 4153, 'CU12', 'https://support.microsoft.com/en-us/help/5004524', '2021-08-04', '2025-01-01', '2030-01-08', 'SQL Server 2019', 'Cumulative Update 12'),
45-
(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'),
44+
(15, 4178, 'CU13', 'https://support.microsoft.com/en-us/help/5005679', '2021-10-05', '2025-01-07', '2030-01-08', 'SQL Server 2019', 'Cumulative Update 13'),
45+
(15, 4153, 'CU12', 'https://support.microsoft.com/en-us/help/5004524', '2021-08-04', '2025-01-07', '2030-01-08', 'SQL Server 2019', 'Cumulative Update 12'),
46+
(15, 4138, 'CU11', 'https://support.microsoft.com/en-us/help/5003249', '2021-06-10', '2025-01-07', '2030-01-08', 'SQL Server 2019', 'Cumulative Update 11'),
4647
(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'),
4748
(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 '),
4849
(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 '),
@@ -56,7 +57,9 @@ VALUES
5657
(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 '),
5758
(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 '),
5859
(15, 2000, 'RTM ', '', '2019-11-04', '2025-01-07', '2030-01-08', 'SQL Server 2019', 'RTM '),
59-
(14, 3401, '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'),
60+
(14, 3421, 'RTM CU27', 'https://support.microsoft.com/en-us/help/5006944', '2021-10-27', '2022-10-11', '2027-10-12', 'SQL Server 2017', 'RTM Cumulative Update 27'),
61+
(14, 3411, 'RTM CU26', 'https://support.microsoft.com/en-us/help/5005226', '2021-09-14', '2022-10-11', '2027-10-12', 'SQL Server 2017', 'RTM Cumulative Update 26'),
62+
(14, 3401, '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'),
6063
(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'),
6164
(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'),
6265
(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'),
@@ -83,7 +86,9 @@ VALUES
8386
(14, 3008, 'RTM CU2', 'https://support.microsoft.com/en-us/help/4052574', '2017-11-28', '2022-10-11', '2027-10-12', 'SQL Server 2017', 'RTM Cumulative Update 2'),
8487
(14, 3006, 'RTM CU1', 'https://support.microsoft.com/en-us/help/4038634', '2017-10-24', '2022-10-11', '2027-10-12', 'SQL Server 2017', 'RTM Cumulative Update 1'),
8588
(14, 1000, 'RTM ', '', '2017-10-02', '2022-10-11', '2027-10-12', 'SQL Server 2017', 'RTM '),
86-
(13, 5888, 'SP2 CU17', 'https://support.microsoft.com/en-us/help/5001092', '2021-03-29', '2021-07-13', '2026-07-14', 'SQL Server 2016', 'Service Pack 2 Cumulative Update 17'),
89+
(13, 6404, 'SP3 GDR', 'https://support.microsoft.com/en-us/help/5006943', '2021-10-27', '2021-07-13', '2026-07-14', 'SQL Server 2016', 'Service Pack 3 GDR'),
90+
(13, 6300, 'SP3 ', 'https://support.microsoft.com/en-us/help/5003279', '2021-09-15', '2021-07-13', '2026-07-14', 'SQL Server 2016', 'Service Pack 3'),
91+
(13, 5888, 'SP2 CU17', 'https://support.microsoft.com/en-us/help/5001092', '2021-03-29', '2021-07-13', '2026-07-14', 'SQL Server 2016', 'Service Pack 2 Cumulative Update 17'),
8792
(13, 5882, 'SP2 CU16', 'https://support.microsoft.com/en-us/help/5000645', '2021-02-11', '2021-07-13', '2026-07-14', 'SQL Server 2016', 'Service Pack 2 Cumulative Update 16'),
8893
(13, 5865, 'SP2 CU15 GDR', 'https://support.microsoft.com/en-us/help/4583461', '2021-01-12', '2021-07-13', '2026-07-14', 'SQL Server 2016', 'Service Pack 2 Cumulative Update 15 GDR'),
8994
(13, 5850, 'SP2 CU15', 'https://support.microsoft.com/en-us/help/4577775', '2020-09-28', '2021-07-13', '2026-07-14', 'SQL Server 2016', 'Service Pack 2 Cumulative Update 15'),

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.06', @VersionDate = '20210914';
34+
SELECT @Version = '8.07', @VersionDate = '20211106';
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.06', @VersionDate = '20210914';
40+
SELECT @Version = '8.07', @VersionDate = '20211106';
4141

4242
IF(@VersionCheckMode = 1)
4343
BEGIN

sp_Blitz.sql

Lines changed: 6 additions & 6 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.06', @VersionDate = '20210914';
41+
SELECT @Version = '8.07', @VersionDate = '20211106';
4242
SET @OutputType = UPPER(@OutputType);
4343

4444
IF(@VersionCheckMode = 1)
@@ -82,7 +82,7 @@ AS
8282
@CheckProcedureCache 1=top 20-50 resource-intensive cache plans and analyze them for common performance issues.
8383
@OutputProcedureCache 1=output the top 20-50 resource-intensive plans even if they did not trigger an alarm
8484
@CheckProcedureCacheFilter ''CPU'' | ''Reads'' | ''Duration'' | ''ExecCount''
85-
@OutputType ''TABLE''=table | ''COUNT''=row with number found | ''MARKDOWN''=bulleted list | ''SCHEMA''=version and field list | ''XML'' =table output as XML | ''NONE'' = none
85+
@OutputType ''TABLE''=table | ''COUNT''=row with number found | ''MARKDOWN''=bulleted list (including server info, excluding security findings) | ''SCHEMA''=version and field list | ''XML'' =table output as XML | ''NONE'' = none
8686
@IgnorePrioritiesBelow 50=ignore priorities below 50
8787
@IgnorePrioritiesAbove 50=ignore priorities above 50
8888
For the rest of the parameters, see https://www.BrentOzar.com/blitz/documentation for details.
@@ -7770,7 +7770,7 @@ IF @ProductVersionMajor >= 10
77707770
WHEN [T].[TraceFlag] = '1117' THEN '1117 enabled globally, which grows all files in a filegroup at the same time.'
77717771
WHEN [T].[TraceFlag] = '1118' THEN '1118 enabled globally, which tries to reduce SGAM waits.'
77727772
WHEN [T].[TraceFlag] = '1211' THEN '1211 enabled globally, which disables lock escalation when you least expect it. This is usually a very bad idea.'
7773-
WHEN [T].[TraceFlag] = '1204' THEN '1222 enabled globally, which captures deadlock graphs in the error log.'
7773+
WHEN [T].[TraceFlag] = '1204' THEN '1204 enabled globally, which captures deadlock graphs in the error log.'
77747774
WHEN [T].[TraceFlag] = '1222' THEN '1222 enabled globally, which captures deadlock graphs in the error log.'
77757775
WHEN [T].[TraceFlag] = '1224' THEN '1224 enabled globally, which disables lock escalation until the server has memory pressure. This is usually a very bad idea.'
77767776
WHEN [T].[TraceFlag] = '1806' THEN '1806 enabled globally, which disables Instant File Initialization, causing restores and file growths to take longer. This is usually a very bad idea.'
@@ -9383,10 +9383,10 @@ IF @ProductVersionMajor >= 10 AND NOT EXISTS ( SELECT 1
93839383
WHEN r.Priority <> COALESCE(rPrior.Priority, 0) OR r.FindingsGroup <> rPrior.FindingsGroup THEN @crlf + N'**Priority ' + CAST(COALESCE(r.Priority,N'') AS NVARCHAR(5)) + N': ' + COALESCE(r.FindingsGroup,N'') + N'**:' + @crlf + @crlf
93849384
ELSE N''
93859385
END
9386-
+ CASE WHEN r.Finding <> COALESCE(rPrior.Finding,N'') AND r.Finding <> rNext.Finding THEN N'- ' + COALESCE(r.Finding,N'') + N' ' + COALESCE(r.DatabaseName, N'') + N' - ' + COALESCE(r.Details,N'') + @crlf
9386+
+ CASE WHEN r.Finding <> COALESCE(rPrior.Finding,N'') AND r.Finding <> COALESCE(rNext.Finding,N'') THEN N'- ' + COALESCE(r.Finding,N'') + N' ' + COALESCE(r.DatabaseName, N'') + N' - ' + COALESCE(r.Details,N'') + @crlf
93879387
WHEN r.Finding <> COALESCE(rPrior.Finding,N'') AND r.Finding = rNext.Finding AND r.Details = rNext.Details THEN N'- ' + COALESCE(r.Finding,N'') + N' - ' + COALESCE(r.Details,N'') + @crlf + @crlf + N' * ' + COALESCE(r.DatabaseName, N'') + @crlf
9388-
WHEN r.Finding <> COALESCE(rPrior.Finding,N'') AND r.Finding = rNext.Finding THEN N'- ' + COALESCE(r.Finding,N'') + @crlf + CASE WHEN r.DatabaseName IS NULL THEN N'' ELSE N' * ' + COALESCE(r.DatabaseName,N'') END + CASE WHEN r.Details <> rPrior.Details THEN N' - ' + COALESCE(r.Details,N'') + @crlf ELSE '' END
9389-
ELSE CASE WHEN r.DatabaseName IS NULL THEN N'' ELSE N' * ' + COALESCE(r.DatabaseName,N'') END + CASE WHEN r.Details <> rPrior.Details THEN N' - ' + COALESCE(r.Details,N'') + @crlf ELSE N'' + @crlf END
9388+
WHEN r.Finding <> COALESCE(rPrior.Finding,N'') AND r.Finding = rNext.Finding THEN N'- ' + COALESCE(r.Finding,N'') + @crlf + CASE WHEN r.DatabaseName IS NULL THEN N'' ELSE N' * ' + COALESCE(r.DatabaseName,N'') END + CASE WHEN r.Details <> rPrior.Details THEN N' - ' + COALESCE(r.Details,N'') + @crlf ELSE '' END
9389+
ELSE CASE WHEN r.DatabaseName IS NULL THEN N'' ELSE N' * ' + COALESCE(r.DatabaseName,N'') END + CASE WHEN r.Details <> rPrior.Details THEN N' - ' + COALESCE(r.Details,N'') + @crlf ELSE N'' + @crlf END
93909390
END + @crlf
93919391
FROM Results r
93929392
LEFT OUTER JOIN Results rPrior ON r.rownum = rPrior.rownum + 1

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.06', @VersionDate = '20210914';
40+
SELECT @Version = '8.07', @VersionDate = '20211106';
4141

4242
IF(@VersionCheckMode = 1)
4343
BEGIN

0 commit comments

Comments
 (0)