0

I was starting to configure replication on SQL Server database. I created a distributor with the following command:

exec sp_adddistributiondb @database = N'prod_database', 
                          @data_folder = N'D:\Data', @log_folder = N'L:\Logs', 
                          @log_file_size = 2, @min_distretention = 0, 
                          @max_distretention = 72, @history_retention = 48, 
                          @deletebatchsize_xact = 5000, @deletebatchsize_cmd = 2000, 
                          @security_mode = 1

I have a database prod_database with the same name as the distributor I created.

I am trying to delete the distributor with:

exec sp_dropdistributor  @no_checks = 1, @ignore_distributor = 1

I am getting the following error:

Msg 21122, Level 16, State 1, Procedure sys.sp_dropdistributiondb, Line 125 [Batch Start Line 0]
Cannot drop the distribution database 'prod_database' because it is currently in use.

It is a production environment.

I am using Microsoft SQL Server Management Studio and now this database is shown on System Database folder.

I want to delete the distributor created.

4
  • It says it is in use. Maybe someone has an active connection to it somehow, even if not active, an open connection. Commented Jun 5 at 19:01
  • Might be your own connection, switch to master Commented Jun 5 at 19:20
  • Wait, do you mean you have messed up and bound a real database name against some kind of distribution setup? Commented Jun 5 at 23:00
  • The distribution tag does not mean what you appear to think it does. Please read tag descriptors before using the tag. Commented Jun 8 at 14:31

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.