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