It's easier than you'd think... When you use the SQL Server 2008 CREATE EVENT SESSION DDL statement with extended events, you specify:
Events to be captured (e.g. sqlserver.error_reported)Actions to be fired to add more information (e.g. sqlserver.sql_text)Predicates for conditional capture (e.g. where sqlserver.error_reported.error = 547)Event target to collect the events (e.g. package0.ring_buffer)Addtional options (e.g. MAX_MEMORY)
In general, the way you look for events, actions, predicates, etc to use is to query against the metadata views:
select p.name + '.' + o.name as [Full Name], o.description s [Description]from sys.dm_xe_objects ojoin sys.dm_xe_packages p on o.package_guid = p.guid-- @type can be 'event', 'action', etcwhere o.object_type = @type order by p.name, o.name
Two of the actions listed have to do with activity (causality): package0.attach_activity_id and package0.attach_activity_id_xfer. In addition there is an option TRACE_CAUSALITY. I thought you'd have to set the TRACE_CAUSALITY option and add the actions to collect activity information. But attempting to add either action produced an error.
It's easier than that. Simply turning on the TRACE_CAUSALITY option is enough. The actions can't be specified in CREATE EVENT SESSION (or ALTER EVENT SESSION) because they are for internal use. The activity_ids show up at the target without explicitly naming the actions.
Remember Me
a@href@title, strike
Theme design by Jelle Druyts
Pick a theme: BlogXP sqlx BlogXP sqlx
Powered by: newtelligence dasBlog 2.0.7226.0
The opinions expressed herein are my own personal opinions and do not represent my employer's view in any way.
© Copyright 2008, Bob Beauchemin
E-mail