Επεξεργασία

Κοινή χρήση μέσω


Extended Events Tools

Applies to: SQL Server Azure SQL Database Azure SQL Managed Instance

You can use the following tools to create and manage SQL Server Extended Events sessions:

  • Data Definition Language (DDL) statements. These enable you to create and modify an Extended Events session.

  • Dynamic management views, catalog views and system tables. These enable you to obtain session data and metadata by using Transact-SQL statements. The system tables help you determine the existing Extended Events equivalents for SQL Trace event classes and columns.

  • The Extended Events node of Object Explorer. This enables you to start, stop or delete a session, or to import and export session templates.

  • The SQL Server PowerShell provider. This is a powerful tool that you can use to create, alter, and manage Extended Events sessions. For more information, see Use the PowerShell Provider for Extended Events.

  • SQL Server Management Studio. This enables you to create and execute the code samples that are provided in the Extended Events topics. For more information, see Object Explorer.

In addition to sessions that you create, a default system health session exists on the server. The session collects system data that you can use to help troubleshoot performance issues. For more information, see Use the system_health Session.

DDL Statements

Use the following DDL statements to create, change, and drop an Extended Events session.

Name Description
CREATE EVENT SESSION (Transact-SQL) Creates an Extended Event session object that identifies the source of the events, the event session targets, and the event session parameters.
ALTER EVENT SESSION (Transact-SQL) Starts or stops an event session or changes an event session configuration.
DROP EVENT SESSION (Transact-SQL) Drops an event session.

Catalog Views

Use the following catalog views to obtain the metadata that is created when you create an event session.

Name Description
sys.server_event_sessions (Transact-SQL) Lists all event session definitions.
sys.server_event_session_actions (Transact-SQL) Returns a row for each action on each event of an event session.
sys.server_event_session_events (Transact-SQL) Returns a row for each event in an event session.
sys.server_event_session_fields (Transact-SQL) Returns a row for each customizable column that was explicitly set on events and targets.
sys.server_event_session_targets (Transact-SQL) Returns a row for each event target for an event session.

Dynamic Management Views

Use the following dynamic management views to obtain session metadata and session data. The metadata is obtained from the catalog views, and the session data is created when you start and run an event session.

Note

These views do not contain session data until a session starts.

Name Description
sys.dm_os_dispatcher_pools (Transact-SQL) Returns information about session dispatcher pools.
sys.dm_xe_objects (Transact-SQL) Returns a row for each object that is exposed by an event package.
sys.dm_xe_object_columns (Transact-SQL) Returns the schema information for all the objects.
sys.dm_xe_packages (Transact-SQL) Lists all the packages registered with the Extended Events engine.
sys.dm_xe_sessions (Transact-SQL) Returns information about an active Extended Events session.
sys.dm_xe_session_targets (Transact-SQL) Returns information about session targets.
sys.dm_xe_session_events (Transact-SQL) Returns information about session events.
sys.dm_xe_session_event_actions (Transact-SQL) Returns information about event session actions.
sys.dm_xe_map_values (Transact-SQL) Provides a mapping of internal numeric keys to human-readable text.
sys.dm_xe_session_object_columns (Transact-SQL) Shows the configuration values for objects that are bound to a session.

System Tables

Use the following system tables to obtain information about the Extended Events equivalents for SQL Trace event classes and columns.

Name Description
trace_xe_event_map (Transact-SQL) Contains one row for each Extended Events event that is mapped to a SQL Trace event class.
trace_xe_action_map (Transact-SQL) Contains one row for each Extended Events action that is mapped to a SQL Trace column ID.

See Also

Dynamic Management Views and Functions (Transact-SQL)
Catalog Views (Transact-SQL)
SQL Server Extended Events Tables (Transact-SQL)
Use the system_health Session
Use the PowerShell Provider for Extended Events