|
859 | 859 | BEGIN |
860 | 860 | IF DATEADD(dd, -60, GETDATE()) > (SELECT TOP 1 backup_start_date FROM msdb.dbo.backupset ORDER BY 1) |
861 | 861 |
|
| 862 | + BEGIN |
| 863 | + |
862 | 864 | IF @Debug IN (1, 2) RAISERROR('Running CheckId [%d].', 0, 1, 3) WITH NOWAIT; |
863 | 865 |
|
864 | 866 | INSERT INTO #BlitzResults |
|
881 | 883 | + CAST(bs.backup_start_date AS VARCHAR(20)) ) AS Details |
882 | 884 | FROM msdb.dbo.backupset bs |
883 | 885 | ORDER BY backup_set_id ASC; |
| 886 | + END; |
884 | 887 | END; |
885 | 888 |
|
886 | 889 | IF NOT EXISTS ( SELECT 1 |
887 | 890 | FROM #SkipChecks |
888 | 891 | WHERE DatabaseName IS NULL AND CheckID = 186 ) |
889 | 892 | BEGIN |
890 | 893 | IF DATEADD(dd, -2, GETDATE()) < (SELECT TOP 1 backup_start_date FROM msdb.dbo.backupset ORDER BY 1) |
| 894 | + |
| 895 | + BEGIN |
891 | 896 |
|
892 | 897 | IF @Debug IN (1, 2) RAISERROR('Running CheckId [%d].', 0, 1, 186) WITH NOWAIT; |
893 | 898 |
|
|
911 | 916 | + CAST(bs.backup_start_date AS VARCHAR(20)) ) AS Details |
912 | 917 | FROM msdb.dbo.backupset bs |
913 | 918 | ORDER BY backup_set_id ASC; |
| 919 | + END; |
914 | 920 | END; |
915 | 921 |
|
916 | 922 | IF NOT EXISTS ( SELECT 1 |
|
1960 | 1966 | WHERE severity BETWEEN 19 AND 25 |
1961 | 1967 | ) < 7 |
1962 | 1968 |
|
| 1969 | + BEGIN |
| 1970 | + |
1963 | 1971 | IF @Debug IN (1, 2) RAISERROR('Running CheckId [%d].', 0, 1, 30) WITH NOWAIT; |
1964 | 1972 |
|
1965 | 1973 | INSERT INTO #BlitzResults |
|
1976 | 1984 | 'Not All Alerts Configured' AS Finding , |
1977 | 1985 | 'https://BrentOzar.com/go/alert' AS URL , |
1978 | 1986 | ( 'Not all SQL Server Agent alerts have been configured. This is a free, easy way to get notified of corruption, job failures, or major outages even before monitoring systems pick it up.' ) AS Details; |
| 1987 | + END; |
1979 | 1988 | END; |
1980 | 1989 |
|
1981 | 1990 |
|
|
1990 | 1999 | AND COALESCE(has_notification, 0) = 0 |
1991 | 2000 | AND (job_id IS NULL OR job_id = 0x)) |
1992 | 2001 |
|
| 2002 | + BEGIN |
| 2003 | + |
1993 | 2004 | IF @Debug IN (1, 2) RAISERROR('Running CheckId [%d].', 0, 1, 59) WITH NOWAIT; |
1994 | 2005 |
|
1995 | 2006 | INSERT INTO #BlitzResults |
|
2006 | 2017 | 'Alerts Configured without Follow Up' AS Finding , |
2007 | 2018 | 'https://BrentOzar.com/go/alert' AS URL , |
2008 | 2019 | ( 'SQL Server Agent alerts have been configured but they either do not notify anyone or else they do not take any action. This is a free, easy way to get notified of corruption, job failures, or major outages even before monitoring systems pick it up.' ) AS Details; |
| 2020 | + |
| 2021 | + END; |
2009 | 2022 | END; |
2010 | 2023 |
|
2011 | 2024 | IF NOT EXISTS ( SELECT 1 |
|
2016 | 2029 | FROM msdb.dbo.sysalerts |
2017 | 2030 | WHERE message_id IN ( 823, 824, 825 ) ) |
2018 | 2031 |
|
| 2032 | + BEGIN; |
| 2033 | + |
2019 | 2034 | IF @Debug IN (1, 2) RAISERROR('Running CheckId [%d].', 0, 1, 96) WITH NOWAIT; |
2020 | 2035 |
|
2021 | 2036 | INSERT INTO #BlitzResults |
|
2032 | 2047 | 'No Alerts for Corruption' AS Finding , |
2033 | 2048 | 'https://BrentOzar.com/go/alert' AS URL , |
2034 | 2049 | ( 'SQL Server Agent alerts do not exist for errors 823, 824, and 825. These three errors can give you notification about early hardware failure. Enabling them can prevent you a lot of heartbreak.' ) AS Details; |
| 2050 | + |
| 2051 | + END; |
2035 | 2052 | END; |
2036 | 2053 |
|
2037 | 2054 |
|
|
2043 | 2060 | FROM msdb.dbo.sysalerts |
2044 | 2061 | WHERE severity BETWEEN 19 AND 25 ) |
2045 | 2062 |
|
| 2063 | + BEGIN |
| 2064 | + |
2046 | 2065 | IF @Debug IN (1, 2) RAISERROR('Running CheckId [%d].', 0, 1, 61) WITH NOWAIT; |
2047 | 2066 |
|
2048 | 2067 | INSERT INTO #BlitzResults |
|
2059 | 2078 | 'No Alerts for Sev 19-25' AS Finding , |
2060 | 2079 | 'https://BrentOzar.com/go/alert' AS URL , |
2061 | 2080 | ( 'SQL Server Agent alerts do not exist for severity levels 19 through 25. These are some very severe SQL Server errors. Knowing that these are happening may let you recover from errors faster.' ) AS Details; |
| 2081 | + |
| 2082 | + END; |
| 2083 | + |
2062 | 2084 | END; |
2063 | 2085 |
|
2064 | 2086 | --check for disabled alerts |
|
2070 | 2092 | FROM msdb.dbo.sysalerts |
2071 | 2093 | WHERE enabled = 0 ) |
2072 | 2094 |
|
| 2095 | + BEGIN |
| 2096 | + |
2073 | 2097 | IF @Debug IN (1, 2) RAISERROR('Running CheckId [%d].', 0, 1, 98) WITH NOWAIT; |
2074 | 2098 |
|
2075 | 2099 | INSERT INTO #BlitzResults |
|
2089 | 2113 | + name ) AS Details |
2090 | 2114 | FROM msdb.dbo.sysalerts |
2091 | 2115 | WHERE enabled = 0; |
| 2116 | + |
| 2117 | + END; |
| 2118 | + |
2092 | 2119 | END; |
2093 | 2120 |
|
2094 | 2121 |
|
|
2100 | 2127 | FROM msdb.dbo.sysoperators |
2101 | 2128 | WHERE enabled = 1 ) |
2102 | 2129 |
|
| 2130 | + BEGIN |
| 2131 | + |
2103 | 2132 | IF @Debug IN (1, 2) RAISERROR('Running CheckId [%d].', 0, 1, 31) WITH NOWAIT; |
2104 | 2133 |
|
2105 | 2134 | INSERT INTO #BlitzResults |
|
2116 | 2145 | 'No Operators Configured/Enabled' AS Finding , |
2117 | 2146 | 'https://BrentOzar.com/go/op' AS URL , |
2118 | 2147 | ( 'No SQL Server Agent operators (emails) have been configured. This is a free, easy way to get notified of corruption, job failures, or major outages even before monitoring systems pick it up.' ) AS Details; |
| 2148 | + |
| 2149 | + END; |
2119 | 2150 | END; |
2120 | 2151 |
|
2121 | 2152 |
|
@@ -2337,6 +2368,13 @@ AS |
2337 | 2368 | END; |
2338 | 2369 | END; |
2339 | 2370 |
|
| 2371 | + |
| 2372 | + IF NOT EXISTS ( SELECT 1 |
| 2373 | + FROM #SkipChecks |
| 2374 | + WHERE DatabaseName IS NULL AND CheckID = 183 ) |
| 2375 | + |
| 2376 | + BEGIN |
| 2377 | + |
2340 | 2378 | IF ( SELECT COUNT (distinct [size]) |
2341 | 2379 | FROM tempdb.sys.database_files |
2342 | 2380 | WHERE type_desc = 'ROWS' |
|
2364 | 2402 | 'TempDB data files are not configured with the same size. Unevenly sized tempdb data files will result in unevenly sized workloads.' |
2365 | 2403 | ); |
2366 | 2404 | END; |
| 2405 | + END; |
2367 | 2406 |
|
2368 | 2407 | IF NOT EXISTS ( SELECT 1 |
2369 | 2408 | FROM #SkipChecks |
|
3148 | 3187 |
|
3149 | 3188 |
|
3150 | 3189 | IF DATEADD(mi, -15, GETDATE()) < (SELECT TOP 1 creation_time FROM sys.dm_exec_query_stats ORDER BY creation_time) |
| 3190 | + AND NOT EXISTS ( SELECT 1 |
| 3191 | + FROM #SkipChecks |
| 3192 | + WHERE DatabaseName IS NULL AND CheckID = 125 ) |
3151 | 3193 | BEGIN |
3152 | 3194 |
|
3153 | 3195 | IF @Debug IN (1, 2) RAISERROR('Running CheckId [%d].', 0, 1, 125) WITH NOWAIT; |
|
3166 | 3208 | END; |
3167 | 3209 |
|
3168 | 3210 | IF EXISTS (SELECT * FROM sys.configurations WHERE name = 'priority boost' AND (value = 1 OR value_in_use = 1)) |
| 3211 | + AND NOT EXISTS ( SELECT 1 |
| 3212 | + FROM #SkipChecks |
| 3213 | + WHERE DatabaseName IS NULL AND CheckID = 126 ) |
3169 | 3214 | BEGIN |
3170 | 3215 |
|
3171 | 3216 | IF @Debug IN (1, 2) RAISERROR('Running CheckId [%d].', 0, 1, 126) WITH NOWAIT; |
@@ -3487,6 +3532,10 @@ AS |
3487 | 3532 |
|
3488 | 3533 | IF @TraceFileIssue = 1 |
3489 | 3534 | BEGIN |
| 3535 | + IF NOT EXISTS ( SELECT 1 |
| 3536 | + FROM #SkipChecks |
| 3537 | + WHERE DatabaseName IS NULL AND CheckID = 199 ) |
| 3538 | + |
3490 | 3539 | INSERT INTO #BlitzResults |
3491 | 3540 | ( CheckID , |
3492 | 3541 | DatabaseName , |
@@ -4089,10 +4138,12 @@ IF @ProductVersionMajor >= 10 |
4089 | 4138 | IF NOT EXISTS ( SELECT 1 |
4090 | 4139 | FROM #SkipChecks |
4091 | 4140 | WHERE DatabaseName IS NULL AND CheckID = 176 ) |
| 4141 | + BEGIN |
| 4142 | + |
4092 | 4143 | IF EXISTS ( SELECT 1 |
4093 | 4144 | FROM sys.all_objects |
4094 | 4145 | WHERE name = 'dm_xe_sessions' ) |
4095 | | - BEGIN |
| 4146 | + |
4096 | 4147 | BEGIN |
4097 | 4148 |
|
4098 | 4149 | IF @Debug IN (1, 2) RAISERROR('Running CheckId [%d].', 0, 1, 176) WITH NOWAIT; |
@@ -4127,6 +4178,7 @@ IF @ProductVersionMajor >= 10 |
4127 | 4178 | FROM #SkipChecks |
4128 | 4179 | WHERE DatabaseName IS NULL AND CheckID = 177 ) |
4129 | 4180 | BEGIN |
| 4181 | + |
4130 | 4182 | IF EXISTS ( SELECT 1 |
4131 | 4183 | FROM sys.all_objects |
4132 | 4184 | WHERE name = 'dm_server_registry' ) |
@@ -4483,6 +4535,8 @@ IF @ProductVersionMajor >= 10 |
4483 | 4535 | AND d.application_name NOT LIKE '%Red Gate Software Ltd SQL Prompt%' |
4484 | 4536 | AND d.application_name NOT LIKE '%Spotlight Diagnostic Server%' |
4485 | 4537 | AND d.application_name NOT LIKE '%SQL Diagnostic Manager%' |
| 4538 | + AND d.application_name NOT LIKE '%Sentry%' |
| 4539 | + |
4486 | 4540 |
|
4487 | 4541 | HAVING COUNT(*) > 0; |
4488 | 4542 |
|
@@ -5614,6 +5668,9 @@ IF @ProductVersionMajor >= 10 |
5614 | 5668 | END; /* IF @CheckUserDatabaseObjects = 1 */ |
5615 | 5669 |
|
5616 | 5670 | IF @CheckProcedureCache = 1 |
| 5671 | + |
| 5672 | + IF @Debug IN (1, 2) RAISERROR('Begin checking procedure cache', 0, 1) WITH NOWAIT; |
| 5673 | + |
5617 | 5674 | BEGIN |
5618 | 5675 |
|
5619 | 5676 | IF NOT EXISTS ( SELECT 1 |
|
0 commit comments