All,
I setup a Database Alert that sends an alert when the failover (19406) happens. I also have setup an Alert (1480) when one of the databases (TESTDB) in the AG becomes PRIMARY.
I could set up a Job that would run to alter the TRUSTWORTHY option for the Database to ON that would get triggered by the Alert or I'm thinking of writing a Server level trigger that would fire whenever the database role changes to PRIMARY.I tried searching the DMV/Tables to get this status info but I'm not able to locate. Any ideas as to how it can be done?
<<The availability group database "TestDB" is changing roles from "RESOLVING" to "PRIMARY" because the mirroring session or availability group failed over due to role synchronization>>
grajee