Friday, May 17, 2013

"Cannot restore database because it is currently in use" SQL Server 2005/2008

This is a frequent occurrence when refreshing a development environment.  The commands below will kill the connections and allow the restore to continue:


ALTER DATABASE
    SET SINGLE_USER WITH ROLLBACK IMMEDIATE
GO

ALTER DATABASE

SET MULTI_USER
GO

No comments:

Post a Comment