Use below script to track database growth over a period of time:
WITH C AS (
SELECT
RN = ROW_NUMBER() OVER( ORDER BY Backup_Start_Date DESC),
BackupDate = CONVERT(VARCHAR(10), Backup_Start_Date, 111),
SizeInMB = FLOOR(Backup_Size/1024000)
FROM msdb.dbo.BackupSet
WHERE Database_Name = DB_NAME() -- put your databaseName here
AND Type = 'd'
) SELECT C.* , Diff = SizeInMB - (SELECT SizeInMB FROM C C2 WHERE RN = C.RN + 1) FROM C ORDER BY 1 ASC
WITH C AS (
SELECT
RN = ROW_NUMBER() OVER( ORDER BY Backup_Start_Date DESC),
BackupDate = CONVERT(VARCHAR(10), Backup_Start_Date, 111),
SizeInMB = FLOOR(Backup_Size/1024000)
FROM msdb.dbo.BackupSet
WHERE Database_Name = DB_NAME() -- put your databaseName here
AND Type = 'd'
) SELECT C.* , Diff = SizeInMB - (SELECT SizeInMB FROM C C2 WHERE RN = C.RN + 1) FROM C ORDER BY 1 ASC
No comments:
Post a Comment