SQL 2005 Take Database offline
Posted on 2014-09-08
I have a database that is no longer used by any application and would like to take it offline then remove from the server to free up some disk space for a new database. When I try to use the management studio and select Tasks\Take Offline the task just spins and the database is never taken offline. When I try to use the following script:
"ALTER DATABASE [myDB] SET OFFLINE WITH ROLLBACK IMMEDIATE"
to take the database offline I get the
Msg 5061, Level 16, State 1, Line 1
ALTER DATABASE failed because a lock could not be placed on database 'DatabaseName'. Try again later.
Msg 5069, Level 16, State 1, Line 1
ALTER DATABASE statement failed.
What do I need to do to get this database offline and removed from the server?