commands

^

Invoke-DbaXEReplay

Author Chrissy LeMaire (@cl), netnerds.net
Availability Windows, Linux, macOS

 

Want to see the source code for this command? Check out Invoke-DbaXEReplay on GitHub.
Want to see the Bill Of Health for this command? Check out Invoke-DbaXEReplay.

Synopsis

This command replays events from Read-DbaXEFile on one or more target servers

Description

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

Syntax

Invoke-DbaXEReplay
    [-SqlInstance] <DbaInstanceParameter[]>
    [[-SqlCredential] <PSCredential>]
    [[-Database] <String[]>]
    [[-Event] <String[]>]
    [-InputObject] <Object>
    [-Raw]
    [-EnableException]
    [<CommonParameters>]

 

Examples

 

Example: 1
PS C:\> Read-DbaXEFile -Path C:\temp\sample.xel | Invoke-DbaXEReplay -SqlInstance sql2017

Runs all batch_text for sql_batch_completed against tempdb on sql2017.

Example: 2
PS C:\> Read-DbaXEFile -Path C:\temp\sample.xel | Invoke-DbaXEReplay -SqlInstance sql2017 -Database planning -Event sql_batch_completed

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

Example: 3
PS C:\> Read-DbaXEFile -Path C:\temp\sample.xel | Invoke-DbaXEReplay -SqlInstance sql2017, sql2016

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

Required Parameters

-SqlInstance

Target SQL Server(s)

Alias
Required True
Pipeline false
Default Value
-InputObject

Accepts the object output of Read-DbaXESession.

Alias
Required True
Pipeline true (ByValue)
Default Value

Optional Parameters

-SqlCredential

Login to the target instance using alternative credentials. Accepts PowerShell credentials (Get-Credential). Windows Authentication, SQL Server Authentication, Active Directory - Password, and Active Directory - Integrated are all supported. For MFA support, please use Connect-DbaInstance.

Alias
Required False
Pipeline false
Default Value
-Database

The initial starting database.

Alias
Required False
Pipeline false
Default Value
-Event

Each Response can be limited to processing specific events, while ignoring all the other ones. When this attribute is omitted, all events are processed.

Alias
Required False
Pipeline false
Default Value @('sql_batch_completed', 'rcp_completed')
-Raw

By dafault, the results of sqlcmd are collected, cleaned up and displayed. If you'd like to see all results immeidately, use Raw.

Alias
Required False
Pipeline false
Default Value False
-EnableException

By default, when something goes wrong we try to catch it, interpret it and give you a friendly warning message. This avoids overwhelming you with "sea of red" exceptions, but is inconvenient because it basically disables advanced scripting. Using this switch turns this "nice by default" feature off and enables you to catch exceptions with your own try/catch.

Alias
Required False
Pipeline false
Default Value False