4

I have restored a database in another server. I don't want any of the transactional subscriptions of the former database. I already called

exec sp_removedbreplication 'MyRestoredDB' 
go

And also

exec sp_cleanupdbreplication
go

And

exec sp_replicationdboption 'MyRestoredDB','Publish','False',1
go

But when I try

truncate table dbo.sample

I get the following error:

Msg 4711, Level 16, State 1, Line 7 Cannot truncate table 'sample' because it is published for replication or enabled for Change Data Capture.

I verified that the database isn't enabled for CDC. What else I can do to perform the truncate? Delete isn't an option for reasons not relevant to the question.

0

Take a look at this article: https://www.mssqltips.com/sqlservertip/2710/steps-to-clean-up-orphaned-replication-settings-in-sql-server/

Try dropping the old subscriptions, all publications and then removing replication from the DB, i.e.

exec sp_dropsubscription --on all subscriptions

then

exec sp_droppublication --on all publications

then

exec sp_replicationdboption

Also, take a look at this question: How to fix a messed up replication on MS SQL Server

| improve this answer | |
  • sp_removedbreplication already dropped all my subscriptions. I don't have any publications in the target server. However, SQL Server still thinks the table is being replicated. – ReluctantDBA Sep 14 '18 at 0:16

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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