5

I'm configuring the Ola Hallengren scripts for Index maintenance on all servers in may Availability Group cluster which has several AG's and databases which are not in AG's.

If I select the "ALL_DATABASES" option, is the script intelligent enough to exclude the read only secondary replicas?

11

Yes, the script is intelligent enough.

This is explicitly stated in the FAQ:

How should I configure IndexOptimize for an Availability Group?

Indexes can only be rebuilt or reorganized and statistics only updated on the primary replica in an availability group. IndexOptimize has a check for this.

The jobs should be configured identically and be enabled and scheduled on all the replicas.

  • Thanks for your response. I had seen this comment but I could not decide if the configuration it was referring to was that I had to specify "Availability Groups" in the backup options or If I could still just specify "All databases". – Phil Holmes Oct 12 '17 at 13:55
4

Yes it will only optimize the databases which it can optimize, it will not fail if the database is read-only or in any other non optimizable-able state

  • 3
    Just to clarify - he was asking about index maintenance, so you may wanna focus your answer on that. (Plus the backup answer gets a little bit trickier - you'd have to talk about backup preference, for example, so I'd steer clear of that in your answer.) – Brent Ozar Oct 10 '17 at 10:28
  • 1
    Thank you, Altered the answer guess I was not that awake this morning – Stijn Wynants Oct 10 '17 at 10:44

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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