SQL Trace Analysis

Source: Internet
Author: User

SQL Trace Analysis

SELECT * Into sample
From tn_trace_gettable (' c:\sample\a.trc ', default)
where Eventcalss in (10, 12)
--10:rpc:completed is sent when a remote procedure call (RPC) is completed. Typically, some stored procedure calls.
--12:sql:batchcompleted occurs when a Transact-SQL batch is completed.

(1), to find out which application on the client server sent the statement from the overall database caused by the "read" up to:
Select DatabaseId, HostName, ApplicationName, sum (reads)
From sample
Group by DatabaseId, HostName, ApplicationName
ORDER by sum (reads) desc
With this result, you probably know which clients have access to a large number of data pages, which can cause memory pressure

(2), install reads from large to small sort the maximum of 1000 statements:
Select Top TextData, DatabaseId, HostName, ApplicationName, LoginName, SPID,
Starttime, EndTime, Duration, reads, writes, CPU
From sample
ORDER BY reads Desc

SQL Trace Analysis

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.