Database Administrators Stack Exchange is a question and answer site for database professionals who wish to improve their database skills and learn from others in the community. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

We have a three server cluster using AlwaysOn technology, and have created an Availability Group for the SSISDB catalog.

How would you change the code to only execute on the primary server?

share|improve this question

closed as unclear what you're asking by swasheck, Mark Storey-Smith, Jon Seigel, billinkc, StanleyJohns Jul 18 '13 at 3:57

Please clarify your specific problem or add additional details to highlight exactly what you need. As it's currently written, it’s hard to tell exactly what you're asking. See the How to Ask page for help clarifying this question.If this question can be reworded to fit the rules in the help center, please edit the question.

Can you please define "the code"? – Aaron Bertrand Jan 17 '13 at 16:00

If you're talking about accessing the primary replica (and the Availability Group database on the primary replica) at all times, this is where the Availability Group Listener comes into play.

See this quote from BOL on the topic:

You can provide client connectivity to the primary replica of a given availability group by creating an availability group listener. An availability group listener provides a set of resources that is attached to a given availability group to direct client connections to the appropriate availability replica.

So instead of referencing a particular server, by using the Listener you can be pointing at the current primary replica of the AG.

BOL reference on Availability Group Listeners

Edit: As per Aaron's comment below, you may be looking for more specifics surrounding the particular catalog DB (as opposed to generic handling as above). You can find more information regarding this on the MSDN SSIS blog here. If both of these points explained in this answer do not clear up your question, please clarify what exactly you're looking to do.

share|improve this answer
I think he means the SSIS code, but at the very least the question is ambiguous. – Aaron Bertrand Jan 17 '13 at 15:56
@AaronBertrand Good point. I have edited and put a link to an MSDN blog post that may or may not answer his question. – Thomas Stringer Jan 17 '13 at 16:01

Not the answer you're looking for? Browse other questions tagged or ask your own question.