标签:des style blog http io color ar os 使用
http://www.cnblogs.com/CareySon/p/3910337.html
通过下面脚本可以查看某个查询实用的TempDB的空间.
第一步是查询出当下TempDB实用空间是多少,
第二步是执行某查询语句
第三步是用当先TempDB空间-第一步TempDB实用的空间.
DECLARE @read BIGINT, @write BIGINT ; SELECT @read = SUM(num_of_bytes_read), @write = SUM(num_of_bytes_written) FROM tempdb.sys.database_files AS DBF JOIN sys.dm_io_virtual_file_stats(2, NULL) AS FS ON FS.file_id = DBF.file_id WHERE DBF.type_desc = ‘ROWS‘ --这里放入需要测量的语句 SELECT tempdb_read_MB = (SUM(num_of_bytes_read) - @read) / 1024. / 1024., tempdb_write_MB = (SUM(num_of_bytes_written) - @write) / 1024. / 1024., internal_use_MB = ( SELECT internal_objects_alloc_page_count / 128.0 FROM sys.dm_db_task_space_usage WHERE session_id = @@SPID ) FROM tempdb.sys.database_files AS DBF JOIN sys.dm_io_virtual_file_stats(2, NULL) AS FS ON FS.file_id = DBF.file_id WHERE DBF.type_desc = ‘ROWS‘
标签:des style blog http io color ar os 使用
原文地址:http://www.cnblogs.com/yuannfei19841121/p/4104624.html