Skip to content

Commit 860cd76

Browse files
authored
Merge pull request #1084 from BrentOzarULTD/issue_1062/brent
#1062 sp_Blitz ignore normal DBCC events
2 parents 4fdcad4 + 5bd9ee7 commit 860cd76

File tree

1 file changed

+28
-7
lines changed

1 file changed

+28
-7
lines changed

sp_Blitz.sql

Lines changed: 28 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -4552,13 +4552,34 @@ IF @ProductVersionMajor >= 10
45524552
'. This does not include CHECKDB and other usually benign DBCC events.'
45534553
AS Details
45544554
FROM #dbcc_events_from_trace d
4555-
WHERE d.[dbcc_event_trunc_upper] NOT IN (
4556-
N'DBCC CHECKDB', N' DBCC CHECKALLOC' , N'DBCC CHECKTABLE', N'DBCC CHECKCATALOG', N'DBCC CHECKFILEGROUP', --CHECKDB related
4557-
N'DBCC TRACEON', N'DBCC TRACEOFF', N'DBCC DBINFO', N'DBCC LOGINFO', N'DBCC INPUTBUFFER', N'DBCC TRACESTATUS', --Usually monitoring tool related
4558-
N'DBCC CHECKIDENT', N'DBCC SHOW_STATISTICS', N'DBCC CHECKCONSTRAINTS', --Probably rational
4559-
N'DBCC CLEANTABLE', N'DBCC CHECKPRIMARYFILE', N'DBCC OPENTRAN', 'DBCC SHOWFILESTATS' --Weird but okay
4560-
)
4561-
AND d.dbcc_event_full_upper NOT IN('DBCC SQLPERF(NETSTATS)', 'DBCC SQLPERF(LOGSPACE)')
4555+
/* This WHERE clause below looks horrible, but it's because users can run stuff like
4556+
DBCC LOGINFO
4557+
with lots of spaces (or carriage returns, or comments) in between the DBCC and the
4558+
command they're trying to run. See Github issues 1062, 1074, 1075.
4559+
*/
4560+
WHERE d.dbcc_event_full_upper NOT LIKE '%DBCC%ADDINSTANCE%'
4561+
AND d.dbcc_event_full_upper NOT LIKE '%DBCC%CHECKALLOC%'
4562+
AND d.dbcc_event_full_upper NOT LIKE '%DBCC%CHECKCATALOG%'
4563+
AND d.dbcc_event_full_upper NOT LIKE '%DBCC%CHECKCONSTRAINTS%'
4564+
AND d.dbcc_event_full_upper NOT LIKE '%DBCC%CHECKFILEGROUP%'
4565+
AND d.dbcc_event_full_upper NOT LIKE '%DBCC%CHECKIDENT%'
4566+
AND d.dbcc_event_full_upper NOT LIKE '%DBCC%CHECKPRIMARYFILE%'
4567+
AND d.dbcc_event_full_upper NOT LIKE '%DBCC%CHECKTABLE%'
4568+
AND d.dbcc_event_full_upper NOT LIKE '%DBCC%CLEANTABLE%'
4569+
AND d.dbcc_event_full_upper NOT LIKE '%DBCC%DBINFO%'
4570+
AND d.dbcc_event_full_upper NOT LIKE '%DBCC%ERRORLOG%'
4571+
AND d.dbcc_event_full_upper NOT LIKE '%DBCC%INCREMENTINSTANCE%'
4572+
AND d.dbcc_event_full_upper NOT LIKE '%DBCC%INPUTBUFFER%'
4573+
AND d.dbcc_event_full_upper NOT LIKE '%DBCC%LOGINFO%'
4574+
AND d.dbcc_event_full_upper NOT LIKE '%DBCC%OPENTRAN%'
4575+
AND d.dbcc_event_full_upper NOT LIKE '%DBCC%SETINSTANCE%'
4576+
AND d.dbcc_event_full_upper NOT LIKE '%DBCC%SHOWFILESTATS%'
4577+
AND d.dbcc_event_full_upper NOT LIKE '%DBCC%SHOW_STATISTICS%'
4578+
AND d.dbcc_event_full_upper NOT LIKE '%DBCC%SQLPERF%NETSTATS%'
4579+
AND d.dbcc_event_full_upper NOT LIKE '%DBCC%SQLPERF%LOGSPACE%'
4580+
AND d.dbcc_event_full_upper NOT LIKE '%DBCC%TRACEON%'
4581+
AND d.dbcc_event_full_upper NOT LIKE '%DBCC%TRACEOFF%'
4582+
AND d.dbcc_event_full_upper NOT LIKE '%DBCC%TRACESTATUS%'
45624583
AND d.application_name NOT LIKE 'Critical Care(R) Collector'
45634584
AND d.application_name NOT LIKE '%Red Gate Software Ltd SQL Prompt%'
45644585
AND d.application_name NOT LIKE '%Spotlight Diagnostic Server%'

0 commit comments

Comments
 (0)