Skip to content

Commit 5bd9ee7

Browse files
committed
#1062 sp_Blitz ignore normal DBCC events
Ignores SQLPERF LOGSPACE and a few other normal events. Closes #1062, #1074, #1075.
1 parent 066f58c commit 5bd9ee7

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
@@ -4524,13 +4524,34 @@ IF @ProductVersionMajor >= 10
45244524
'. This does not include CHECKDB and other usually benign DBCC events.'
45254525
AS Details
45264526
FROM #dbcc_events_from_trace d
4527-
WHERE d.[dbcc_event_trunc_upper] NOT IN (
4528-
N'DBCC CHECKDB', N' DBCC CHECKALLOC' , N'DBCC CHECKTABLE', N'DBCC CHECKCATALOG', N'DBCC CHECKFILEGROUP', --CHECKDB related
4529-
N'DBCC TRACEON', N'DBCC TRACEOFF', N'DBCC DBINFO', N'DBCC LOGINFO', N'DBCC INPUTBUFFER', N'DBCC TRACESTATUS', --Usually monitoring tool related
4530-
N'DBCC CHECKIDENT', N'DBCC SHOW_STATISTICS', N'DBCC CHECKCONSTRAINTS', --Probably rational
4531-
N'DBCC CLEANTABLE', N'DBCC CHECKPRIMARYFILE', N'DBCC OPENTRAN', 'DBCC SHOWFILESTATS' --Weird but okay
4532-
)
4533-
AND d.dbcc_event_full_upper NOT IN('DBCC SQLPERF(NETSTATS)', 'DBCC SQLPERF(LOGSPACE)')
4527+
/* This WHERE clause below looks horrible, but it's because users can run stuff like
4528+
DBCC LOGINFO
4529+
with lots of spaces (or carriage returns, or comments) in between the DBCC and the
4530+
command they're trying to run. See Github issues 1062, 1074, 1075.
4531+
*/
4532+
WHERE d.dbcc_event_full_upper NOT LIKE '%DBCC%ADDINSTANCE%'
4533+
AND d.dbcc_event_full_upper NOT LIKE '%DBCC%CHECKALLOC%'
4534+
AND d.dbcc_event_full_upper NOT LIKE '%DBCC%CHECKCATALOG%'
4535+
AND d.dbcc_event_full_upper NOT LIKE '%DBCC%CHECKCONSTRAINTS%'
4536+
AND d.dbcc_event_full_upper NOT LIKE '%DBCC%CHECKFILEGROUP%'
4537+
AND d.dbcc_event_full_upper NOT LIKE '%DBCC%CHECKIDENT%'
4538+
AND d.dbcc_event_full_upper NOT LIKE '%DBCC%CHECKPRIMARYFILE%'
4539+
AND d.dbcc_event_full_upper NOT LIKE '%DBCC%CHECKTABLE%'
4540+
AND d.dbcc_event_full_upper NOT LIKE '%DBCC%CLEANTABLE%'
4541+
AND d.dbcc_event_full_upper NOT LIKE '%DBCC%DBINFO%'
4542+
AND d.dbcc_event_full_upper NOT LIKE '%DBCC%ERRORLOG%'
4543+
AND d.dbcc_event_full_upper NOT LIKE '%DBCC%INCREMENTINSTANCE%'
4544+
AND d.dbcc_event_full_upper NOT LIKE '%DBCC%INPUTBUFFER%'
4545+
AND d.dbcc_event_full_upper NOT LIKE '%DBCC%LOGINFO%'
4546+
AND d.dbcc_event_full_upper NOT LIKE '%DBCC%OPENTRAN%'
4547+
AND d.dbcc_event_full_upper NOT LIKE '%DBCC%SETINSTANCE%'
4548+
AND d.dbcc_event_full_upper NOT LIKE '%DBCC%SHOWFILESTATS%'
4549+
AND d.dbcc_event_full_upper NOT LIKE '%DBCC%SHOW_STATISTICS%'
4550+
AND d.dbcc_event_full_upper NOT LIKE '%DBCC%SQLPERF%NETSTATS%'
4551+
AND d.dbcc_event_full_upper NOT LIKE '%DBCC%SQLPERF%LOGSPACE%'
4552+
AND d.dbcc_event_full_upper NOT LIKE '%DBCC%TRACEON%'
4553+
AND d.dbcc_event_full_upper NOT LIKE '%DBCC%TRACEOFF%'
4554+
AND d.dbcc_event_full_upper NOT LIKE '%DBCC%TRACESTATUS%'
45344555
AND d.application_name NOT LIKE 'Critical Care(R) Collector'
45354556
AND d.application_name NOT LIKE '%Red Gate Software Ltd SQL Prompt%'
45364557
AND d.application_name NOT LIKE '%Spotlight Diagnostic Server%'

0 commit comments

Comments
 (0)