commands

^

Test-DbaRepLatency

Author Colin Douglas
Availability Windows, Linux, macOS

 

 

Want to see the source code for this command? Check out Test-DbaRepLatency on GitHub.
Want to see the Bill Of Health for this command? Check out Test-DbaRepLatency.

Synopsis

Displays replication latency for all transactional publications for a server or database.

Description

Creates tracer tokens to determine latency between the publisher/distributor and the distributor/subscriber for all transactional publications for a server, database, or publication.

All replication commands need SQL Server Management Studio installed and are therefore currently not supported. Have a look at this issue to get more information: https://github.com/dataplat/dbatools/issues/7428

Syntax

Test-DbaRepLatency
    [-SqlInstance] <DbaInstanceParameter[]>
    [[-Database] <Object[]>]
    [[-SqlCredential] <PSCredential>]
    [[-PublicationName] <Object[]>]
    [[-TimeToLive] <Int32>]
    [-RetainToken]
    [-DisplayTokenHistory]
    [-EnableException]
    [<CommonParameters>]

 

Examples

 

Example: 1
PS C:\> Test-DbaRepLatency -SqlInstance sql2008, sqlserver2012

Return replication latency for all transactional publications for servers sql2008 and sqlserver2012.

Example: 2
PS C:\> Test-DbaRepLatency -SqlInstance sql2008 -Database TestDB

Return replication latency for all transactional publications on server sql2008 for only the TestDB database

Example: 3
PS C:\> Test-DbaRepLatency -SqlInstance sql2008 -Database TestDB -PublicationName TestDB_Pub

Return replication latency for the TestDB_Pub publication for the TestDB database located on the server sql2008.

Required Parameters

-SqlInstance

The target SQL Server instance or instances.

Alias
Required True
Pipeline true (ByValue)
Default Value

Optional Parameters

-Database

The database(s) to process. If unspecified, all databases will be processed.

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

The publication(s) to process. If unspecified, all publications will be processed.

Alias
Required False
Pipeline false
Default Value
-TimeToLive

How long, in seconds, to wait for a tracer token to complete its journey from the publisher to the subscriber. If unspecified, all tracer tokens will take as long as they need to process results.

Alias
Required False
Pipeline false
Default Value 0
-RetainToken

Retains the tracer tokens created for each publication. If unspecified, all tracer tokens created will be discarded.

Alias
Required False
Pipeline false
Default Value False
-DisplayTokenHistory

Displays all tracer tokens in each publication. If unspecified, the current tracer token created will be only token displayed.

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