Search This Blog

Showing posts with label SQL Server track database data file size increase for any given database. Show all posts
Showing posts with label SQL Server track database data file size increase for any given database. Show all posts

SQL Server track database data file size increase for any given database.

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.
1
2
3
4
5
6
7
8
9
10
11
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
DB File Size Growth Track
DB File Size Growth Track
Hope this helps,