Author | Sander Stad (@sqlstad), sqlstad.nl |
Availability | Windows, Linux, macOS |
Want to see the source code for this command? Check out Get-DbaDbLogShipError on GitHub.
Want to see the Bill Of Health for this command? Check out Get-DbaDbLogShipError.
Get-DbaDbLogShipError returns all the log shipping errors that occurred
When your log shipping fails it's sometimes hard to see why is fails.
Using this function you'll be able to find out what went wrong in a short amount of time.
Get-DbaDbLogShipError
[-SqlInstance] <DbaInstanceParameter[]>
[[-SqlCredential] <PSCredential>]
[[-Database] <String[]>]
[[-ExcludeDatabase] <String[]>]
[[-Action] <String[]>]
[[-DateTimeFrom] <DateTime>]
[[-DateTimeTo] <DateTime>]
[-Primary]
[-Secondary]
[-EnableException]
[<CommonParameters>]
PS C:\> Get-DbaDbLogShipError -SqlInstance sql1
Get all the log shipping errors that occurred
PS C:\> Get-DbaDbLogShipError -SqlInstance sql1 -Action Backup
Get the errors that have something to do with the backup of the databases
PS C:\> Get-DbaDbLogShipError -SqlInstance sql1 -Secondary
Get the errors that occurred on the secondary instance.
This will return the copy of the restore actions because those only occur on the secondary instance
PS C:\> Get-DbaDbLogShipError -SqlInstance sql1 -DateTimeFrom "01/05/2018"
Get the errors that have occurred from "01/05/2018". This can also be of format "yyyy-MM-dd"
PS C:\> Get-DbaDbLogShipError -SqlInstance sql1 -Secondary -DateTimeFrom "01/05/2018" -DateTimeTo "2018-01-07"
Get the errors that have occurred between "01/05/2018" and "01/07/2018".
See that is doesn't matter how the date is represented.
The target SQL Server instance or instances. You must have sysadmin access and server version must be SQL Server version 2000 or greater.
Alias | |
Required | True |
Pipeline | true (ByValue) |
Default Value |
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 |
Allows you to filter the results to only return the databases you're interested in. This can be one or more values separated by commas.
This is not a wildcard and should be the exact database name. See examples for more info.
Alias | |
Required | False |
Pipeline | false |
Default Value |
Allows you to filter the results to only return the databases you're not interested in. This can be one or more values separated by commas.
This is not a wildcard and should be the exact database name.
Alias | |
Required | False |
Pipeline | false |
Default Value |
Filter to get the log shipping action that has occurred like Backup, Copy, Restore.
By default all the actions are returned.
Alias | |
Required | False |
Pipeline | false |
Default Value | |
Accepted Values | Backup,Copy,Restore |
Filter the results based on the date starting from datetime X
Alias | |
Required | False |
Pipeline | false |
Default Value |
Filter the results based on the date ending with datetime X
Alias | |
Required | False |
Pipeline | false |
Default Value |
Allows to filter the results to only return values that apply to the primary instance.
Alias | |
Required | False |
Pipeline | false |
Default Value | False |
Allows to filter the results to only return values that apply to the secondary instance.
Alias | |
Required | False |
Pipeline | false |
Default Value | False |
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 |