Mundy

IT Knowledge Base

User Tools

Site Tools


Sidebar

Contact me at dan@mundy.co for any feedback or suggestions.


My other sites:

Search all my sites:

take_a_database_offline_in_microsoft_sql_server

Take a Database Offline in Microsoft SQL Server

In SQL Server Management Studio, right click the database, Tasks > Take Offline

If it seems to take too long, see Long wait-time when taking SQL Server database offline | Degree Blog:

ALTER DATABASE <dbname> SET OFFLINE WITH ROLLBACK IMMEDIATE

In some cases you might get an error saying:

ALTER DATABASE failed because a lock could not be placed on database 'dbname' Try again later.

After you get this error, run

EXEC sp_who2

Look for the database in the result and find the SPID for that connection, then run

KILL <SPID>
take_a_database_offline_in_microsoft_sql_server.txt · Last modified: 2018/04/09 09:56 (external edit)