< Back

Test-DbaDbLogShipStatus

Mon Jan 13, 2020 6:05 pm

NAME Test-DbaDbLogShipStatus



SYNOPSIS

Test-DbaDbLogShipStatus returns the status of your log shipping databases





SYNTAX

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

[[-SqlCredential] <Pscredential>] [[-Database] <System.String[]>] [[-ExcludeDatabase] <System.String[]>] [-Simple

<Switch>] [-Primary <Switch>] [-Secondary <Switch>] [-EnableException <Switch>] [<CommonParameters>]





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





PARAMETERS

-Database [<System.String[]>]

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.



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



-ExcludeDatabase [<System.String[]>]

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.



Required? false

Position? named

Default value

Accept pipeline input? False

Accept wildcard characters? false



-Primary [<Switch>]

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



Required? false

Position? named

Default value

Accept pipeline input? False

Accept wildcard characters? false



-Secondary [<Switch>]

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



Required? false

Position? named

Default value

Accept pipeline input? False

Accept wildcard characters? false



-Simple [<Switch>]

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



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 2000 or greater.



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: LogShipping

Author: Sander Stad (@sqlstad), sqlstad.nl



Website: https://dbatools.io

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

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



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



RELATED LINKS

https://dbatools.io/Test-DbaDbLogShipStatus