Script to get Always On Availability group failover time from SQL Server Error log

-> Below script can be used to get Always On Availability group failover time from current SQL Server error log.

sp_readerrorlog 0,1,'The state of the local availability replica','JBAG'

From the above command,

sp_readerrorlog is the command.
0 refers to current SQL Server error log file. Increment this value to check old logs.
1 refers to SQL Server error log.
The state of the local availability replica refers to search string 1.
“JBAG” refers to search string 2. I have used the name of availability group for which I am checking the failover time.

Thank You,
Vivek Janakiraman

Disclaimer:
The views expressed on this blog are mine alone and do not reflect the views of my company or anyone else. All postings on this blog are provided “AS IS” with no warranties, and confers no rights.

 

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s