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

sqlserver 查看正在执行sql

时间:2016-06-10 16:18:16      阅读:333      评论:0      收藏:0      [点我收藏+]

标签:

 

SELECT  
  [session_id],
  [request_id],
  [cpu_time],
  [start_time] AS ‘开始时间‘,
  [status] AS ‘状态‘,
  [command] AS ‘命令‘,
  dest.[text] AS ‘sql语句‘,
  [reads] AS ‘物理读次数‘,
  [writes] AS ‘写次数‘,
  [logical_reads] AS ‘逻辑读次数‘,
  [row_count] AS ‘返回结果行数‘,
  [blocking_session_id] AS ‘正在阻塞其他会话的会话ID‘,
  DB_NAME([database_id]) AS ‘数据库名‘,
  [wait_type] AS ‘等待资源类型‘,
  [wait_time] AS ‘等待时间‘,
  [wait_resource] AS ‘等待的资源‘
  FROM sys.[dm_exec_requests] AS der
  CROSS APPLY
  sys.[dm_exec_sql_text](der.[sql_handle]) AS dest
  WHERE 1=1
   ORDER BY [cpu_time] DESC

sqlserver 查看正在执行sql

标签:

原文地址:http://www.cnblogs.com/jacran/p/5573711.html

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