You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Extract DBCC DBINFO data from the server. This data is used for check 2 using
892
+
the dbi_LastLogBackupTime field and check 68 using the dbi_LastKnownGood field.
893
+
NB: DBCC DBINFO is not available on AWS RDS databases so if the server is RDS
894
+
(which will have previously triggered inserting a checkID 223 record) and at
895
+
least one of the relevant checks is not being skipped then we can extract the
896
+
dbinfo information.
897
+
*/
898
+
IFNOTEXISTS ( SELECT1
899
+
FROM #BlitzResults
900
+
WHERE CheckID =223ANDURL='https://aws.amazon.com/rds/sqlserver/')
901
+
AND (
902
+
NOTEXISTS ( SELECT1
903
+
FROM #SkipChecks
904
+
WHERE DatabaseName ISNULLAND CheckID =2 )
905
+
ORNOTEXISTS ( SELECT1
906
+
FROM #SkipChecks
907
+
WHERE DatabaseName ISNULLAND CheckID =68 )
908
+
)
909
+
BEGIN
910
+
911
+
IF @Debug IN (1, 2) RAISERROR('Extracting DBCC DBINFO data (used in checks 2 and 68).', 0, 1, 68) WITHNOWAIT;
912
+
913
+
EXEC sp_MSforeachdb N'USE [?];
914
+
SET TRANSACTION ISOLATION LEVEL READ UNCOMMITTED;
915
+
INSERT #DBCCs
916
+
(ParentObject,
917
+
Object,
918
+
Field,
919
+
Value)
920
+
EXEC (''DBCC DBInfo() With TableResults, NO_INFOMSGS'');
921
+
UPDATE #DBCCs SET DbName = N''?'' WHERE DbName IS NULL OPTION (RECOMPILE);';
922
+
END
923
+
891
924
/*
892
925
Our very first check! We'll put more comments in this one just to
893
926
explain exactly how it works. First, we check to see if we're
@@ -1033,6 +1066,7 @@ AS
1033
1066
'https://www.brentozar.com/go/biglogs'ASURL ,
1034
1067
( 'The '+CAST(CAST((SELECT ((SUM([mf].[size]) *8.) /1024.) FROM sys.[master_files] AS [mf] WHERE [mf].[database_id] = d.[database_id] AND [mf].[type_desc] ='LOG') ASDECIMAL(18,2)) ASVARCHAR(30)) +'MB log file has not been backed up in the last week.' ) AS Details
1035
1068
FROMmaster.sys.databases d
1069
+
LEFT JOIN #DBCCs ll Onll.DbName=d.nameAndll.Field='dbi_LastLogBackupTime'
ORUPPER(name) LIKEUPPER('%ANTIVIRUS%'); /* To pick up sqlmaggieAntiVirus_64.dll (malware) or anything else labelled AntiVirus */
5529
+
/* MS docs link for blacklisted modules: https://learn.microsoft.com/en-us/troubleshoot/sql/performance/performance-consistency-issues-filter-drivers-modules */
5480
5530
END;
5481
5531
5482
5532
/*Find shrink database tasks*/
@@ -7286,15 +7336,16 @@ IF @ProductVersionMajor >= 10
7286
7336
7287
7337
IF @Debug IN (1, 2) RAISERROR('Running CheckId [%d].', 0, 1, 68) WITHNOWAIT;
7288
7338
7289
-
EXEC sp_MSforeachdb N'USE [?];
7290
-
SET TRANSACTION ISOLATION LEVEL READ UNCOMMITTED;
7291
-
INSERT #DBCCs
7292
-
(ParentObject,
7293
-
Object,
7294
-
Field,
7295
-
Value)
7296
-
EXEC (''DBCC DBInfo() With TableResults, NO_INFOMSGS'');
7297
-
UPDATE #DBCCs SET DbName = N''?'' WHERE DbName IS NULL OPTION (RECOMPILE);';
7339
+
/* Removed as populating the #DBCCs table now done in advance as data is uses for multiple checks*/
0 commit comments