AlwaysOn_health Extended Event Session

, 2018-07-25

The AlwaysOn_health XEvent session is installed by SQL Server by default, and started by the Create Availability Group wizard when a new availability group is created.

AlwaysOn_health Extended Event Session

The xEvent session collects events triggered by events directly affecting AlwaysOn availability group like;

  • AlwaysOn errors
  • AlwaysOn state transitions
  • AlwaysOn DDL executed to create, drop, or modify the availability group

The following symptoms should lead to review of the AlwaysOn_Health data:

  • Availability group unexpectedly in the Resolving state
  • Cannot access availability databases
  • Availability group in an indeterminate state like corrupt
  • Unexpected availability group fail-over

If you script out the AlwaysOn_health extended event, you will get the below T-SQL. The AlwaysOn_health session detects significant number of errors like a dramatic shift in synchronization, state transition, ability to fail over, and many more.

ADD EVENT sqlserver.alwayson_ddl_executed,
ADD EVENT sqlserver.availability_group_lease_expired,
ADD EVENT sqlserver.availability_replica_automatic_failover_validation,
ADD EVENT sqlserver.availability_replica_manager_state_change,
ADD EVENT sqlserver.availability_replica_state,
ADD EVENT sqlserver.availability_replica_state_change,
ADD EVENT sqlserver.error_reported(
    WHERE (	[error_number]=(9691) OR [error_number]=(35204) OR [error_number]=(9693) OR 
			[error_number]=(26024) OR [error_number]=(28047) OR [error_number]=(26023) OR
			[error_number]=(9692) OR [error_number]=(28034) OR [error_number]=(28036) OR 
			[error_number]=(28048) OR [error_number]=(28080) OR [error_number]=(28091) OR 
			[error_number]=(26022) OR [error_number]=(9642) OR [error_number]=(35201) OR 
			[error_number]=(35202) OR [error_number]=(35206) OR [error_number]=(35207) OR 
			[error_number]=(26069) OR [error_number]=(26070) OR [error_number]>(41047) AND 
			[error_number]<(41056) OR [error_number]=(41142) OR [error_number]=(41144) OR 
			[error_number]=(1480) OR [error_number]=(823) OR [error_number]=(824) OR 
			[error_number]=(829) OR [error_number]=(35264) OR [error_number]=(35265) OR 
			[error_number]=(41188) OR [error_number]=(41189))
ADD EVENT sqlserver.hadr_db_partner_set_sync_state,
ADD EVENT sqlserver.lock_redo_blocked
ADD TARGET package0.event_file(SET filename=N'AlwaysOn_health.xel',max_file_size=(5),max_rollover_files=(4))

Enjoy Learning!

The post AlwaysOn_health Extended Event Session appeared first on .





Related content

Database Mirroring FAQ: Can a 2008 SQL instance be used as the witness for a 2005 database mirroring setup?

Question: Can a 2008 SQL instance be used as the witness for a 2005 database mirroring setup? This question was sent to me via email. My reply follows. Can a 2008 SQL instance be used as the witness for a 2005 database mirroring setup? Databases to be mirrored are currently running on 2005 SQL instances but will be upgraded to 2008 SQL in the near future.


1,567 reads

Networking - Part 4

You may want to read Part 1 , Part 2 , and Part 3 before continuing. This time around I'd like to talk about social networking. We'll start with social networking. Facebook, MySpace, and Twitter are all good examples of using technology to let...


1,530 reads

Speaking at Community Events - More Thoughts

Last week I posted Speaking at Community Events - Time to Raise the Bar?, a first cut at talking about to what degree we should require experience for speakers at events like SQLSaturday as well as when it might be appropriate to add additional focus/limitations on the presentations that are accepted. I've got a few more thoughts on the topic this week, and I look forward to your comments.


360 reads