Microsoft® SQL Server® 2012 Bible

(Ben Green) #1

939


Chapter 40: Extended Events


40


Events
An Event is an interesting point in the SQL Server executable code. Events in Extended
Events are similar in concept to SQL Trace events in that they represent specifi c data points
that you want to capture. Everything in Extended Events centers on the Event object
because it is the fulcrum on which all other Extended Events objects rely. Each Event has
a default set of fi elds associated with the payload information the event delivers. Other
information can be gathered for the Event through Actions.

Use the following query to fi nd all available Extended Events and the Package they belong
to:

SELECT
PackageName = p.name, EventName = o.name,
EventDescription = o.description
FROM sys.dm_xe_objects o
JOIN sys.dm_xe_packages p ON o.package_guid = p.guid
WHERE object_type = 'event'

Actions
An Action is the response to a captured Event. In most cases in Extended Events, you use
Actions to acquire additional data not present in the default payload of the Event you cap-
ture. However, they can be used for other reasons, such as triggering a stack dump. Actions
always occur synchronously, so capturing too many Actions may hinder the performance of
Extended Events.

Use the following query to fi nd all available Extended Events Actions and the Package they
belong to:

SELECT
PackageName = p.name, ActionName = o.name,
ActionDescription = o.description
FROM sys.dm_xe_objects o
JOIN sys.dm_xe_packages p ON o.package_guid = p.guid
WHERE object_type = 'action'

Targets
A Target is the consumer of captured Extended Events data. The two formats for Targets are
either a fi le destination or an in-memory destination, of which there are several formats. Targets
can consume data synchronously or asynchronously depending on the type of the Target.

Use the following query to fi nd all available Extended Events Targets and the Package they
belong to:

SELECT
PackageName = p.name, TargetName = o.name,
TargetDescription = o.description

c40.indd 939c40.indd 939 7/31/2012 10:02:41 AM7/31/2012 10:02:41 AM


http://www.it-ebooks.info
Free download pdf