Sunday, October 3, 2010

Can't restore MSSQL database problem

This is a problem I encounter so many times.

Errors like database is locked or there are existing locks or cannot get exclusive access to the database always give me headaches and don't let me restore a DB over an existing one.

There are many complex solutions that deal with killing processes in the DB and moving it to single user mode - which tend to be very cumbersome and not always possible.

The simple solution is, if you manage to get your DB offline and delete it - you can restore your DB.
And usually you can offline and del your DB by disconnecting all connections by just restarting the MSSQL service in the windows service manager.

No comments:

Post a Comment

Feel free to comment. No links/URLs allowed in comments.