Search This Blog

Script to find the No of reads/ writes on DB files

SELECT  DB_NAME(mf.database_id) AS databaseName
       ,mf.physical_name
       ,num_of_reads
       ,num_of_bytes_read
       ,io_stall_read_ms
       ,num_of_writes
       ,num_of_bytes_written
       ,io_stall_write_ms
       ,io_stall
       ,size_on_disk_bytes
FROM    sys.dm_io_virtual_file_stats(NULL, NULL) AS divfs
JOIN    sys.master_files AS mf ON mf.database_id = divfs.database_id
                                  AND mf.file_id = divfs.file_id

No comments: