Sql Server track database data file size increase for any given database.
- Posted by Sqltimes
- On May 16, 2013
- 0 Comments
Quick one:
Using this query you can check the size of a database file and track its growth in the last few days.
MSDB database, when it performs backup, I guess it measures each databases current file size (and other calculations) before performing a backup. So we could leverage this data to map the overall growth in the database file size.
[sourcecode language=”sql”]
SELECT BS.database_name
, BF.logical_name
, BF.file_size/(1024*1024*1024)
, BS.backup_finish_date
, BF.physical_name
FROM msdb.dbo.backupfile BF
INNER JOIN msdb.dbo.backupset AS BS
ON BS.backup_set_id = BF.backup_set_id
AND BS.database_name = ‘NKEnterprise’ — name of the database
WHERE logical_name = ‘NKEnterprise_Data’ — I want to know the growth this particular data file
ORDER BY BS.backup_finish_date
[/sourcecode]
Hope this helps,
_Sqltimes
0 Comments