sqlserver解决tempdb过大的问题 – u011747152的博客 – CSDN博客 -Mikel

sqlserver解决tempdb过大的问题 – u011747152的博客 – CSDN博客

2019年6月7日 分类: 数据库

来源: sqlserver解决tempdb过大的问题 – u011747152的博客 – CSDN博客


#查出最大的spid
use tempdb
go
SELECT top 10 t1.session_id,
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,t3.total_elapsed_time
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

#看是哪条SQL导致的
select s.text,p.*
from master.dbo.sysprocesses p
cross apply sys.dm_exec_SQL_text(p.sql_handle) s
where spid = 55


标签:
本文的评论功能被关闭了.
备案信息冀ICP 0007948