Take the 2-minute tour ×
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. It's 100% free, no registration required.

Sorry in advance for the noob question.

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 submited 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 stuff.

share|improve this question

1 Answer 1

up vote 4 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:

RESTORE DATABASE [foo] WITH RECOVERY;

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

 
discard

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.