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 have a development database which has entered recovery mode on restart, and has been recovering for the last hour or so.

I need to either stop the recovery, or kill it in some way.

I don't care one bit about the database or any of the data, I have deployment scripts.

Any ideas?

share|improve this question

migrated from stackoverflow.com Jan 21 '12 at 16:47

This question came from our site for professional and enthusiast programmers.

up vote 32 down vote accepted
  • Stop SQL Server
  • Delete MDF + LDF
  • Start SQL Server
  • Restore (may need to drop first, comes up suspect)

If the MDF and LDF are present on service start up, it will go into rollforward/rollback recovery. You have to drop them to prevent this.

share|improve this answer
2  
What if you can't stop sql server because of other databases that shouldn't go down? There is no other way? – Erik Dekker Jan 31 '14 at 13:11
1  
@ErikDekker Probably too late to be of help, but you can also just detach the database – Ben Aaronson Sep 30 '15 at 9:01
    
This was perfect advice for my situation. Dummy/dev-testing instance, database restore was interrupted midway, had to completely kill it and remove it before attempting a fresh restore. The bit "need to drop first" was the trick -- after you stop SQL service, delete the files, and start SQL service, the DB will still be listed in the object-explorer, but simply right-click-"Delete" (aka Drop) will finish it off. Thanks! – NateJ Feb 26 at 1:16
  1. Right click on the database in SQL Server Management Studio, and hit Detach.
  2. Select the Drop Connections checkbox only, and hit ok.
  3. Then the database will disappear.
  4. Right click on the Databases folder, and click Attach...
  5. Click Add and find the .mdf file for the database you deleted. You will have to find it in the file system.
  6. Click Ok, and it will be back online.
share|improve this answer

protected by Mark Storey-Smith May 20 '14 at 7:40

Thank you for your interest in this question. Because it has attracted low-quality or spam answers that had to be removed, posting an answer now requires 10 reputation on this site (the association bonus does not count).

Would you like to answer one of these unanswered questions instead?