I'm using Ola's script to rebuild indexes. But after problems with script blocking particular objects that are used by SOLR, I wanted to exclude them and run script for them in another schedule. So, in main job I've set parameter @indexes like this:

@Indexes = 'ALL_INDEXES, -database.schema.object_1, -database.schema.object_2, -database.schema.object_3'

Is this a correct settings for this parameter? Can I add here multiple objects? Also, in second job I've set only this objects to be rebuild (without ALL_INDEXES).

  • You have doubled hyphen for your last object, but your statement looks ok.
    – M.Ali
    Commented Jan 24, 2018 at 8:40
  • Yes, that was my mistake when I was rewriting names for this question ;) Thanks for response!
    – Barterbly
    Commented Jan 24, 2018 at 9:14

1 Answer 1


Yes that looks like the correct syntax (except you have two '--' for your last index name? :-) )

Also, when you are writing your script for these indexes only, you do not need the '-' before the index name.

more info here: https://ola.hallengren.com/sql-server-index-and-statistics-maintenance.html

  • Two '--' was my mistake only in writing this question - sorry ;) In job there are single '-' before object name. As for second job, indexes parameter is like this: @Indexes = 'database.schema.object_1, database.schema.object_2, database.schema.object_3' I wondered if the names of the objects separated by a comma would work. Thanks for response!
    – Barterbly
    Commented Jan 24, 2018 at 9:07

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