Link to home
Start Free TrialLog in
Avatar of CFS_developer
CFS_developer

asked on

How to delete SQL server replication

On SQL Server 2008 R2, I am trying to setup transactional replication with test data and I'm getting an error:  
SQL Server could not create publication PubOne.
Database 'distribution' does not exist.  

This probably occurs because I previously tried to setup replication,
dropped my test databases, dropped distribution, and started over.

How do I fix this mess and truly start over?  


Here's what I tried to delete replication:

alter database ReplicationSource set offline
alter database ReplicationTarget set offline
alter database distribution      set offline
go

drop database ReplicationSource -- and remove disk files
drop database ReplicationTarget -- and remove disk files
drop database distribution      -- and remove disk files
go

exec sp_removeDbReplication 'ReplicationSource'
exec sp_removeDbReplication 'ReplicationTarget'
go

exec sp_dropdistributor   -- fails with    Could not drop the Distributor 'DAVIDZ-PC'. This Distributor has associated distribution databases.
go
SOLUTION
Avatar of Vitor Montalvão
Vitor Montalvão
Flag of Switzerland image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
ASKER CERTIFIED SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of CFS_developer
CFS_developer

ASKER

My input provided part of the solution