sys.database_mirroring_witnesses (Transact-SQL)


Updated: June 10, 2016

THIS TOPIC APPLIES TO:yesSQL Server (starting with 2008)noAzure SQL DatabasenoAzure SQL Data Warehouse noParallel Data Warehouse

Contains a row for every witness role that a server plays in a database mirroring partnership.

Column nameData typeDescription
database_namesysnameName of the two copies of the database in the database mirroring session.
principal_server_namesysnameName of partner server whose copy of the database is currently the principal database.
mirror_server_namesysnameName of the partner server whose copy of the database is currently the mirror database.
safety_leveltinyintTransaction safety setting for updates on the mirror database:

0 = Unknown state

1 = Off (asynchronous)

2 = Full (synchronous)

Using a witness for automatic failover requires full transaction safety, which is the default.
safety_level_descnvarchar(60)Description of safety guarantee of updates on the mirror database:



safety_sequence_numberintUpdate sequence number for changes to safety_level.
role_sequence_numberintUpdate sequence number for changes to principal/mirror roles played by the mirroring partners.
mirroring_guiduniqueidentifierIdentifier of the mirroring partnership.
family_guiduniqueidentifierIdentifier of the backup family for the database. Used for detecting matching restore states.
is_suspendedbitDatabase mirroring is suspended.
is_suspended_sequence_numberintSequence number for setting is_suspended.
partner_sync_statetinyintSynchronization state of the mirroring session:

5 = The partners are synchronized. Failover is potentially possible. For information about the requirements for failover see, Role Switching During a Database Mirroring Session (SQL Server).

6 = The partners are not synchronized. Failover is not possible now.
partner_sync_state_descnvarchar(60)Description of the synchronization state of the mirroring session:



The visibility of the metadata in catalog views is limited to securables that a user either owns or on which the user has been granted some permission. For more information, see Metadata Visibility Configuration.

Database Mirroring Witness
sys.database_mirroring (Transact-SQL)
sys.database_mirroring_endpoints (Transact-SQL)
Querying the SQL Server System Catalog FAQ

Community Additions