Replication failed due to referential integrity

  • One of our business units have reported a problem with replication. Unfortunately, I do not have all the details at this time, but my understanding is that a foreign key was added to a table that is being replicated, and a delete was attempted on the table that failed because the key existed in the referenced table. This has caused replication to fail. Is it safe to drop the referential integrity between the tables without causing the subscription to be reinitialized. The table in question is very large and reinitializing it would take too long. If it is possible, can it just be dropped using SQL or enterprise manager, or is there a system stored procedure that should be used instead.

  • Was the Foreign Key added to the Publishing Database or the Subscription Database?


    Kindest Regards,

  • Michelle,

    Are Foreign key relationships being being enforced for replicatino in your repl config? 

    Also, is this transactional or merge?

  • Merge Replication

    When creating the FOREIGN KEYS, you need to set the "not for replication option".  Merge Replication transports the data in batches, so not all of the data arrives at the same time, nor in Parent/Child order.

  • I was able to gather some more information, and actually this problem has been resolved. It seems the foreign key existed on the tables at the subscriber sites. The problem was resolved by disabling the constraint, restarting the replication to get past the error and the reenabling the constraint. I'm still not clear on the details as the databases in question are actually supported by another group in our organization, but they just inquired if we have ever run into a similar problem, which thankfully we have not. Thanks for all the replies.

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

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