In this post, I am providing an SQL Script to find the size of Database Files and Log Files in SQL Server.
I am calculating this size using sys.master_files and perform require division to get size in MB and GB because it is returning 8 KB pages.
The Database Administrator can use this script to get quick size of Database Files and Log Files of a SQL Server. SQL Server Management Studio also provides GUI tools, but still I always use different script to do my DBA task.
db_name(database_id) AS DatabaseName
,type_desc AS TypeDesc
,(size * 8) /1024 AS SizeInMB
,(size * 8) /1024/1024 AS SizeInGB
ORDER BY name
Please share your ideas and opinions about this topic with me, your contribution will add true value to this topic.
If anyone has doubts on this topic then please do let me know by leaving comments or send me an email.
If you like this post, then please share it with others.
Please follow dbrnd.com, I will share my experience towards the success of Database Research and Development Activity.
I put up a post every day, please keep reading and learning.
Discover Yourself, Happy Blogging !
Anvesh M. Patel.