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
drop database ReplicationSource -- and remove disk files
drop database ReplicationTarget -- and remove disk files
drop database distribution -- and remove disk files
exec sp_removeDbReplication 'ReplicationSource'
exec sp_removeDbReplication 'ReplicationTarget'
exec sp_dropdistributor -- fails with Could not drop the Distributor 'DAVIDZ-PC'. This Distributor has associated distribution databases.