commands

^

Test-DbaDbLogShipStatus

Author Sander Stad (@sqlstad), sqlstad.nl
Availability Windows, Linux, macOS

 

Synopsis

Test-DbaDbLogShipStatus returns the status of your log shipping databases

Description

Most of the time your log shipping "just works". Checking your log shipping status can be done really easy with this function.

Make sure you're connecting to the monitoring instance of your log shipping infrastructure.

The function will return the status for a database. This can be one or more messages in a comma separated list. If everything is OK with the database than you should only see the message "All OK".

Syntax

Test-DbaDbLogShipStatus
    [-SqlInstance] <DbaInstanceParameter[]>
    [[-SqlCredential] <PSCredential>]
    [[-Database] <String[]>]
    [[-ExcludeDatabase] <String[]>]
    [-Simple]
    [-Primary]
    [-Secondary]
    [-EnableException]
    [<CommonParameters>]

 

Examples

 

Example: 1
PS C:\> Test-DbaDbLogShipStatus -SqlInstance sql1

Retrieves the log ship information from sql1 and displays all the information present including the status.

Example: 2
PS C:\> Test-DbaDbLogShipStatus -SqlInstance sql1 -Database AdventureWorks2014

Retrieves the log ship information for just the database AdventureWorks.

Example: 3
PS C:\> Test-DbaDbLogShipStatus -SqlInstance sql1 -Primary

Retrieves the log ship information and only returns the information for the databases on the primary instance.

Example: 4
PS C:\> Test-DbaDbLogShipStatus -SqlInstance sql1 -Secondary

Retrieves the log ship information and only returns the information for the databases on the secondary instance.

Example: 5
PS C:\> Test-DbaDbLogShipStatus -SqlInstance sql1 -Simple

Retrieves the log ship information and only returns the columns SQL Instance, Database, Instance Type and Status

Required Parameters

-SqlInstance

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

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

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

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

By default all the information will be returned. If this parameter is used you get an overview with the SQL Instance, Database, Instance Type and the status

Alias
Required False
Pipeline false
Default Value False
-Primary

Allows to filter the results to only return values that apply to the primary instance.

Alias
Required False
Pipeline false
Default Value False
-Secondary

Allows to filter the results to only return values that apply to the secondary instance.

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

 

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.