Skip to content

Commit 6348b34

Browse files
committed
Merge pull request #261 from BrentOzarULTD/sp_Blitz-v52
Sp Blitz v52
2 parents 937d1ca + 4b62e2c commit 6348b34

File tree

1 file changed

+80
-5
lines changed

1 file changed

+80
-5
lines changed

sp_Blitz.sql

Lines changed: 80 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -26,17 +26,18 @@ ALTER PROCEDURE [dbo].[sp_Blitz]
2626
@EmailRecipients VARCHAR(MAX) = NULL ,
2727
@EmailProfile sysname = NULL ,
2828
@SummaryMode TINYINT = 0 ,
29+
@BringThePain TINYINT = 0 ,
2930
@Help TINYINT = 0 ,
3031
@Version INT = NULL OUTPUT,
3132
@VersionDate DATETIME = NULL OUTPUT
3233
AS
3334
SET NOCOUNT ON;
3435
SET TRANSACTION ISOLATION LEVEL READ UNCOMMITTED;
35-
SELECT @Version = 51, @VersionDate = '20160517'
36+
SELECT @Version = 51, @VersionDate = '20160518'
3637

3738
IF @Help = 1 PRINT '
3839
/*
39-
sp_Blitz (TM) v51 - 2016/05/17
40+
sp_Blitz (TM) v51 - 2016/05/18
4041
4142
(C) 2016, Brent Ozar Unlimited.
4243
See http://BrentOzar.com/go/eula for the End User Licensing Agreement.
@@ -58,7 +59,14 @@ AS
5859
Unknown limitations of this version:
5960
- None. (If we knew them, they would be known. Duh.)
6061
61-
Changes in v51 - 2016/05/17
62+
Changes in v51 - 2016/05/18
63+
- Thomas Rushton added a check for dangerous third-party modules. (179)
64+
More info: https://support.microsoft.com/en-us/kb/2033238
65+
- New check for snapshot backups possibly freezing IO. Looking for 50GB+
66+
backups that complete in under 60 seconds. (178)
67+
- If there are 50+ user databases, you have to turn on @BringThePain = 1
68+
in order to do @CheckUserDatabaseObjects = 1. (Speeds up sp_Blitz on
69+
servers with hundreds or thousands of databases.)
6270
- Reprioritized a bunch of checks, like moving security warnings down to
6371
priority 230, so that you can use @IgnorePrioritiesAbove = 50 better.
6472
- Bug fixes.
@@ -433,6 +441,14 @@ AS
433441
IF @OutputType = 'CSV'
434442
SET @CheckProcedureCache = 0;
435443

444+
/* Only run CheckUserDatabaseObjects if there are less than 50 databases. */
445+
IF @BringThePain = 0 AND 50 <= (SELECT COUNT(*) FROM sys.databases) AND @CheckUserDatabaseObjects = 1
446+
BEGIN
447+
SET @CheckUserDatabaseObjects = 0;
448+
PRINT 'Running sp_Blitz @CheckUserDatabaseObjects = 1 on a server with 50+ databases may cause temporary insanity for the server and/or user.';
449+
PRINT 'If you''re sure you want to do this, run again with the parameter @BringThePain = 1.';
450+
END
451+
436452
/* Sanitize our inputs */
437453
SELECT
438454
@OutputDatabaseName = QUOTENAME(@OutputDatabaseName),
@@ -699,6 +715,37 @@ AS
699715
ORDER BY backup_set_id ASC;
700716
END
701717

718+
IF NOT EXISTS ( SELECT 1
719+
FROM #SkipChecks
720+
WHERE DatabaseName IS NULL AND CheckID = 178 )
721+
AND EXISTS (SELECT *
722+
FROM msdb.dbo.backupset bs
723+
WHERE bs.type = 'D'
724+
AND bs.compressed_backup_size >= 50000000000 /* At least 50GB */
725+
AND DATEDIFF(SECOND, bs.backup_start_date, bs.backup_finish_date) <= 60 /* Backup took less than 60 seconds */
726+
AND bs.backup_finish_date >= DATEADD(DAY, -14, GETDATE()) /* In the last 2 weeks */)
727+
BEGIN
728+
INSERT INTO #BlitzResults
729+
( CheckID ,
730+
Priority ,
731+
FindingsGroup ,
732+
Finding ,
733+
URL ,
734+
Details
735+
)
736+
SELECT 178 AS CheckID ,
737+
200 AS Priority ,
738+
'Performance' AS FindingsGroup ,
739+
'Snapshot Backups Occurring' AS Finding ,
740+
'http://BrentOzar.com/go/snaps' AS URL ,
741+
( CAST(COUNT(*) AS VARCHAR(20)) + ' snapshot-looking backups have occurred in the last two weeks, indicating that IO may be freezing up.') AS Details
742+
FROM msdb.dbo.backupset bs
743+
WHERE bs.type = 'D'
744+
AND bs.compressed_backup_size >= 50000000000 /* At least 50GB */
745+
AND DATEDIFF(SECOND, bs.backup_start_date, bs.backup_finish_date) <= 60 /* Backup took less than 60 seconds */
746+
AND bs.backup_finish_date >= DATEADD(DAY, -14, GETDATE()) /* In the last 2 weeks */
747+
END
748+
702749
IF NOT EXISTS ( SELECT 1
703750
FROM #SkipChecks
704751
WHERE DatabaseName IS NULL AND CheckID = 4 )
@@ -2084,7 +2131,8 @@ AS
20842131
FROM msdb.dbo.sysschedules sched
20852132
JOIN msdb.dbo.sysjobschedules jsched ON sched.schedule_id = jsched.schedule_id
20862133
JOIN msdb.dbo.sysjobs j ON jsched.job_id = j.job_id
2087-
WHERE sched.freq_type = 64;
2134+
WHERE sched.freq_type = 64
2135+
AND sched.enabled = 1;
20882136
END
20892137

20902138

@@ -3195,7 +3243,7 @@ IF @ProductVersionMajor >= 10 AND @ProductVersionMinor >= 50
31953243
FROM sys.all_objects
31963244
WHERE name = 'dm_server_memory_dumps' )
31973245
BEGIN
3198-
IF EXISTS (SELECT * FROM [sys].[dm_server_memory_dumps] WHERE [creation_time] >= DATEADD(year, -1, GETDATE()))
3246+
IF 5 <= (SELECT COUNT(*) FROM [sys].[dm_server_memory_dumps] WHERE [creation_time] >= DATEADD(year, -1, GETDATE()))
31993247
INSERT INTO [#BlitzResults]
32003248
( [CheckID] ,
32013249
[Priority] ,
@@ -3384,6 +3432,33 @@ IF @ProductVersionMajor >= 10 AND @ProductVersionMinor >= 50
33843432
END
33853433

33863434

3435+
/* Reliability - Dangerous Third Party Modules - 179 */
3436+
IF NOT EXISTS ( SELECT 1
3437+
FROM #SkipChecks
3438+
WHERE DatabaseName IS NULL AND CheckID = 179 )
3439+
BEGIN
3440+
INSERT INTO [#BlitzResults]
3441+
( [CheckID] ,
3442+
[Priority] ,
3443+
[FindingsGroup] ,
3444+
[Finding] ,
3445+
[URL] ,
3446+
[Details] )
3447+
3448+
SELECT
3449+
179 AS [CheckID] ,
3450+
5 AS [Priority] ,
3451+
'Reliability' AS [FindingsGroup] ,
3452+
'Dangerous Third Party Modules' AS [Finding] ,
3453+
'https://support.microsoft.com/en-us/kb/2033238' AS [URL] ,
3454+
( COALESCE(company, '') + ' - ' + COALESCE(description, '') + ' - ' + COALESCE(name, '') + ' - suspected dangerous third party module is installed.') AS [Details]
3455+
FROM sys.dm_os_loaded_modules
3456+
WHERE UPPER(name) LIKE UPPER('%\ENTAPI.DLL') /* McAfee VirusScan Enterprise */
3457+
OR UPPER(name) LIKE UPPER('%\HIPI.DLL') OR UPPER(name) LIKE UPPER('%\HcSQL.dll') OR UPPER(name) LIKE UPPER('%\HcApi.dll') OR UPPER(name) LIKE UPPER('%\HcThe.dll') /* McAfee Host Intrusion */
3458+
OR UPPER(name) LIKE UPPER('%\SOPHOS_DETOURED.DLL') OR UPPER(name) LIKE UPPER('%\SOPHOS_DETOURED_x64.DLL') OR UPPER(name) LIKE UPPER('%\SWI_IFSLSP_64.dll') /* Sophos AV */
3459+
OR UPPER(name) LIKE UPPER('%\PIOLEDB.DLL') OR UPPER(name) LIKE UPPER('%\PISDK.DLL') /* OSISoft PI data access */
3460+
3461+
END
33873462

33883463

33893464

0 commit comments

Comments
 (0)