tempdb数据文件暴增,导致服务器磁盘空间被耗尽!
1.查看tempdb的使用分配情况
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
2.从internal_objects_alloc_page_count和internal_objects_dealloc_page_count可以看出,给session分配了44096页,计算一下:
select 44096*8/1024/1024 as [size_GB]
可能是因为时间太久,已经找不到导致暴增的会话。
3.如果产生问题的会话还存在的话,可以根据会话id进一步查看具体执行的sql内容
select p.*,s.text
from master.dbo.sysprocesses p
cross apply sys.dm_exec_sql_text(p.sql_handle) s
where spid = 74
临时重启了数据库服务器后解决问题。但是目前还要继续监控分析,因为没有根本解决问题。