Skip to content

Commit

Permalink
Merge pull request #2920 from BrentOzarULTD/dev
Browse files Browse the repository at this point in the history
2021-05-30 Release
  • Loading branch information
BrentOzar authored May 30, 2021
2 parents 3e662b9 + dbb121e commit 60352a5
Show file tree
Hide file tree
Showing 19 changed files with 1,150 additions and 555 deletions.
457 changes: 298 additions & 159 deletions Install-All-Scripts.sql

Large diffs are not rendered by default.

386 changes: 270 additions & 116 deletions Install-Core-Blitz-No-Query-Store.sql

Large diffs are not rendered by default.

389 changes: 272 additions & 117 deletions Install-Core-Blitz-With-Query-Store.sql

Large diffs are not rendered by default.

4 changes: 3 additions & 1 deletion SqlServerVersions.sql
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ DELETE FROM dbo.SqlServerVersions;
INSERT INTO dbo.SqlServerVersions
(MajorVersionNumber, MinorVersionNumber, Branch, [Url], ReleaseDate, MainstreamSupportEndDate, ExtendedSupportEndDate, MajorVersionName, MinorVersionName)
VALUES
(15, 4123, 'CU10', 'https://support.microsoft.com/en-us/help/5001090', '2021-02-11', '2025-01-07', '2030-01-08', 'SQL Server 2019', 'Cumulative Update 10'),
(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'),
(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 '),
(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 '),
(15, 4073, 'CU8', 'https://support.microsoft.com/en-us/help/4577194', '2020-10-01', '2025-01-07', '2030-01-08', 'SQL Server 2019', 'Cumulative Update 8 '),
Expand All @@ -54,6 +54,7 @@ VALUES
(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 '),
(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 '),
(15, 2000, 'RTM ', '', '2019-11-04', '2025-01-07', '2030-01-08', 'SQL Server 2019', 'RTM '),
(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'),
(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'),
(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'),
(14, 3356, 'RTM CU22', 'https://support.microsoft.com/en-us/help/4577467', '2020-09-10', '2022-10-11', '2027-10-12', 'SQL Server 2017', 'RTM Cumulative Update 22'),
Expand All @@ -79,6 +80,7 @@ VALUES
(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'),
(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'),
(14, 1000, 'RTM ', '', '2017-10-02', '2022-10-11', '2027-10-12', 'SQL Server 2017', 'RTM '),
(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'),
(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'),
(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'),
(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'),
Expand Down
13 changes: 10 additions & 3 deletions Uninstall.sql
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,10 @@ BEGIN
FROM sys.procedures P
JOIN #ToDelete D ON D.ProcedureName = P.name;

SELECT @SQL += N'DROP TABLE dbo.SqlServerVersions;' + CHAR(10)
FROM sys.tables
WHERE schema_id = 1 AND name = 'SqlServerVersions';

END
ELSE
BEGIN
Expand All @@ -64,6 +68,12 @@ BEGIN

EXEC sp_executesql @innerSQL, N'@SQL nvarchar(max) OUTPUT', @SQL = @SQL OUTPUT;

SET @innerSQL = N' SELECT @SQL += N''USE ' + @dbname + N';' + NCHAR(10) + N'DROP TABLE dbo.SqlServerVersions;'' + NCHAR(10)
FROM ' + @dbname + N'.sys.tables
WHERE schema_id = 1 AND name = ''SqlServerVersions''';

EXEC sp_executesql @innerSQL, N'@SQL nvarchar(max) OUTPUT', @SQL = @SQL OUTPUT;

FETCH NEXT FROM c INTO @dbname;

END
Expand All @@ -73,9 +83,6 @@ BEGIN

END

IF OBJECT_ID('dbo.SqlServerVersions') IS NOT NULL
DROP TABLE dbo.SqlServerVersions;

PRINT @SQL;

IF(@printOnly = 0)
Expand Down
3 changes: 2 additions & 1 deletion sp_AllNightLog.sql
Original file line number Diff line number Diff line change
Expand Up @@ -26,11 +26,12 @@ ALTER PROCEDURE dbo.sp_AllNightLog
WITH RECOMPILE
AS
SET NOCOUNT ON;
SET STATISTICS XML OFF;

BEGIN;


SELECT @Version = '8.03', @VersionDate = '20210420';
SELECT @Version = '8.04', @VersionDate = '20210530';

IF(@VersionCheckMode = 1)
BEGIN
Expand Down
3 changes: 2 additions & 1 deletion sp_AllNightLog_Setup.sql
Original file line number Diff line number Diff line change
Expand Up @@ -33,10 +33,11 @@ ALTER PROCEDURE dbo.sp_AllNightLog_Setup
WITH RECOMPILE
AS
SET NOCOUNT ON;
SET STATISTICS XML OFF;

BEGIN;

SELECT @Version = '8.03', @VersionDate = '20210420';
SELECT @Version = '8.04', @VersionDate = '20210530';

IF(@VersionCheckMode = 1)
BEGIN
Expand Down
118 changes: 82 additions & 36 deletions sp_Blitz.sql
Original file line number Diff line number Diff line change
Expand Up @@ -34,10 +34,11 @@ ALTER PROCEDURE [dbo].[sp_Blitz]
WITH RECOMPILE
AS
SET NOCOUNT ON;
SET STATISTICS XML OFF;
SET TRANSACTION ISOLATION LEVEL READ UNCOMMITTED;


SELECT @Version = '8.03', @VersionDate = '20210420';
SELECT @Version = '8.04', @VersionDate = '20210530';
SET @OutputType = UPPER(@OutputType);

IF(@VersionCheckMode = 1)
Expand Down Expand Up @@ -428,33 +429,38 @@ AS
AND db_id('rdsadmin') IS NOT NULL
AND EXISTS(SELECT * FROM master.sys.all_objects WHERE name IN ('rds_startup_tasks', 'rds_help_revlogin', 'rds_hexadecimal', 'rds_failover_tracking', 'rds_database_tracking', 'rds_track_change'))
BEGIN
INSERT INTO #SkipChecks (CheckID) VALUES (6);
INSERT INTO #SkipChecks (CheckID) VALUES (29);
INSERT INTO #SkipChecks (CheckID) VALUES (30);
INSERT INTO #SkipChecks (CheckID) VALUES (31);
INSERT INTO #SkipChecks (CheckID) VALUES (40); /* TempDB only has one data file */
INSERT INTO #SkipChecks (CheckID) VALUES (57);
INSERT INTO #SkipChecks (CheckID) VALUES (59);
INSERT INTO #SkipChecks (CheckID) VALUES (61);
INSERT INTO #SkipChecks (CheckID) VALUES (62);
INSERT INTO #SkipChecks (CheckID) VALUES (68);
INSERT INTO #SkipChecks (CheckID) VALUES (69);
INSERT INTO #SkipChecks (CheckID) VALUES (73);
INSERT INTO #SkipChecks (CheckID) VALUES (79);
INSERT INTO #SkipChecks (CheckID) VALUES (92);
INSERT INTO #SkipChecks (CheckID) VALUES (94);
INSERT INTO #SkipChecks (CheckID) VALUES (96);
INSERT INTO #SkipChecks (CheckID) VALUES (98);
INSERT INTO #SkipChecks (CheckID) VALUES (6); /* Security - Jobs Owned By Users per https://github.com/BrentOzarULTD/SQL-Server-First-Responder-Kit/issues/1919 */
INSERT INTO #SkipChecks (CheckID) VALUES (29); /* tables in model database created by users - not allowed */
INSERT INTO #SkipChecks (CheckID) VALUES (40); /* TempDB only has one data file in RDS */
INSERT INTO #SkipChecks (CheckID) VALUES (62); /* Database compatibility level - cannot change in RDS */
INSERT INTO #SkipChecks (CheckID) VALUES (68); /*Check for the last good DBCC CHECKDB date - can't run DBCC DBINFO() */
INSERT INTO #SkipChecks (CheckID) VALUES (69); /* High VLF check - requires DBCC LOGINFO permission */
INSERT INTO #SkipChecks (CheckID) VALUES (73); /* No Failsafe Operator Configured check */
INSERT INTO #SkipChecks (CheckID) VALUES (92); /* Drive info check - requires xp_Fixeddrives permission */
INSERT INTO #SkipChecks (CheckID) VALUES (100); /* Remote DAC disabled */
INSERT INTO #SkipChecks (CheckID) VALUES (123);
INSERT INTO #SkipChecks (CheckID) VALUES (177);
INSERT INTO #SkipChecks (CheckID) VALUES (180); /* 180/181 are maintenance plans */
INSERT INTO #SkipChecks (CheckID) VALUES (181);
INSERT INTO #SkipChecks (CheckID) VALUES (184); /* xp_readerrorlog checking for IFI */
INSERT INTO #SkipChecks (CheckID) VALUES (211); /* xp_regread checking for power saving */
INSERT INTO #SkipChecks (CheckID) VALUES (212); /* xp_regread */
INSERT INTO #SkipChecks (CheckID) VALUES (219);
INSERT INTO #SkipChecks (CheckID) VALUES (177); /* Disabled Internal Monitoring Features check - requires dm_server_registry access */
INSERT INTO #SkipChecks (CheckID) VALUES (180); /* 180/181 are maintenance plans checks - Maint plans not available in RDS*/
INSERT INTO #SkipChecks (CheckID) VALUES (181); /*Find repetitive maintenance tasks*/

-- can check errorlog using rdsadmin.dbo.rds_read_error_log, so allow this check
--INSERT INTO #SkipChecks (CheckID) VALUES (193); /* xp_readerrorlog checking for IFI */

INSERT INTO #SkipChecks (CheckID) VALUES (211); /* xp_regread not allowed - checking for power saving */
INSERT INTO #SkipChecks (CheckID) VALUES (212); /* xp_regread not allowed - checking for additional instances */
INSERT INTO #SkipChecks (CheckID) VALUES (2301); /* sp_validatelogins called by Invalid login defined with Windows Authentication */

-- Following are skipped due to limited permissions in msdb/SQLAgent in RDS
INSERT INTO #SkipChecks (CheckID) VALUES (30); /* SQL Server Agent alerts not configured */
INSERT INTO #SkipChecks (CheckID) VALUES (31); /* check whether we have NO ENABLED operators */
INSERT INTO #SkipChecks (CheckID) VALUES (57); /* SQL Agent Job Runs at Startup */
INSERT INTO #SkipChecks (CheckID) VALUES (59); /* Alerts Configured without Follow Up */
INSERT INTO #SkipChecks (CheckID) VALUES (61); /*SQL Server Agent alerts do not exist for severity levels 19 through 25*/
INSERT INTO #SkipChecks (CheckID) VALUES (79); /* Shrink Database Job check */
INSERT INTO #SkipChecks (CheckID) VALUES (94); /* job failure without operator notification check */
INSERT INTO #SkipChecks (CheckID) VALUES (96); /* Agent alerts for corruption */
INSERT INTO #SkipChecks (CheckID) VALUES (98); /* check for disabled alerts */
INSERT INTO #SkipChecks (CheckID) VALUES (123); /* Agent Jobs Starting Simultaneously */
INSERT INTO #SkipChecks (CheckID) VALUES (219); /* check for alerts that do NOT include event descriptions in their outputs via email/pager/net-send */
INSERT INTO #BlitzResults
( CheckID ,
Priority ,
Expand Down Expand Up @@ -3248,11 +3254,6 @@ AS
'The job ' + [name]
+ ' has not been set up to notify an operator if it fails.' AS Details
FROM msdb.[dbo].[sysjobs] j
INNER JOIN ( SELECT DISTINCT
[job_id]
FROM [msdb].[dbo].[sysjobschedules]
WHERE next_run_date > 0
) s ON j.job_id = s.job_id
WHERE j.enabled = 1
AND j.notify_email_operator_id = 0
AND j.notify_netsend_operator_id = 0
Expand Down Expand Up @@ -8130,16 +8131,30 @@ IF @ProductVersionMajor >= 10 AND NOT EXISTS ( SELECT 1
*/
IF NOT EXISTS ( SELECT 1
FROM #SkipChecks
WHERE DatabaseName IS NULL AND CheckID = 184 )
AND (@ProductVersionMajor >= 13) OR (@ProductVersionMajor = 12 AND @ProductVersionMinor >= 5000)
WHERE DatabaseName IS NULL AND CheckID = 193 )
AND ((@ProductVersionMajor >= 13) OR (@ProductVersionMajor = 12 AND @ProductVersionMinor >= 5000))
BEGIN

IF @Debug IN (1, 2) RAISERROR('Running CheckId [%d].', 0, 1, 184) WITH NOWAIT;
IF @Debug IN (1, 2) RAISERROR('Running CheckId [%d].', 0, 1, 193) WITH NOWAIT;

INSERT INTO #ErrorLog
EXEC sys.xp_readerrorlog 0, 1, N'Database Instant File Initialization: enabled';
-- If this is Amazon RDS, use rdsadmin.dbo.rds_read_error_log
IF LEFT(CAST(SERVERPROPERTY('ComputerNamePhysicalNetBIOS') AS VARCHAR(8000)), 8) = 'EC2AMAZ-'
AND LEFT(CAST(SERVERPROPERTY('MachineName') AS VARCHAR(8000)), 8) = 'EC2AMAZ-'
AND LEFT(CAST(SERVERPROPERTY('ServerName') AS VARCHAR(8000)), 8) = 'EC2AMAZ-'
AND db_id('rdsadmin') IS NOT NULL
AND EXISTS(SELECT * FROM master.sys.all_objects WHERE name IN ('rds_startup_tasks', 'rds_help_revlogin', 'rds_hexadecimal', 'rds_failover_tracking', 'rds_database_tracking', 'rds_track_change'))
BEGIN
INSERT INTO #ErrorLog
EXEC rdsadmin.dbo.rds_read_error_log 0, 1, N'Database Instant File Initialization: enabled';
END
ELSE
BEGIN
INSERT INTO #ErrorLog
EXEC sys.xp_readerrorlog 0, 1, N'Database Instant File Initialization: enabled';
END

IF @@ROWCOUNT > 0
begin
INSERT INTO #BlitzResults
( CheckID ,
[Priority] ,
Expand All @@ -8155,6 +8170,37 @@ IF @ProductVersionMajor >= 10 AND NOT EXISTS ( SELECT 1
'Instant File Initialization Enabled' AS [Finding] ,
'https://www.brentozar.com/go/instant' AS [URL] ,
'The service account has the Perform Volume Maintenance Tasks permission.';
end
else -- if version of sql server has instant_file_initialization_enabled column in dm_server_services, check that too
-- in the event the error log has been cycled and the startup messages are not in the current error log
begin
if EXISTS ( SELECT *
FROM sys.all_objects o
INNER JOIN sys.all_columns c ON o.object_id = c.object_id
WHERE o.name = 'dm_server_services'
AND c.name = 'instant_file_initialization_enabled' )
begin
INSERT INTO #BlitzResults
( CheckID ,
[Priority] ,
FindingsGroup ,
Finding ,
URL ,
Details
)
SELECT
193 AS [CheckID] ,
250 AS [Priority] ,
'Server Info' AS [FindingsGroup] ,
'Instant File Initialization Enabled' AS [Finding] ,
'https://www.brentozar.com/go/instant' AS [URL] ,
'The service account has the Perform Volume Maintenance Tasks permission.'
where exists (select 1 FROM sys.dm_server_services
WHERE instant_file_initialization_enabled = 'Y'
AND filename LIKE '%sqlservr.exe%')
OPTION (RECOMPILE);
end;
end;
END;

/* Server Info - Instant File Initialization Not Enabled - Check 192 - SQL Server 2016 SP1 and newer */
Expand Down
3 changes: 2 additions & 1 deletion sp_BlitzAnalysis.sql
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,9 @@ ALTER PROCEDURE [dbo].[sp_BlitzAnalysis] (
)
AS
SET NOCOUNT ON;
SET STATISTICS XML OFF;

SELECT @Version = '8.03', @VersionDate = '20210420';
SELECT @Version = '8.04', @VersionDate = '20210530';

IF(@VersionCheckMode = 1)
BEGIN
Expand Down
3 changes: 2 additions & 1 deletion sp_BlitzBackups.sql
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,10 @@ WITH RECOMPILE
AS
BEGIN
SET NOCOUNT ON;
SET STATISTICS XML OFF;
SET TRANSACTION ISOLATION LEVEL READ UNCOMMITTED;

SELECT @Version = '8.03', @VersionDate = '20210420';
SELECT @Version = '8.04', @VersionDate = '20210530';

IF(@VersionCheckMode = 1)
BEGIN
Expand Down
Loading

0 comments on commit 60352a5

Please sign in to comment.