SQL Server Database, database physical physical files and associated reads, writes and IO
The below query will let you know about the databases and their logical, physical names , reads, writes and associated IOs.
SELECT cast(DB_Name(a.database_id) as varchar) as Database_name,
b.physical_name, a.database_id, a.[file_id], b.name as logicalname,
a.num_of_reads, a.num_of_writes, a.num_of_bytes_read, a.num_of_bytes_written,
a.io_stall, a.io_stall_read_ms, a.io_stall_write_ms,a.size_on_disk_bytes,b.type_desc, b.state_desc
FROM sys.dm_io_virtual_file_stats(null, null) a INNER JOIN sys.master_files b
ON a.database_id = b.database_id and a.file_id = b.file_id ORDER BY Database_Name;
|