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
Copy file name to clipboardExpand all lines: sp_Blitz.sql
+62-15Lines changed: 62 additions & 15 deletions
Original file line number
Diff line number
Diff line change
@@ -888,6 +888,40 @@ AS
888
888
)
889
889
BEGIN
890
890
891
+
/*
892
+
Extract DBCC DBINFO data from the server. This data is used for check 2 using
893
+
the dbi_LastLogBackupTime field and check 68 using the dbi_LastKnownGood field.
894
+
NB: DBCC DBINFO is not available on AWS RDS databases so if the server is RDS
895
+
(which will have previously triggered inserting a checkID 223 record) and at
896
+
least one of the relevant checks is not being skipped then we can extract the
897
+
dbinfo information.
898
+
*/
899
+
IFNOTEXISTS ( SELECT1
900
+
FROM #BlitzResults
901
+
WHERE CheckID =223ANDURL='https://aws.amazon.com/rds/sqlserver/')
902
+
AND (
903
+
NOTEXISTS ( SELECT1
904
+
FROM #SkipChecks
905
+
WHERE DatabaseName ISNULLAND CheckID =2 )
906
+
ORNOTEXISTS ( SELECT1
907
+
FROM #SkipChecks
908
+
WHERE DatabaseName ISNULLAND CheckID =68 )
909
+
)
910
+
BEGIN
911
+
912
+
IF @Debug IN (1, 2) RAISERROR('Extracting DBCC DBINFO data (used in checks 2 and 68).', 0, 1, 68) WITHNOWAIT;
913
+
914
+
EXEC sp_MSforeachdb N'USE [?];
915
+
SET TRANSACTION ISOLATION LEVEL READ UNCOMMITTED;
916
+
INSERT #DBCCs
917
+
(ParentObject,
918
+
Object,
919
+
Field,
920
+
Value)
921
+
EXEC (''DBCC DBInfo() With TableResults, NO_INFOMSGS'');
922
+
UPDATE #DBCCs SET DbName = N''?'' WHERE DbName IS NULL OPTION (RECOMPILE);';
923
+
END
924
+
891
925
/*
892
926
Our very first check! We'll put more comments in this one just to
893
927
explain exactly how it works. First, we check to see if we're
@@ -1033,6 +1067,7 @@ AS
1033
1067
'https://www.brentozar.com/go/biglogs'ASURL ,
1034
1068
( '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
1069
FROMmaster.sys.databases d
1070
+
LEFT JOIN #DBCCs ll Onll.DbName=d.nameAndll.Field='dbi_LastLogBackupTime'
0 commit comments