Wednesday, March 16, 2011

Query to Get database Size;

I was trying to list the size of all databases in a particular server. This query gave me that information.


SELECT SUM(size*8/1024) SizeINMB,db_name(database_id) as DbName
FROM (SELECT distinct size,database_id FROM sys.master_files) F1
GROUP BY database_id

I could also use a powershell script to go against bunch of servers for inventory purposes.
Thanks




No comments:

Post a Comment