我正在尝试估算数据库大小及其压缩备份。我在查询下运行以检查大小,并能够在几周左右的时间内大致了解数据库的增长量。但是,当我在查询下运行时,由于某种原因我得到重复的结果,我无法弄清楚。任何帮助将不胜感激。
SELECT
CONVERT(VARCHAR(10),backup_start_date, 111) AS BackupDate,
FLOOR( backup_size/1024000000) AS DBSize_GB,
FLOOR(compressed_backup_size/1024000000) AS BackupSize_GB, Database_Name
FROM msdb.dbo.backupset as b
WHERE database_name = @dbname
AND type = 'd'
AND DATEPART(mm,backup_start_date) = @mon --comment this line for all the months
ORDER BY
backup_start_date DESC
结果: Attached here