Quantcast
Channel: kristofdba – kristof dba
Viewing all articles
Browse latest Browse all 26

Get Database Sizes

$
0
0

With this nifty little bugger you’ll get the database sizes listed.
#datasize #size

With fs
as
(
select database_id, type, size * 8.0 / 1024 size
from sys.master_files
)
select
name,
(select sum(size) from fs where type = 0 and fs.database_id = db.database_id) DataFileSizeMB,
(select sum(size) from fs where type = 1 and fs.database_id = db.database_id) LogFileSizeMB
from sys.databases db
order by DataFileSizeMB



Viewing all articles
Browse latest Browse all 26

Trending Articles