Search

Wednesday, July 27, 2011

Traceflag for deadlocks

In sql 2005 they have added a very much better traceflag. USe this to get the queries involved in the deadlock:

-- To get a clean error log to look in.
EXEC sp_cycle_errorlog
go
-- Turn on the traceflags
DBCC TRACEON (1204,1222, -1)
go
-- To che that the trace is running
dbcc tracestatus(-1)
go
-- To turn off thra tracflag.
DBCC TRACEOff (1204,1222, -1)

For help with understangin the output, read this KB: http://msdn.microsoft.com/en-us/library/ms178104(SQL.90).aspx

No comments:

Post a Comment