1 SELECT 2 DB_NAME(mf.database_id) AS databaseName, 3 name as File_LogicalName, 4 case 5 when type_desc = ‘LOG‘ then ‘Log File‘ 6 when type_desc = ‘ROWS‘ then ‘Data File‘ 7 Else type_desc 8 end as File_type_desc 9 ,mf.physical_name 10 ,num_of_reads 11 ,num_of_bytes_read 12 ,io_stall_read_ms 13 ,num_of_writes 14 ,num_of_bytes_written 15 ,io_stall_write_ms 16 ,io_stall 17 ,size_on_disk_bytes 18 ,size_on_disk_bytes/ 1024 as size_on_disk_KB 19 ,size_on_disk_bytes/ 1024 / 1024 as size_on_disk_MB 20 ,size_on_disk_bytes/ 1024 / 1024 / 1024 as size_on_disk_GB 21 FROM sys.dm_io_virtual_file_stats(NULL, NULL) AS divfs 22 JOIN sys.master_files AS mf ON mf.database_id = divfs.database_id 23 AND mf.file_id = divfs.file_id 24 ORDER BY size_on_disk_MB DESC