mmsql查看最近操作日志
Posted ☆♂安♀★
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了mmsql查看最近操作日志相关的知识,希望对你有一定的参考价值。
SELECT TOP 2000 query_stats.query_hash AS "Query Hash",
Sum(Query_Stats.total_logical_Reads) as Total_Logical_Reads,
Sum(Query_Stats.total_physical_Reads) as Total_physical_Reads,
SUM(query_stats.total_worker_time) / SUM(query_stats.execution_count) AS "Avg CPU Time",
SUM(query_stats.execution_count) as CNT, SUM(query_stats.total_worker_time) as "Total CPU Time",
MIN(query_stats.statement_text) AS "Statement Text"
FROM
(SELECT QS.*,
SUBSTRING(ST.text, (QS.statement_start_offset/2) + 1,
((CASE statement_end_offset
WHEN -1 THEN DATALENGTH(st.text)
ELSE QS.statement_end_offset END
- QS.statement_start_offset)/2) + 1) AS statement_text
FROM sys.dm_exec_query_stats AS QS
CROSS APPLY sys.dm_exec_sql_text(QS.sql_handle) as ST) as query_stats
GROUP BY query_stats.query_hash
ORDER BY 5 DESC;
以上是关于mmsql查看最近操作日志的主要内容,如果未能解决你的问题,请参考以下文章