Smart questions
Smart answers
Smart people
INTELLIGENT WORK FORUMS
FOR COMPUTER PROFESSIONALS

Member Login

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips now!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!

Join Tek-Tips
*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

LINK TO THIS FORUM!

Add Stickiness To Your Site By Linking To This Professionally Managed Technical Forum.
Just copy and paste the
code below into your site.

Partner With Us!

"Best Of Breed" Forums Add Stickiness To Your Site
Partner Button
(Download This Button Today!)

Feedback

"...I think this forum rocks it has saved my bacon many many times..."

Geography

Where in the world do Tek-Tips members come from?
foxdev (Programmer)
13 Jul 12 10:58
Short version: sp_adddistributiondb ran on wrong database; how to "undo" that.

I goofed. I had a script that sets up replication on our test box; after a successful test, I modified the server and database names within the script to run on our production box.

Except I goofed on the database name for the call to SP_AddDistributionDB: rather than passing it the name of a new, separate distribution database, I gave it the name of a production database (the database that we want to publish).

Severe panic when the database no longer shows in the list of databases. Fortunately, it is still there, but now flagged as a "system" database in SSMS.

Either my search-fu is broken, or no one else has ever had this problem. The database is operational, but clearly isn't quite right.

How can I undo whatever gets done by sp_adddistributiondb (assumedly to both the database itself as well as various system databases/tables)? The corollary to sp_adddistributiondb is sp_dropdistributiondb; my fear is that would drop the entire database, but maybe it's more benign than that.

Any advice?
SQLBill (MIS)
13 Jul 12 11:35
According to BOL, it seems that command will drop the distribution database and since it seems you turned your production database into the distributor....it might get dropped.

I've never had this happen so I don't have a solution, but I do suggest that you backup the database just before you run any commands to undo your work. That way if the database is dropped, you can always restore it.

-SQLBill

The following is part of my signature block and is only intended to be informational.
Posting advice: FAQ481-4875: What should I know before I post?

foxdev (Programmer)
13 Jul 12 12:14
Thank you for the reply, SQLBill. The database is part of a regular backup scheme, and we're making additional backups just in case.

I think the main issue are the system databases/tables. When we restore this database on a different server (something we do every day anyway to serve as a reporting database), it looks completely normal, and is not flagged as a distributor or system database.
foxdev (Programmer)
15 Aug 12 14:15
Just a follow-up in case anyone else encounters this issue: the answer indeed was to run sp_dropdistributiondb. Part of the sp_adddistributiondb sproc is to flag the distribution database as having been pre-existing, or created by the sp_adddistributiondb; when sp_dropdistributiondb runs it checks that flag, if set as pre-existing, it does not drop the database.

Running sp_dropdistributiondb got the database back to normalish. I had to manually set the recovery mode back to "full". In addition, there are several leftover distribution objects in the database; these are generally benign, but I ended up going through additional steps to remove them since it seemed they were preventing me from implementing replication on that database.

Reply To This Thread

Posting in the Tek-Tips forums is a member-only feature.

Click Here to join Tek-Tips and talk with other members!

Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close