日期:2014-05-17 浏览次数:20600 次
SELECT substring(text,qs.statement_start_offset/2 ,(CASE WHEN qs.statement_end_offset = -1 THEN len(convert(nvarchar(max), text)) * 2 ELSE qs.statement_end_offset END - qs.statement_start_offset)/2) ,qs.plan_generation_num as recompiles ,qs.execution_count as execution_count ,qs.total_elapsed_time - qs.total_worker_time as total_wait_time ,qs.total_worker_time as cpu_time ,qs.total_logical_reads as reads ,qs.total_logical_writes as writes ,last_execution_time FROM sys.dm_exec_query_stats qs CROSS APPLY sys.dm_exec_sql_text(qs.sql_handle) st LEFT JOIN sys.dm_exec_requests r ON qs.sql_handle = r.sql_handle ORDER BY 3 DESC
------解决方案--------------------
网络连接中 禁用再启用下网卡 试试
------解决方案--------------------
用SQL Profiler工具跟踪一下.
或
--占用CPU最多 SELECT TOP 10 total_worker_time / execution_count AS [Avg CPU Time], (SELECT Substring(text, statement_start_offset / 2, ( CASE WHEN statement_end_offset = -1 THEN Len(CONVERT(NVARCHAR(max), text)) * 2 ELSE statement_end_offset END - statement_start_offset ) / 2) FROM sys.Dm_exec_sql_text(sql_handle)) AS query_text, * FROM sys.dm_exec_query_stats ORDER BY [Avg CPU Time] DESC 找到后分析问题所在
------解决方案--------------------
应该是程序连接上后执行了什么耗CPU的SQL语句,
用SQL Profiler工具跟踪一下.
------解决方案--------------------
连接进去以后SYSPROCESS中看到有什么信息吗?有没有什么耗资源的执行?