I have a database that was the published part of a working replication setup. It worked well for a considerable length of time however, when there were schema changes to be made the replication was not successfully removed. The database is now in a state where we cannot remove replication with any scripts as the results returned state the database is 'not taking part in replication' or they simply complete with a success message. We are not able publish the database either as we get errors stating that the database is already published. Catch22 it would seem. When I query `DATABASEPROPERTYEX(dtb.name, 'IsMergePublished')` the value returned is 1, indicating that somewhere inside the server thinks the database is still involved. Does anyone have any ideas on what I can try to alter this please?
First off, have you tried removing replication completely (if possible)? Disable Publication and Distribution runs a set of sprocs that clean up the meta data that can be missed otherwise. The problem can occur if you dropped a publication, but not cleanly (remote drop has done this for me before). If that doesn't work, there is the option of running the sprocs by hand. This [MSDN Link] talks about forcibly dropping subscriptions/publications. I recall there being a way of using @force parameters somehow. If these hints don't work, I will try and dig that out for you. :