--1.查出执行时间最大的spid
use tempdb
go
SELECT top 20 t1.session_id,t3.total_elapsed_time ,
t1.internal_objects_alloc_page_count, t1.user_objects_alloc_page_count,
t1.internal_objects_dealloc_page_count , t1.user_objects_dealloc_page_count,
t3.login_name,t3.status
from sys.dm_db_session_space_usage t1
inner join sys.dm_exec_sessions as t3 on t1.session_id = t3.session_id
where (t1.internal_objects_alloc_page_count>0
or t1.user_objects_alloc_page_count >0
or t1.internal_objects_dealloc_page_count>0
or t1.user_objects_dealloc_page_count>0)
order by t1.internal_objects_alloc_page_count desc
成都创新互联公司是一家专业的成都网站建设公司,我们专注成都网站设计、成都网站建设、网络营销、企业网站建设,卖友情链接,一元广告为企业客户提供一站式建站解决方案,能带给客户新的互联网理念。从网站结构的规划UI设计到用户体验提高,创新互联力求做到尽善尽美。
--2.查出哪条sql语句导致
select s.text,p.*
from master.dbo.sysprocesses p
cross apply sys.dm_exec_sql_text(p.sql_handle) s
where spid = 111