MS SQL 2008 – problems with read-only database

7 Jun

When trying to put the database offline/enable read_write  you get this message:

Error 3101
Severity Level 16
Message Text
Exclusive access could not be obtained because the database is in use.

Here’s what I did to solve the case:
  1. close all query windows towards the database
  2. always use “use master” in the first row when working towards the database
  3. code
    1. user master
    2. go
    3. alter database [name] set read_write with no_wait
    4. go
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

%d bloggers like this: