Database Mirroring State Change Event Class

Applies to: SQL Server Azure SQL Database

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 Database Mirroring State Change Event Class Data Columns

Data Column Name Data Type Description Column ID Filterable
DatabaseID int ID 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. 3 Yes
DatabaseName nvarchar Name of the mirrored database. 35 Yes
EventClass int Type of event = 167. 27 No
EventSequence int Sequence of event class in batch. 51 No
IntegerData int Prior state ID. 25 Yes
IsSystem int Indicates whether the event occurred on a system process or a user process. 1 = system, 0 = user. 60 Yes
LoginSid image Security 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. 41 Yes
RequestID int ID of the request containing the statement. 49 Yes
ServerName nvarchar Name of the instance of Microsoft SQL Server being traced. 26 No
SessionLoginName nvarchar Login 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. 64 Yes
SPID int ID of the session on which the event occurred. 12 Yes
StartTime datetime Time at which the event started, if available. 14 Yes
State int New 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
30 Yes
TextData ntext Description of the state change. 1 Yes
TransactionID bigint System-assigned ID of the transaction. 4 Yes

See Also

Extended Events
sp_trace_setevent (Transact-SQL)