How to make MSSQL Offline

Open up MSSQL Management Studio

Then Select Database -> your Database -> right click -> Task -> Take Offline.

If the database does not make offline then you can do the following

ALTER DATABASE <dbname> SET OFFLINE WITH ROLLBACK IMMEDIATE

If this is not working then use the following to find spid

USE master SELECT * FROM sys.sysprocesses WHERE dbid = DB_ID('MyDB')

or

EXEC sp_who2

then use

kill spidNumber

To force disconnections, use

ROLLBACK IMMEDIATE USE master ALTER DATABASE MyDB SET SINGLE_USER WITH ROLLBACK IMMEDIATE
Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s