commands

^

New-DbaXESmartReplay

Author Chrissy LeMaire (@cl) , SmartTarget by Gianluca Sartori (@spaghettidba)
Availability Windows, Linux, macOS

 

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

Synopsis

This response type can be used to replay execution related events to a target SQL Server instance.

Description

This response type can be used to replay execution related events to a target SQL Server instance. The events that you can replay are of the type sql_batch_completed and rpc_completed: all other events are ignored.

Syntax

New-DbaXESmartReplay
    [-SqlInstance] <DbaInstanceParameter[]>
    [[-SqlCredential] <PSCredential>]
    [[-Database] <String>]
    [[-Event] <String[]>]
    [[-Filter] <String>]
    [[-DelaySeconds] <Int32>]
    [-StopOnError]
    [[-ReplayIntervalSeconds] <Int32>]
    [-EnableException]
    [-WhatIf]
    [-Confirm]
    [<CommonParameters>]

 

Examples

 

Example: 1
PS C:\> $response = New-DbaXESmartReplay -SqlInstance sql2017 -Database planning
PS C:\> Start-DbaXESmartTarget -SqlInstance sql2016 -Session loadrelay -Responder $response

Replays events from sql2016 on sql2017 in the planning database. Returns a PowerShell job object.
To see a list of all SmartTarget job objects, use Get-DbaXESmartTarget.

Example: 2
PS C:\> $response = New-DbaXESmartReplay -SqlInstance sql2017 -Database planning
PS C:\> Start-DbaXESmartTarget -SqlInstance sql2017 -Session 'Profiler Standard' -Responder $response -NotAsJob

Replays events from the 'Profiler Standard' session on sql2016 to sql2017's planning database. Does not run as a job so you can see the raw output.

Required Parameters

-SqlInstance

The target SQL Server instance or instances. You must have sysadmin access and server version must be SQL Server version 2008 or higher.

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

Name of the initial catalog to connect to. Statements will be replayed by changing database to the same database where the event was originally captured, so this property only controls the initial
database to connect to.

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
-Filter

Specifies a filter expression in the same form as you would use in the WHERE clause of a SQL query.
Example: duration > 10000 AND cpu_time > 10000

Alias
Required False
Pipeline false
Default Value
-DelaySeconds

Specifies the duration of the delay in seconds.

Alias
Required False
Pipeline false
Default Value 0
-StopOnError

If this switch is enabled, the replay will be stopped when the first error is encountered. By default, error messages are piped to the log and console output, and replay proceeds.

Alias
Required False
Pipeline false
Default Value False
-ReplayIntervalSeconds

Specifies the duration of the replay interval in seconds.

Alias
Required False
Pipeline false
Default Value 0
-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
-WhatIf

If this switch is enabled, no actions are performed but informational messages will be displayed that explain what would happen if the command were to run.

Alias wi
Required False
Pipeline false
Default Value
-Confirm

If this switch is enabled, you will be prompted for confirmation before executing any operations that change state.

Alias cf
Required False
Pipeline false
Default Value