0

An database being used at my job has several tables that appear to be remnants of an previous replication setup. These tables are no longer needed not having been used for at least 10 years so I am trying to delete them. However, it won't let me because it's still indicating they are being used for replication.

The error being encountered is

Cannot drop the table 'dbo.xdc_trnitem' because it is being used for replication. (Microsoft SQL Server, Error: 3724).

This Database does not appear to be setup to be either a Publisher or Subscriber because there is nothing in the Local Publications folder.

I have researched the issue, but so far everything I have found required needs information about replication setup: Articles, Publishers, Subscribers, etc that I don't have. I thought maybe it was a constraint or index on the table causing the issue, but I tried removing those on one of the tables and it still wouldn't let me delete it.

I was wondering if anyone else has encountered this situation and was able to resolve it?

2
  • So what is the exact error message? Right now your question sounds like a duplicate of this one. Have you tried the approach described there?
    – rois
    Commented Mar 24 at 10:03
  • The error being encountered is Cannot drop the table 'dbo.xdc_trnitem' because it is being used for replication. (Microsoft SQL Server, Error: 3724). I reviewed the other question referenced. This Database does not appear to be setup to be either a Publisher or Subscriber because there is nothing in the Local Publications folder. As result I believe the scripts, I see to remove replication are not able to do anything As far as I am aware no database replication has occurred as long as I have been with the Company, which is almost 6 years. Commented Mar 24 at 16:52

3 Answers 3

0

You can run the following script to cleanup any orphan replication objects:

USE [<YourDatabaseName>]
GO

exec sp_cleanupdbreplication
GO
exec sp_removedbreplication
GO
0

The solution ended up being to run sp_msunmarkreplinfo 'table_name';

-1

Replication stores internal objects in the published database. That you don't see any active publication in SSMS means nothing here. From the error message it's clear those replication objects were not completely removed. See error documentation:

If this error occurs in a database that is not replicated, execute sp_removedbreplication (Transact-SQL) to ensure objects in the database are not marked as replicated.

You need to run sp_removedbreplication on the database to clean it up.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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