commands

^

Get-DbaDbMirrorMonitor

Author Chrissy LeMaire (@cl), netnerds.net
Availability Windows, Linux, macOS

 

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

Synopsis

Returns status rows for a monitored database from the status table in which database mirroring monitoring history is stored and allows you to choose whether the procedure obtains the latest status beforehand.

Description

Returns status rows for a monitored database from the status table in which database mirroring monitoring history is stored and allows you to choose whether the procedure obtains the latest status beforehand.

Basically executes sp_dbmmonitorresults.

Syntax

Get-DbaDbMirrorMonitor
    [[-SqlInstance] <DbaInstanceParameter[]>]
    [[-SqlCredential] <PSCredential>]
    [[-Database] <String[]>]
    [[-InputObject] <Database[]>]
    [-Update]
    [[-LimitResults] <String>]
    [-EnableException]
    [<CommonParameters>]

 

Examples

 

Example: 1
PS C:\> Get-DbaDbMirrorMonitor -SqlInstance sql2008, sql2012

Returns last two hours' worth of status rows for a monitored database from the status table on sql2008 and sql2012.

Example: 2
PS C:\> Get-DbaDbMirrorMonitor -SqlInstance sql2005 -LimitResults LastDay -Update

Updates monitor stats then returns the last 24 hours worth of status rows for a monitored database from the status table on sql2008 and sql2012.

Optional Parameters

-SqlInstance

The target SQL Server instance

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

The target database.

Alias
Required False
Pipeline false
Default Value
-InputObject

Allows piping from Get-DbaDatabase.

Alias
Required False
Pipeline true (ByValue)
Default Value
-Update

Updates the status for the database by calling sp_dbmmonitorupdate before computing the results. However, if the status table has been updated within the previous 15 seconds, or the user is not a member of the sysadmin fixed server role, the command runs without updating the status.

Alias
Required False
Pipeline false
Default Value False
-LimitResults

Limit results. Defaults to last two hours. Options include: LastRow LastTwoHours LastFourHours LastEightHours LastDay LastTwoDays Last100Rows Last500Rows Last1000Rows Last1000000Rows

Alias
Required False
Pipeline false
Default Value LastTwoHours
Accepted Values LastRow,LastTwoHours,LastFourHours,LastEightHours,LastDay,LastTwoDays,Last100Rows,Last500Rows,Last1000Rows,Last1000000Rows
-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