Why SQL Server doesn't allow to remove a Distributor exactly after Configuration?

Mohammad Sheykholeslam picture Mohammad Sheykholeslam · Apr 17, 2012 · Viewed 17.3k times · Source

I Configured a distribution in SQL Server 2008 using both Wizard and T-SQL but after it when I want to remove it Using Wizard (right clicking on Replication and choosing 'Disable Publishing and Distribution...') or executing following command with and without its parameters:

exec sp_dropdistributor @no_checks = 1 -- no new results with @ignore_distributor = 1

this Error would be presented:

Msq 21122, Level 16, State 1, Procedure sp_dropdistributiondb Line 124 Cannot drop the distribution database 'lobloblob' because it is currently in use.

I didn't publish any thing, didn't configure any subscription but gave this error what should I do ?

Answer

Brandon Williams picture Brandon Williams · Apr 18, 2012

Try this:

SELECT spid FROM sys.sysprocesses WHERE dbid = db_id('distribution')

Kill the spid and try again. Now it should work.