diff --git a/sp_BlitzBackups.sql b/sp_BlitzBackups.sql index 5d3d18ab..0fcd35aa 100755 --- a/sp_BlitzBackups.sql +++ b/sp_BlitzBackups.sql @@ -975,18 +975,18 @@ RAISERROR('Rules analysis starting', 0, 1) WITH NOWAIT; 100 AS [Priority], b.database_name AS [Database Name], ''No CHECKSUMS'' AS [Finding], - ''The database '' + QUOTENAME(b.database_name) + '' has been backed up '' + CONVERT(VARCHAR(10), COUNT(*)) + '' times without CHECKSUMS in the past 30 days. CHECKSUMS can help alert you to corruption errors.'' AS [Warning] + ''The database '' + QUOTENAME(b.database_name) + '' has been backed up '' + CONVERT(VARCHAR(10), COUNT(*)) + '' times without CHECKSUMS. CHECKSUMS can help alert you to corruption errors.'' AS [Warning] FROM ' + QUOTENAME(@MSDBName) + N'.dbo.backupset AS b WHERE b.has_backup_checksums = 0 - AND b.backup_finish_date >= DATEADD(DAY, -30, SYSDATETIME()) + AND b.backup_finish_date >= @StartTime GROUP BY b.database_name;' + @crlf; IF @Debug = 1 PRINT @StringToExecute; INSERT #Warnings ( CheckId, Priority, DatabaseName, Finding, Warning ) - EXEC sys.sp_executesql @StringToExecute; - + EXEC sys.sp_executesql @StringToExecute, N'@StartTime DATETIME2', @StartTime; + /*Damaged is a Black Flag album. You don''t want your backups to be like a Black Flag album. */ SET @StringToExecute = N'SET TRANSACTION ISOLATION LEVEL READ UNCOMMITTED;' + @crlf; @@ -1089,17 +1089,17 @@ IF @ProductVersionMajor >= 12 100 AS [Priority], b.database_name AS [Database Name], ''Uncompressed backups'' AS [Finding], - ''The database '' + QUOTENAME(b.database_name) + '' has had '' + CONVERT(VARCHAR(10), COUNT(*)) + '' uncompressed backups in the last 30 days. This is a free way to save time and space. And SPACETIME. If your version of SQL supports it.'' AS [Warning] + ''The database '' + QUOTENAME(b.database_name) + '' has had '' + CONVERT(VARCHAR(10), COUNT(*)) + '' uncompressed backups. This is a free way to save time and space. And SPACETIME. If your version of SQL supports it.'' AS [Warning] FROM ' + QUOTENAME(@MSDBName) + '.dbo.backupset AS b WHERE backup_size = compressed_backup_size AND type = ''D'' - AND b.backup_finish_date >= DATEADD(DAY, -30, SYSDATETIME()) + AND b.backup_finish_date >= @StartTime GROUP BY b.database_name;' + @crlf; IF @Debug = 1 PRINT @StringToExecute; INSERT #Warnings ( CheckId, Priority, DatabaseName, Finding, Warning ) - EXEC sys.sp_executesql @StringToExecute; + EXEC sys.sp_executesql @StringToExecute, N'@StartTime DATETIME2', @StartTime; /*Looking for backups directed at the NUL device.*/ SET @StringToExecute =N'SET TRANSACTION ISOLATION LEVEL READ UNCOMMITTED;' + @crlf;