SQLServer查询所有数据库大小
with fs
as
(
select database_id, type, size * 8.0 / 1024 size
from sys.master_files
)
select
name,
(select cast(round(sum(size),2) as numeric(15,2)) from fs where type = 0 and fs.database_id = db.database_id) DataFileSizeMB,
(select cast(round(sum(size),2) as numeric(15,2)) from fs where type = 1 and fs.database_id = db.database_id) LogFileSizeMB
from sys.databases db
order by 2 desc;
声明:本站所有文章资源内容,如无特殊说明或标注,均为采集网络资源。如若本站内容侵犯了原著者的合法权益,可联系本站删除。