各个数据库的io比例

select case df.database_id

            when DB_ID('distribution') then 'distDB'

            when DB_ID('tempdb') then 'tempdb'

            --add other needed database

            else 'otherDBs'

        end as dbName,

        case df.type

            when 0 then 'datafile'

            when 1 then 'logfile'

            else 'otherfile'

        end as [type],

        SUM(num_of_reads) as reads,

        SUM(num_of_writes) as writes

         From sys.dm_io_virtual_file_stats(null,null) fs

inner join sys.master_files df on fs.database_id=df.database_id

and fs.file_id=df.file_id

group by case df.database_id

            when DB_ID('distribution') then 'distDB'

            when DB_ID('tempdb') then 'tempdb'

            --add other needed database

            else 'otherDBs'

         end,df.[type]

order by reads desc

https://files.cnblogs.com/stswordman/IO_proportion.zip

原文地址:https://www.cnblogs.com/stswordman/p/1997272.html