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

来源: 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

本文来自网络,不代表Mikel立场,转载请注明出处:http://www.mikel.cn/%e5%bc%80%e5%8f%91%e7%ac%94%e8%ae%b0/%e6%95%b0%e6%8d%ae%e5%ba%93/sqlserver%e8%a7%a3%e5%86%b3tempdb%e8%bf%87%e5%a4%a7%e7%9a%84%e9%97%ae%e9%a2%98-u011747152%e7%9a%84%e5%8d%9a%e5%ae%a2-csdn%e5%8d%9a%e5%ae%a2.html
关注微信
微信扫一扫关注我们

微信扫一扫关注我们

关注微博
返回顶部