question

Sajal avatar image
Sajal asked

Cannot drop the table [] because it is being used for replication.

Hi Geeks, We have transaction replication setup (not bidirectional or updatable subscriber) with Publisher A having Subscriber B. The subscriber B is acting as a publisher for six more subscribers. Now, when I tried to reinitialize the subscription for B (with new snapshot as older snapshots were deleted),The replication is failing with error : Cannot drop the table 'table_name' because it is being used for replication. table_name is one of many tables in article being published. Do I need to drop all the subscribers of B (as B is also a publisher) and set the things up from scratch? Need suggestions on workaround or fix. TIA ! Regards, Sajal Bagchi
replicationerror-messagetransactional-replication
10 |1200

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

1 Answer

·
sjimmo avatar image
sjimmo answered
Set your attributes for the package that you are trying to reinitialize, the article properties, so that the Action if name is in use to Delete Data. This will push the reload throughout your system without dropping the tables or having to remove the replication in the middle.
3 comments
10 |1200

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Sajal avatar image Sajal commented ·
Thanks for the reply, but my question still remain the same, do I need to drop all existing subscribers of publisher B (which is a subscriber of publisher A) ?
0 Likes 0 ·
sjimmo avatar image sjimmo commented ·
Sorry, I made a mistake. I misread your question. You are replicating from A -> B and then the same tables from B -> C, D, E, F, G, H My first question would be why not have one distributor going to all servers? In your configuration you will need to drop the package from B out. Then reinitialize. I would still set up the package(s) so that they do not drop and recreate a table if it already exists. Now, the reason for this is because when the table is loaded from the new snapshot, it will be bcp'd in. Replication does not replicate bcp very nicely as it is usually a nonlogged event. Once your table is loaded on B, then you can create everything from B. An alternative would be to turn off your replication packages, import the data to all of the locations. Then recreate your packages telling it that the data is already there. In this way it will not reinitialize and reload everything. This would depend on how much data there is to load and the amount of time plus how hard is the tables hammered on.
0 Likes 0 ·
Sajal avatar image Sajal commented ·
There is a requirement of business to have multi layer replication setup ,having subscribers located across different geographic location,may be to mitigate the load from one publisher with multiple subscribers. I will try dropping off all the subscribers of B as suggested and update. Thanks a lot !
0 Likes 0 ·

Write an Answer

Hint: Notify or tag a user in this post by typing @username.

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.