< Back

New-DbaXESmartReplay

Mon Jan 13, 2020 1:03 pm

NAME New-DbaXESmartReplay



SYNOPSIS

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





SYNTAX

New-DbaXESmartReplay [-SqlInstance] <Sqlcollaborative.Dbatools.Parameter.DbaInstanceParameter[]> [[-SqlCredential]

<Pscredential>] [[-Database] <String>] [[-Event] <System.String[]>] [[-Filter] <String>] [[-DelaySeconds] <Int>]

[-StopOnError <Switch>] [[-ReplayIntervalSeconds] <Int>] [-EnableException <Switch>] [<CommonParameters>]





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.





PARAMETERS

-Database [<String>]

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.



Required? false

Position? named

Default value

Accept pipeline input? False

Accept wildcard characters? false



-DelaySeconds [<Int>]

Specifies the duration of the delay in seconds.



Required? false

Position? named

Default value

Accept pipeline input? False

Accept wildcard characters? false



-EnableException [<Switch>]

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.



Required? false

Position? named

Default value

Accept pipeline input? False

Accept wildcard characters? false



-Event [<System.String[]>]

Each Response can be limited to processing specific events, while ignoring all the other ones. When this

attribute is omitted, all events are processed.



Required? false

Position? named

Default value

Accept pipeline input? False

Accept wildcard characters? false



-Filter [<String>]

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



Required? false

Position? named

Default value

Accept pipeline input? False

Accept wildcard characters? false



-ReplayIntervalSeconds [<Int>]

Specifies the duration of the replay interval in seconds.



Required? false

Position? named

Default value

Accept pipeline input? False

Accept wildcard characters? false



-SqlCredential [<Pscredential>]

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.



Required? false

Position? named

Default value

Accept pipeline input? False

Accept wildcard characters? false



-SqlInstance [<Sqlcollaborative.Dbatools.Parameter.DbaInstanceParameter[]>]

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

Server version 2008 or higher.



Required? false

Position? named

Default value

Accept pipeline input? False

Accept wildcard characters? false



-StopOnError [<Switch>]

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.



Required? false

Position? named

Default value

Accept pipeline input? False

Accept wildcard characters? false



<CommonParameters>

This cmdlet supports the common parameters: Verbose, Debug,

ErrorAction, ErrorVariable, WarningAction, WarningVariable,

OutBuffer, PipelineVariable, and OutVariable. For more information, see

about_CommonParameters (https:/go.microsoft.com/fwlink/?LinkID=113216).



INPUTS



OUTPUTS



NOTES





Tags: ExtendedEvent, XE, XEvent, SmartTarget

Author: Chrissy LeMaire (@cl) | SmartTarget by Gianluca Sartori (@spaghettidba)



Website: https://dbatools.io

Copyright: (c) 2018 by dbatools, licensed under MIT

License: MIT https://opensource.org/licenses/MIT



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



RELATED LINKS

https://dbatools.io/New-DbaXESmartReplay