rebuild clustered index in transactional replication

  • Hi, I am planning to run a script to rebuild highly fragmented clustered indexes on tables in transactional replication. Is there any caveat anyone know of? I read something a while ago saying that rebuilding clustered indexes on the publisher will actually move(like doing a delete and insert) rows in the published table around. Also, do I need to run the script on both the publisher and subscriber (not need to run the clustered rebuild, but do need to run the script for nonclustered indexes on the subscriber)?

  • I think the index command gets replicated, so the subscribers will rebuild indexes as well. Shouldn't hurt, but you should be aware the subscribers will run this.

  • Thanks Steve!

    I ran some test on a table that gets replicated together with its clustered index and nonclustered indexes. When I ran index rebuild on the clustered index on the publisher, I noticed through replication monitor a message saying 'xxxxx commands were delivered', so I checked the fragmentation statistics, the fragmentation percentage was reduced on the publisher, but remained unchanged on the subscriber. Then I ran the same command on the subscriber, its fragmentation was reduced. I am not exactly sure what 'xxxxx commands were delivered' does though.

  • Hey Steve,

    I am a step ahead of our friend.We have data moved from one data file to another.This is nearly 900gb in size.We have transactional replication setup with push subscription.

    Now after i moved the data the log file grew as expected because I have used drop existing = on when I moved the data of clustered indexed tables.

    The log reader agent started performing bad and is not delivering the transactions any more and I am not able to shrink the t - log even after 2 full backups.

    The db size is 3.5 tb and log size grew from 100gig to 780.

    sql server enterprise 2008 sp3 on windows server 2008 r2.

    Any help would be appreciated .......

Viewing 4 posts - 1 through 3 (of 3 total)

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