Skip to content

Commit 2d78242

Browse files
2 parents 19a03c3 + 5e7f4f2 commit 2d78242

19 files changed

Lines changed: 2799 additions & 819 deletions

Install-All-Scripts.sql

Lines changed: 799 additions & 184 deletions
Large diffs are not rendered by default.

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

Lines changed: 780 additions & 171 deletions
Large diffs are not rendered by default.

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

Lines changed: 781 additions & 172 deletions
Large diffs are not rendered by default.

README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -100,6 +100,8 @@ Advanced tips:
100100

101101
In addition to the [parameters common to many of the stored procedures](#parameters-common-to-many-of-the-stored-procedures), here are the ones specific to sp_Blitz:
102102

103+
* @Debug default 0. When 1, we print out messages of what we're doing. When 2, we print the dynamic queries as well
104+
103105
[*Back to top*](#header1)
104106

105107
#### Writing sp_Blitz Output to a Table

SqlServerVersions.sql

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,7 @@ VALUES
5050
(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'),
5151
(16, 1050, 'RTM GDR', 'https://support.microsoft.com/kb/5021522', '2023-02-14', '2028-01-11', '2033-01-11', 'SQL Server 2022 GDR', 'RTM'),
5252
(16, 1000, 'RTM', '', '2022-11-15', '2028-01-11', '2033-01-11', 'SQL Server 2022', 'RTM'),
53+
(15, 4322, 'CU22', 'https://support.microsoft.com/kb/5027702', '2023-08-14', '2025-01-07', '2030-01-08', 'SQL Server 2019', 'Cumulative Update 22'),
5354
(15, 4316, 'CU21', 'https://support.microsoft.com/kb/5025808', '2023-06-15', '2025-01-07', '2030-01-08', 'SQL Server 2019', 'Cumulative Update 21'),
5455
(15, 4312, 'CU20', 'https://support.microsoft.com/kb/5024276', '2023-04-13', '2025-01-07', '2030-01-08', 'SQL Server 2019', 'Cumulative Update 20'),
5556
(15, 4298, 'CU19', 'https://support.microsoft.com/kb/5023049', '2023-02-16', '2025-01-07', '2030-01-08', 'SQL Server 2019', 'Cumulative Update 19'),

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.15', @VersionDate = '20230613';
34+
SELECT @Version = '8.16', @VersionDate = '20230820';
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
@@ -38,7 +38,7 @@ SET STATISTICS XML OFF;
3838

3939
BEGIN;
4040

41-
SELECT @Version = '8.15', @VersionDate = '20230613';
41+
SELECT @Version = '8.16', @VersionDate = '20230820';
4242

4343
IF(@VersionCheckMode = 1)
4444
BEGIN

sp_Blitz.sql

Lines changed: 43 additions & 8 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.15', @VersionDate = '20230613';
41+
SELECT @Version = '8.16', @VersionDate = '20230820';
4242
SET @OutputType = UPPER(@OutputType);
4343

4444
IF(@VersionCheckMode = 1)
@@ -85,6 +85,7 @@ AS
8585
@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
88+
@Debug 0=silent (Default) | 1=messages per step | 2=outputs dynamic queries
8889
For the rest of the parameters, see https://www.BrentOzar.com/blitz/documentation for details.
8990
9091
MIT License
@@ -219,7 +220,7 @@ AS
219220
fmp.permission_name
220221
FROM sys.databases AS d
221222
CROSS APPLY fn_my_permissions(d.name, 'DATABASE') AS fmp
222-
WHERE fmp.permission_name = N'SELECT' /*Databases where we don't have read permissions*/
223+
WHERE fmp.permission_name = N'SELECT'; /*Databases where we don't have read permissions*/
223224

224225
/* End of declarations for First Responder Kit consistency check:*/
225226
;
@@ -306,7 +307,35 @@ AS
306307
BEGIN
307308
SET @SkipValidateLogins = 1;
308309
END; /*Need execute on sp_validatelogins*/
309-
310+
311+
IF ISNULL(@SkipModel, 0) != 1 /*If @SkipModel hasn't been set to 1 by the caller*/
312+
BEGIN
313+
IF EXISTS
314+
(
315+
SELECT 1/0
316+
FROM @db_perms
317+
WHERE database_name = N'model'
318+
)
319+
BEGIN
320+
BEGIN TRY
321+
IF EXISTS
322+
(
323+
SELECT 1/0
324+
FROM model.sys.objects
325+
)
326+
BEGIN
327+
SET @SkipModel = 0; /*We have read permissions in the model database, and can view the objects*/
328+
END;
329+
END TRY
330+
BEGIN CATCH
331+
SET @SkipModel = 1; /*We have read permissions in the model database ... oh wait we got tricked, we can't view the objects*/
332+
END CATCH;
333+
END;
334+
ELSE
335+
BEGIN
336+
SET @SkipModel = 1; /*We don't have read permissions in the model database*/
337+
END;
338+
END;
310339
END;
311340

312341
SET @crlf = NCHAR(13) + NCHAR(10);
@@ -467,11 +496,11 @@ AS
467496
);
468497

469498
/*Skip individial checks where we don't have permissions*/
470-
INSERT #SkipChecks (DatabaseName, CheckID, ServerName)
471-
SELECT
472-
v.*
473-
FROM (VALUES(NULL, 29, NULL)) AS v (DatabaseName, CheckID, ServerName) /*Looks for user tables in model*/
474-
WHERE NOT EXISTS (SELECT 1/0 FROM @db_perms AS dp WHERE dp.database_name = 'model');
499+
INSERT #SkipChecks (DatabaseName, CheckID, ServerName)
500+
SELECT
501+
v.*
502+
FROM (VALUES(NULL, 29, NULL)) AS v (DatabaseName, CheckID, ServerName) /*Looks for user tables in model*/
503+
WHERE @SkipModel = 1;
475504

476505
INSERT #SkipChecks (DatabaseName, CheckID, ServerName)
477506
SELECT
@@ -491,6 +520,12 @@ AS
491520
FROM (VALUES(NULL, 92, NULL)) AS v (DatabaseName, CheckID, ServerName) /*xp_fixeddrives*/
492521
WHERE @SkipXPFixedDrives = 1;
493522

523+
INSERT #SkipChecks (DatabaseName, CheckID, ServerName)
524+
SELECT
525+
v.*
526+
FROM (VALUES(NULL, 106, NULL)) AS v (DatabaseName, CheckID, ServerName) /*alter trace*/
527+
WHERE @SkipTrace = 1;
528+
494529
INSERT #SkipChecks (DatabaseName, CheckID, ServerName)
495530
SELECT
496531
v.*

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.15', @VersionDate = '20230613';
40+
SELECT @Version = '8.16', @VersionDate = '20230820';
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.15', @VersionDate = '20230613';
27+
SELECT @Version = '8.16', @VersionDate = '20230820';
2828

2929
IF(@VersionCheckMode = 1)
3030
BEGIN

0 commit comments

Comments
 (0)