TA的每日心情 | 开心 2023-8-9 11:05 |
---|
|
楼主 |
发表于 2020-1-13 22:30:18
|
显示全部楼层
- select
- @@total_read [读取磁盘次数],
- @@total_write [写入磁盘次数],
- @@total_errors [磁盘写入错误数],
- getdate() [当前时间]
- -- I/O Statistics by file for the current database (Query 46) (IO Stats By File)
- SELECT DB_NAME(DB_ID()) AS [Database Name], df.name AS [Logical Name], vfs.[file_id],
- df.physical_name AS [Physical Name], vfs.num_of_reads, vfs.num_of_writes, vfs.io_stall_read_ms, vfs.io_stall_write_ms,
- CAST(100. * vfs.io_stall_read_ms/(vfs.io_stall_read_ms + vfs.io_stall_write_ms) AS DECIMAL(10,1)) AS [IO Stall Reads Pct],
- CAST(100. * vfs.io_stall_write_ms/(vfs.io_stall_write_ms + vfs.io_stall_read_ms) AS DECIMAL(10,1)) AS [IO Stall Writes Pct],
- (vfs.num_of_reads + vfs.num_of_writes) AS [Writes + Reads],
- CAST(vfs.num_of_bytes_read/1048576.0 AS DECIMAL(10, 2)) AS [MB Read],
- CAST(vfs.num_of_bytes_written/1048576.0 AS DECIMAL(10, 2)) AS [MB Written],
- CAST(100. * vfs.num_of_reads/(vfs.num_of_reads + vfs.num_of_writes) AS DECIMAL(10,1)) AS [# Reads Pct],
- CAST(100. * vfs.num_of_writes/(vfs.num_of_reads + vfs.num_of_writes) AS DECIMAL(10,1)) AS [# Write Pct],
- CAST(100. * vfs.num_of_bytes_read/(vfs.num_of_bytes_read + vfs.num_of_bytes_written) AS DECIMAL(10,1)) AS [Read Bytes Pct],
- CAST(100. * vfs.num_of_bytes_written/(vfs.num_of_bytes_read + vfs.num_of_bytes_written) AS DECIMAL(10,1)) AS [Written Bytes Pct]
- FROM sys.dm_io_virtual_file_stats(DB_ID(), NULL) AS vfs
- INNER JOIN sys.database_files AS df WITH (NOLOCK)
- ON vfs.[file_id]= df.[file_id] OPTION (RECOMPILE);
复制代码 |
|