Author | Sander Stad (@sqlstad), sqlstad.nl |
Availability | Windows, Linux, macOS |
Want to see the source code for this command? Check out Test-DbaDbLogShipStatus on GitHub.
Want to see the Bill Of Health for this command? Check out Test-DbaDbLogShipStatus.
Retrieves log shipping status and health information from the monitoring instance
Queries the log shipping monitoring system to check the health of your log shipping configuration across primary and secondary instances.
This function connects to your log shipping monitoring instance and examines backup, copy, and restore operations to identify any issues or delays.
Make sure you're connecting to the monitoring instance of your log shipping infrastructure, as this is where SQL Server stores the consolidated monitoring data.
The function analyzes timing thresholds for each operation and reports specific problems like missed backups, copy delays, or restore failures.
When everything is functioning normally, you'll see "All OK" in the status output.
Problem databases will show detailed messages about which operations are behind schedule or failing entirely.
Test-DbaDbLogShipStatus
[-SqlInstance] <DbaInstanceParameter[]>
[[-SqlCredential] <PSCredential>]
[[-Database] <String[]>]
[[-ExcludeDatabase] <String[]>]
[-Simple]
[-Primary]
[-Secondary]
[-EnableException]
[<CommonParameters>]
PS C:\> Test-DbaDbLogShipStatus -SqlInstance sql1
Retrieves the log ship information from sql1 and displays all the information present including the status.
PS C:\> Test-DbaDbLogShipStatus -SqlInstance sql1 -Database AdventureWorks2014
Retrieves the log ship information for just the database AdventureWorks.
PS C:\> Test-DbaDbLogShipStatus -SqlInstance sql1 -Primary
Retrieves the log ship information and only returns the information for the databases on the primary instance.
PS C:\> Test-DbaDbLogShipStatus -SqlInstance sql1 -Secondary
Retrieves the log ship information and only returns the information for the databases on the secondary instance.
PS C:\> Test-DbaDbLogShipStatus -SqlInstance sql1 -Simple
Retrieves the log ship information and only returns the columns SQL Instance, Database, Instance Type and Status
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 |
Specifies which log shipped databases to check by exact name. Accepts multiple database names as a comma-separated list.
Use this when you want to focus on specific databases instead of checking all log shipped databases on the monitoring instance.
Alias | |
Required | False |
Pipeline | false |
Default Value |
Excludes specific log shipped databases from the status check by exact name. Accepts multiple database names as a comma-separated list.
Use this when you want to check most databases but skip certain ones, such as test or development log shipping configurations.
Alias | |
Required | False |
Pipeline | false |
Default Value |
Returns only essential columns: SqlInstance, Database, InstanceType, and Status instead of all detailed timing information.
Use this for quick health overviews when you don't need the full backup/copy/restore timing details.
Alias | |
Required | False |
Pipeline | false |
Default Value | False |
Returns only status information for databases acting as primary instances in log shipping configurations.
Use this when you want to focus specifically on backup operations and primary-side health monitoring.
Alias | |
Required | False |
Pipeline | false |
Default Value | False |
Returns only status information for databases acting as secondary instances in log shipping configurations.
Use this when you want to focus specifically on copy and restore operations and secondary-side health monitoring.
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 |