Quantcast
Channel: AlwaysON job active-Passive
Viewing all articles
Browse latest Browse all 11

AlwaysON job active-Passive

$
0
0

The code supplied by Tom should work and is a valid option, however at my place of work we decided to implement the example below. Just because your database is a primary replica database doesn't mean it will be in READ_WRITE mode (especially if there are problems with your AG), so we did the following.

Obviously choose whichever code segment that works for you.

IF(DATABASEPROPERTYEX('YourDBName','Updateability')<>'READ_WRITE')
BEGIN
THROW 50000,'AG Group not active or writeable',1
END
Set the failure action for this first step to "Quit the job reporting success".


Regards,
Mark Broadbent.
Microsoft Certified Master | Microsoft Data Platform MVP
Contact me through twitter | blog | sqlcloud


Please click "Propose as answer" if a post solves your problem
or/and vote the post up if it has been helpful.

Interested in attending a free training? Why not attend SQLSaturday Cambridge and SharePoint Saturday Cambridge? And why not check out my Ultimate Training Resources Page?

Viewing all articles
Browse latest Browse all 11

Trending Articles