wasabi3689
asked on
how to do this script?
I have a always-on databases, I want to have a script to do
When the always-on availability group failover is successful from primary to secondary, run this stored procedure. If not successful, do nothing. how to do that? I want to do that in an agent job or something, when the failover happened, automatically kick off this job. My always SQL is 2016 enterprise
When the always-on availability group failover is successful from primary to secondary, run this stored procedure. If not successful, do nothing. how to do that? I want to do that in an agent job or something, when the failover happened, automatically kick off this job. My always SQL is 2016 enterprise
ASKER
how to do that? how to check every minute in scripting?
Well, you'll need to store last status in a table and then compare it with the actual status. When differs then perform what you want to perform.
ASKER
need more detail coding you have before
No code. I'm giving you an high-level solution.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Solution provided.
You may have a SQL Agent job that runs every minute to check if the Primary Replica changed and then execute something when this validation is true.