SQL Clone
SQLServerCentral is supported by Redgate
 
Log in  ::  Register  ::  Not logged in
 
 
 


Automatically Failover (Enable or Disable) Jobs Based on HADR Role


Automatically Failover (Enable or Disable) Jobs Based on HADR Role

Author
Message
Eitan Blumin
Eitan Blumin
SSC Rookie
SSC Rookie (39 reputation)SSC Rookie (39 reputation)SSC Rookie (39 reputation)SSC Rookie (39 reputation)SSC Rookie (39 reputation)SSC Rookie (39 reputation)SSC Rookie (39 reputation)SSC Rookie (39 reputation)

Group: General Forum Members
Points: 39 Visits: 119
Comments posted to this topic are about the item Automatically Failover (Enable or Disable) Jobs Based on HADR Role
pcd_au
pcd_au
Ten Centuries
Ten Centuries (1K reputation)Ten Centuries (1K reputation)Ten Centuries (1K reputation)Ten Centuries (1K reputation)Ten Centuries (1K reputation)Ten Centuries (1K reputation)Ten Centuries (1K reputation)Ten Centuries (1K reputation)

Group: General Forum Members
Points: 1023 Visits: 499
A timely post for me and I look forward to understanding the content in more details. However a quick suggestion, rather that maintaining a list of jobs, how about using the 'category' of Jobs. Perhaps "<AGName>-Primary" and "<AGName>-Secondary", then enable and disable the jobs in the category?

Also what are your suggestions for ensuring that the Jobs are on all servers and the jobs are the same?

pcd
Eitan Blumin
Eitan Blumin
SSC Rookie
SSC Rookie (39 reputation)SSC Rookie (39 reputation)SSC Rookie (39 reputation)SSC Rookie (39 reputation)SSC Rookie (39 reputation)SSC Rookie (39 reputation)SSC Rookie (39 reputation)SSC Rookie (39 reputation)

Group: General Forum Members
Points: 39 Visits: 119
pcd_au - Wednesday, November 14, 2018 3:35 PM
A timely post for me and I look forward to understanding the content in more details. However a quick suggestion, rather that maintaining a list of jobs, how about using the 'category' of Jobs. Perhaps "<AGName>-Primary" and "<AGName>-Secondary", then enable and disable the jobs in the category?

Also what are your suggestions for ensuring that the Jobs are on all servers and the jobs are the same?

pcd

Hi pcd,
Thank you for the comment!
Yes you are right, once could go about selecting jobs based on category too, that could definitely work.
Simply replace the jobs query with one from msdb..sysjobs

As for ensuring jobs are on all servers and the jobs are the same...
First one would need to set up a linked server for each replica.
Normally, setting up availability groups or database mirroring don't do that for you. So that's one extra step you'd have to do.

Next, you could query from msdb..sysjobs and msdb..sysjobsteps on each linked server and compare their contents.
It's kind of beyond the scope of this blog post, I think. But it shouldn't be too hard to do.

Go


Permissions

You can't post new topics.
You can't post topic replies.
You can't post new polls.
You can't post replies to polls.
You can't edit your own topics.
You can't delete your own topics.
You can't edit other topics.
You can't delete other topics.
You can't edit your own posts.
You can't edit other posts.
You can't delete your own posts.
You can't delete other posts.
You can't post events.
You can't edit your own events.
You can't edit other events.
You can't delete your own events.
You can't delete other events.
You can't send private messages.
You can't send emails.
You can read topics.
You can't vote in polls.
You can't upload attachments.
You can download attachments.
You can't post HTML code.
You can't edit HTML code.
You can't post IFCode.
You can't post JavaScript.
You can post emoticons.
You can't post or upload images.

Select a forum









































































































































































SQLServerCentral


Search