码迷,mamicode.com
首页 > 数据库 > 详细

A SQL Query to find database files

时间:2014-06-18 19:25:20      阅读:233      评论:0      收藏:0      [点我收藏+]

标签:des   style   class   blog   code   color   

 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

 

A SQL Query to find database files,布布扣,bubuko.com

A SQL Query to find database files

标签:des   style   class   blog   code   color   

原文地址:http://www.cnblogs.com/isharegallery/p/3790658.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!