SQL Trace 分析

SQL Trace 分析

select * into sample
from tn_trace_gettable('c:\sample\a.trc', default)
where eventcalss in (10, 12)
--10:RPC:Completed 在完成了远程过程调用(RPC)时发送。一般是一些存储过程调用。
--12:SQL:BatchCompleted在完成了Transact-SQL批处理时发生。

(1)、找到是哪台客户端服务器上的哪个应用发过来的语句从整体上讲数据库引起的“read”最多:
select databaseId, HostName, ApplicationName, sum(reads)
from sample
group by databaseId, HostName, ApplicationName
order by sum(reads) desc
得到这个结果,就大概知道哪些客户端要访问大量的数据页面,可能造成内存压力

(2)、安装reads从大到小排序最大的1000个语句:
select top 1000 textdata, databaseId, HostName, ApplicationName, LoginName, SPID,
Starttime, EndTime, Duration, reads, writes, CPU
from sample
order by reads desc

posted @ 2015-08-05 13:03  zhouzx  阅读(233)  评论(0编辑  收藏  举报