--============================================================================ --查看数据库文件大小 SELECT DB_NAME(F.database_id) AS DBName, F.name AS LogicName, F.size*8/1024 AS SizeMB FROM sys.master_files F INNER JOIN sys.databases D ON D.database_id=F.database_id INNER JOIN sys.database_mirroring dm on D.database_id=dm.database_id AND (dm.mirroring_guid IS NULL OR dm.mirroring_role=1) WHERE F.database_id>4 ORDER BY SizeMB DESC --============================================================================