Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2005 Forums
 SQL Server Administration (2005)
 SQL Deadlocks

Author  Topic 

petek
Posting Yak Master

192 Posts

Posted - 2009-09-29 : 03:39:11
Hi all,

Is there a way to monitor SQL Deadlocks and record them to a table without using SQL Profiler.


Kind Regards

Pete.

Michael Valentine Jones
Yak DBA Kernel (pronounced Colonel)

7020 Posts

Posted - 2009-09-29 : 10:16:02
Turn on trace flag 1222. This will cause SQL Server 2005 to log deadlocks to the SQL Server error log

print 'Show all trace flags that are on'
dbcc tracestatus(-1) with no_infomsgs

-- Works in SQL 2005 and later.
print 'Set on Trace Flag 1222 to log deadlocks'
dbcc traceon(1222,-1)
dbcc tracestatus(1222) with no_infomsgs

print 'Show all trace flags that are on'
dbcc tracestatus(-1) with no_infomsgs



Read this for more information:
Detecting and Ending Deadlocks
http://msdn.microsoft.com/en-us/library/ms178104.aspx






CODO ERGO SUM
Go to Top of Page
   

- Advertisement -