Extended Events Flashcards
How do you create an Extended Event?
create event session log_growth on server
ADD EVENT sqlserver.databases_log_growth
( action (sqlserver.database_id))
add target package0.asynchronous_file_target
(SET filename=N’C:\xevent\log_growth.xel’, metadatafile=N’C:\xevent\log_growth.xem’);
TSQL to start Extended Event session?
alter event session log_growth on server state = start;
TSQL to stop Extended Event session?
alter event session log_growth on server state = stop;
TSQL to read Extended Event file?
select *
from sys.fn_xe_file_target_read_file
(N’C:\xevent\log_growth*.xel’, N’C:\xevent\log_growth*.xem’, null, null)
TSQL to view all created Extended Events sessions?
SELECT *
FROM sys.server_event_sessions
TSQL to view all running Extended Events sessions?
SELECT *
FROM sys.dm_xe_sessions
TSQL to drop Extended Event session?
drop event session <session_name> on server
TSQL to view registered packages?
SELECT *
FROM sys.dm_xe_packages
TSQL to view available Extended Events objects?
SELECT *
FROM sys.dm_xe_objects
TSQL to view schema information for all the Extended Events objects?
SELECT *
FROM sys.dm_xe_object_columns
TSQL to view map values?
SELECT *
FROM sys.dm_xe_map_values
TSQL to view information about session targets?
SELECT *
FROM sys.dm_xe_session_targets
TSQL to view information about session events?
SELECT *
FROM sys.dm_xe_session_events
TSQL to view information about event session actions?
SELECT *
FROM sys.dm_xe_session_event_actions
TSQL to view configuration values for objects that are bound to a session?
SELECT *
FROM sys.dm_xe_session_object_columns