Here is a script to find out database’s file (either Data file-MDF or Log File – LDF ) growth details. To find this we can use MSDB’s two tables, one is backupfile table which Contains one row for each data or log file of a database and secondone is backupset table which Contains a row for each backup set.

Script is as below.

SELECT BS.database_name
       ,BF.logical_name
       ,file_type
       ,
BF.file_size/(1024*1024) FileSize_MB
       ,
BS.backup_finish_date
       ,BF.physical_name
FROM 
msdb.dbo.backupfile BF
INNER 
JOIN msdb.dbo.backupset BS ON BS.backup_set_id = BF.backup_set_id
AND 
BS.database_name‘VirendraTest’ — Database Name
WHERE 
logical_name VirendraTest’    — DB’s Logical Name
ORDER 
BY BS.backup_finish_date DESC

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s