Remove sql server database from single user

5 Jul

If your database are in single user mode – do the following.

 

To check which session are logged on that database:

select d.name, d.dbid, spid, login_time, nt_domain, nt_username, loginame
  from sysprocesses p inner join sysdatabases d on p.dbid = d.dbid
 where d.name = 'testdb01'
go


Use spid to kill the session:
kill spid
go

Set single user mode to false:
exec sp_dboption 'testdb01', 'single user', 'FALSE'
go

 

http://remidian.com/2008/01/remove-sql-server-database-from-single-user-mode/

 

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: