SQLTeam.com | Weblogs | Forums

Creating Extended Event for deadlock

Hi

Following code works fine on SQL 2014 but throwing error on SQL 2008 R2.

ERROR:
Msg 25623, Level 16, State 1, Line 2
The event name, "sqlserver.lock_deadlock_chain", is invalid, or the object could not be found

--Event Session
CREATE EVENT SESSION [deadlock_capture] ON SERVER

--Events to track Lock_deadlock and Lock_deadlock_chain
ADD EVENT sqlserver.lock_deadlock(
ACTION(sqlserver.sql_text)),
ADD EVENT sqlserver.lock_deadlock_chain(
ACTION(sqlserver.sql_text))

-- TARGET to use, for this case, a file
ADD TARGET package0.event_file(SET filename=N'deadlock_capture')

--The event session advanced parameters, you can see that the event starts automatically
WITH (MAX_MEMORY=4096 KB,EVENT_RETENTION_MODE=ALLOW_SINGLE_EVENT_LOSS,MAX_DISPATCH_LATENCY=30
SECONDS,MAX_EVENT_SIZE=0 KB,MEMORY_PARTITION_MODE=NONE,TRACK_CAUSALITY=OFF,STARTUP_STATE=ON)

GO