< Back
Invoke-DbaXEReplay
Post
NAME Invoke-DbaXEReplay
SYNOPSIS
This command replays events from Read-DbaXEFile on one or more target servers
SYNTAX
Invoke-DbaXEReplay [-SqlInstance] <Sqlcollaborative.Dbatools.Parameter.DbaInstanceParameter[]> [[-SqlCredential]
<Pscredential>] [[-Database] <System.String[]>] [[-Event] <System.String[]>] [-InputObject] <System.Object> [-Raw
<Switch>] [-EnableException <Switch>] [<CommonParameters>]
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
PARAMETERS
-Database [<System.String[]>]
The initial starting database.
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
-InputObject [<System.Object>]
Accepts the object output of Read-DbaXESession.
Required? false
Position? named
Default value
Accept pipeline input? False
Accept wildcard characters? false
-Raw [<Switch>]
By dafault, the results of . $sqlcmd are collected, cleaned up and displayed. If you'd like to see all results
immeidately, use Raw.
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[]>]
Target SQL Server(s)
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
Author: Chrissy LeMaire (@cl), netnerds.net
Website: https://dbatools.io
Copyright: (c) 2018 by dbatools, licensed under MIT
License: MIT https://opensource.org/licenses/MIT
-------------------------- 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.
RELATED LINKS
https://dbatools.io/Invoke-DbaXEReplay
SYNOPSIS
This command replays events from Read-DbaXEFile on one or more target servers
SYNTAX
Invoke-DbaXEReplay [-SqlInstance] <Sqlcollaborative.Dbatools.Parameter.DbaInstanceParameter[]> [[-SqlCredential]
<Pscredential>] [[-Database] <System.String[]>] [[-Event] <System.String[]>] [-InputObject] <System.Object> [-Raw
<Switch>] [-EnableException <Switch>] [<CommonParameters>]
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
PARAMETERS
-Database [<System.String[]>]
The initial starting database.
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
-InputObject [<System.Object>]
Accepts the object output of Read-DbaXESession.
Required? false
Position? named
Default value
Accept pipeline input? False
Accept wildcard characters? false
-Raw [<Switch>]
By dafault, the results of . $sqlcmd are collected, cleaned up and displayed. If you'd like to see all results
immeidately, use Raw.
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[]>]
Target SQL Server(s)
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
Author: Chrissy LeMaire (@cl), netnerds.net
Website: https://dbatools.io
Copyright: (c) 2018 by dbatools, licensed under MIT
License: MIT https://opensource.org/licenses/MIT
-------------------------- 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.
RELATED LINKS
https://dbatools.io/Invoke-DbaXEReplay