Ask Paula!

...bringing you notes from the field...

  Home  |   Contact  |   Syndication    |   Login
  147 Posts | 5 Stories | 133 Comments | 0 Trackbacks

News

Copyright © 2008-2018 Paula DiTallo

Tag Cloud


Article Categories

Archives

Post Categories

Image Galleries

.NET Development

Enterprise Integration

Entertainment - Games

Java Development

Mobile/PDA Development

Professional Affiliations

If you are using the SSMS GUI, you may not be aware that behind the scenes, you are really issuing an ALTER DATABSE command.  It is likely that another process (or processes) were accessing the database you want to take offline.

If you're a DBA, or have sysadmin privileges, issue an sp_who2 command -- looking for the ALTER DATABSE process logged to you.  Kill the process. 

Once the process has been killed off, issue the ALTER DATABSE command yourself.

To take the database offline:

USE master
GO

ALTER DATABASE yourDBname
SET OFFLINE WITH ROLLBACK IMMEDIATE
GO

To get the database back online:

USE master
GO

ALTER DATABASE yourDBname
SET ONLINE
GO

For added protection of data you do not wish to be online:

ALTER DATABASE yourDBname SET RESTRICTED_USER

posted on Monday, September 14, 2015 7:35 AM