Database Administrators Stack Exchange is a question and answer site for database professionals who wish to improve their database skills and learn from others in the community. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I am trying to learn to mirror a test database and in the course of doing this, was typing in some commands into a query box. While trying to create a database mirroring endpoint I submitted a command with a typo. I was returned an error. I tried to resubmit a corrected command, but then was told that the endpoint already existed. So then I figured I'd just delete my test database and restart. I deleted the database in my primary SQL Server, but now my mirror SQL Server shows my test database as restoring, and I am unable to delete that one.

Is there a way to undo everything that I have done, going back to a installation default of my SQL Server? There is nothing I need to save, I'm just trying to learn.

share|improve this question
up vote 5 down vote accepted

To completely reset everything would involve uninstalling/reinstalling SQL Server. But this is overkill. Instead it sounds like you have two things you need to do.

Thing 1

First thing you should do is clean up your endpoints. I would do this on both your primary and mirror server. The DROP ENDPOINT command is straightforward. If you need to see what endpoints are currently out there, you can select from sys.endpoints.

Thing 2

Drop your old database. If it's stuck in recovery, the first thing to check is your SQL Error Log on the mirroring target and make sure it isn't actually doing anything. You want to look for messages containing the word "Recovery" and "Step n of 3". If these are there, it's still in the process of restoring. Otherwise, you just need to complete the recovery with:


Once you have completed recovery and the database is online, you should be able to drop it.

share|improve this answer
Thank you for the quick reply. I'm giving it a try! – Gabriel Brooks Dec 23 '13 at 21:01
Thank you again. It worked and I'm back on track with my studies. How can I mark your answer correct though? (Still trying to get a handle on the way this forum works!) – Gabriel Brooks Dec 24 '13 at 16:55
@GabrielBrooks You should see a check mark in grey. Click that and it will accept this as the answer. – Mike Fal Dec 24 '13 at 21:01
Thanks again, and done! – Gabriel Brooks Dec 26 '13 at 23:24

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.