Database Mirroring State Change Event Class


Applies To: SQL Server 2016

The Database Mirroring State Change event class indicates when the state of a mirrored database changes. Include this event class in traces that are monitoring conditions of mirrored databases.

When the Database Mirroring State Change event class is included in a trace the relative overhead is low. The overhead may be greater if the state of the mirrored databases increase.

Data Column NameData TypeDescriptionColumn IDFilterable
DatabaseIDintID of the database specified by the USE database statement or the default database if no USE database statement has been issued for a given instance. SQL Server Profiler displays the name of the database if the ServerName data column is captured in the trace and the server is available. Determine the value for a database by using the DB_ID function.3Yes
DatabaseNamenvarcharName of the mirrored database.35Yes
EventClassintType of event = 167.27No
EventSequenceintSequence of event class in batch.51No
IntegerDataintPrior state ID.25Yes
IsSystemintIndicates whether the event occurred on a system process or a user process. 1 = system, 0 = user.60Yes
LoginSidimageSecurity identification number (SID) of the logged-in user. You can find this information in the sys.server_principals catalog view. Each SID is unique for each login in the server.41Yes
RequestIDintID of the request containing the statement.49Yes
ServerNamenvarcharName of the instance of Microsoft SQL Server being traced.26No
SessionLoginNamenvarcharLogin name of the user who originated the session. For example, if you connect to SQL Server using Login1 and execute a statement as Login2, SessionLoginName shows Login1 and LoginName shows Login2. This column displays both SQL Server and Windows logins.64Yes
SPIDintID of the session on which the event occurred.12Yes
StartTimedatetimeTime at which the event started, if available.14Yes
StateintNew mirroring state ID:

0 = Null Notification

1 = Synchronized Principal with Witness

2 = Synchronized Principal without Witness

3 = Synchronized Mirror with Witness

4 = Synchronized Mirror without Witness

5 = Connection with Principal Lost

6 = Connection with Mirror Lost

7 = Manual Failover

8 = Automatic Failover

9 = Mirroring Suspended

10 = No Quorum

11 = Synchronizing Mirror

12 = Principal Running Exposed
TextDatantextDescription of the state change.1Yes
TransactionIDbigintSystem-assigned ID of the transaction.4Yes

Extended Events
sp_trace_setevent (Transact-SQL)

Community Additions