SqlServer 查看死锁信息
时间:2011-03-16 来源:永无止境
SELECT 0 ,blocked FROM (SELECT * FROM sys.sysprocesses WHERE blocked>0 ) a WHERE NOT EXISTS(SELECT * FROM (SELECT * FROM sys.sysprocesses WHERE blocked>0 ) b WHERE a.blocked=spid) UNION SELECT spid,blocked FROM sys.sysprocesses WHERE blocked>0 使用查询后的进程ID可以查看死锁元凶的Sql语句和被牺牲Sql语句。 DBCC INPUTBUFFER(82) 附人为制造死锁 BEGIN TRANSACTION SELECT * FROM 表名 WITH (TABLOCKX) WAITFOR DELAY '00:05:00 ' COMMIT TRANSACTION
相关阅读 更多 +