Import-DbaXESessionTemplate View Source Chrissy LeMaire (@cl), netnerds.net Windows, Linux, macOS Synopsis Creates Extended Events sessions from XML templates on SQL Server instances
Description Creates new Extended Events sessions using predefined XML templates from the dbatools repository or custom template files you specify. This function simplifies XE session deployment by providing ready-to-use templates for common monitoring scenarios like performance troubleshooting, security auditing, and health monitoring.
Templates from the dbatools repository include popular configurations for index page splits, query wait statistics, deadlock monitoring, IO errors, and database health checks.
Invoke-DbaXEReplay View Source Chrissy LeMaire (@cl), netnerds.net Windows, Linux, macOS Synopsis Replays SQL queries captured in Extended Event files against target SQL Server instances
Description This command replays SQL workloads captured in Extended Event files against one or more target SQL Server instances for performance testing and load simulation. It extracts SQL statements from Extended Event data piped from Read-DbaXEFile and executes them sequentially against your specified targets.
The function works by collecting SQL queries from the Extended Event stream, writing them to a temporary SQL file with proper batch separators, then executing the file using sqlcmd to ensure batches run correctly.
New-DbaXESession View Source Chrissy LeMaire (@cl), netnerds.net Windows, Linux, macOS Synopsis Creates a new Extended Events session object for programmatic configuration and deployment.
Description Creates a new Extended Events session object that can be programmatically configured with events, actions, and targets before deployment to SQL Server. This function provides the foundation for building XE sessions through code rather than using predefined templates. The returned session object requires additional configuration using AddEvent(), AddAction(), and AddTarget() methods before calling Create() to deploy it to the server.
Read-DbaXEFile View Source Chrissy LeMaire (@cl), netnerds.net Windows, Linux, macOS Synopsis Parses Extended Events trace files (.xel/.xem) into structured PowerShell objects for analysis
Description Converts Extended Events trace files into PowerShell objects so you can analyze captured SQL Server events without needing SQL Server Management Studio. This function takes the raw XEvent data from .xel or .xem files and transforms it into structured objects with properties for each field and action in the trace.
Remove-DbaXESession View Source Chrissy LeMaire (@cl), netnerds.net Windows, Linux, macOS Synopsis Removes Extended Events sessions from SQL Server instances.
Description Removes Extended Events sessions from SQL Server instances, giving you the option to target specific sessions by name or remove all user-created sessions at once. This function preserves critical system sessions (system_health, telemetry_xevents, and AlwaysOn_health) when using the AllSessions parameter, so you can safely clean up monitoring sessions without breaking SQL Server’s built-in diagnostics.
Start-DbaXESession View Source Doug Meyers Windows, Linux, macOS Synopsis Starts Extended Events sessions on SQL Server instances for monitoring and troubleshooting.
Description Activates Extended Events sessions that have been created but are not currently running. Extended Events sessions are SQL Server’s lightweight monitoring framework used for troubleshooting performance issues, security auditing, and capturing specific database activity patterns.
The function can start individual sessions by name, all user-created sessions at once, or sessions scheduled to start and stop at specific times.
Stop-DbaXESession View Source Doug Meyers Windows, Linux, macOS Synopsis Stops running Extended Events sessions on SQL Server instances
Description Stops active Extended Events sessions that are currently collecting diagnostic data or monitoring SQL Server activity. This function helps DBAs manage resource usage by ending sessions that may be consuming disk space, memory, or CPU cycles. You can stop specific sessions by name, stop all user-created sessions while preserving critical system sessions, or use pipeline input from Get-DbaXESession.
Watch-DbaXESession View Source Chrissy LeMaire (@cl), netnerds.net Windows, Linux, macOS Synopsis Monitors Extended Events sessions in real-time, streaming live event data as it occurs
Description Streams live event data from running Extended Events sessions, allowing real-time monitoring of database activity, performance issues, or security events. Each captured event is processed into a PowerShell object with organized columns for event name, timestamp, fields, and actions. This command runs continuously until you stop the XE session, terminate the PowerShell session, or press Ctrl-C, making it ideal for interactive troubleshooting and live analysis workflows.