Sunday, December 4, 2016

Microsoft SQL server - Find size of the Log files

Below script will help you to find the size of the log files in your db (data file,log file etc)
you can put the name of the database replacing "yourDb"
and if you need to get all the files details of the all the databases, just omit the filter where caluse


SELECT DB_NAME(database_id) AS DatabaseName,
Name AS Logical_Name,
Physical_Name, (size*8)/1024 SizeMB
FROM sys.master_files
WHERE DB_NAME(database_id) = 'yourDb'
GO