dbatools is a free PowerShell module with over 300 SQL Server administration, best practice and migration commands included.

Please note that documentation and command names may be out of date while we work furiously towards 1.0


Invoke-DbaXeReplay

This command replays events from Read-DbaXEFile. It is simplistic in its approach.

  • Writes all queries to a temp sql file
  • Executes temp file using . $sqlcmd so that batches are executed properly
  • Deletes temp file

Screenshots

dbatools-Invoke-DbaXeReplay

Examples

Runs all batch_text for sql_batch_completed against tempdb on sql2017.

Read-DbaXEFile -Path C:\temp\sample.xel | Invoke-DbaXeReplay -SqlInstance sql2017

Sets the initial database to planning then runs only sql_batch_completed against sql2017.

Read-DbaXEFile -Path C:\temp\sample.xel | Invoke-DbaXeReplay -SqlInstance sql2017 -Database planning -Event sql_batch_completed

Runs all batch_text for sql_batch_completed against tempdb on sql2017 and sql2016.

Read-DbaXEFile -Path C:\temp\sample.xel | Invoke-DbaXeReplay -SqlInstance sql2017, sql2016

Author

This command was created by Chrissy LeMaire. You can find Chrissy on Twitter.

Get-Help

From PowerShell, execute Get-Help Invoke-DbaXeReplay -Detailed for more information on this function.

Source Code

Want to see the source code? View Invoke-DbaXeReplay.ps1 on GitHub
 

Related commands