Indexes on subscriber database with Replication

  • Hi,

    When creating the snapshot I didn't choose the option copy non-clustered indexes. I created some indexes manually on subscriber database. Replication failed later with some issue.

    so reinitialized with new snapshot but all the indexes are gone from the subscriber database.

    How to keep the indexes without dropping from subscriber database whenever we reinitialized with snapshot

  • I believe when you initialize from a snapshot by default it will drop and create the tables, hence the indexes will be gone. If your indexes are the same as what's on the publisher you could simply include them in the options for the article, or if they are custom you could keep them scripted out and then apply as part of the re-initialize. You should also look at the pre-creation options on the article; while I don't have a setup handy to verify I would bet if you change the option from the default of 'drop' to 'truncate' or 'delete' your indexes will remain.

  • If we change that option now, is this required to reinitialize again

  • Which option do you mean (the include indexes or the 'truncate' vs 'drop' pre-creation one)?

  • Yip, you will be asked to reinitialize if you make any changes to the publisher properties.

    You can also look at including a script to run after a reinitialize.

    or, change the properties of the articles from "drop and recreate" to "delete"

  • Thank you

Viewing 6 posts - 1 through 5 (of 5 total)

You must be logged in to reply to this topic. Login to reply