Ramblings about MS Dynamics CRM 2011 and coding basics.

Wednesday, April 02, 2008

Changing SQL dB from Single User Mode

Recently, a CRM SQL Server 2005 dB was turned into Single User mode. This means that only one user may connect to the dB at a time, and if a service is connected, then you can't connect.

It took some research and elbow grease, but this is how I changed it back to multi-user mode.
(I am using 'database_MSCRM' as my database name for my examples.)

I ran this SQL query to find the active connection to the dB that is not my own:
select spid from master..sysprocesses where dbid = db_id('database_MSCRM') and spid <> @@spid

I got the ID, which was 52. Then I ran this query

Kill 52
ALTER DATABASE database_MSCRM SET MULTI_USER

That killed the connection, then changed the setting to multi-user. I tried to run them separately, but the service was reconnecting so quickly that the Alter command wasn't valid.
I decided to run them together, and it worked great!

Good luck,
Mark

reference: http://msdn2.microsoft.com/en-us/library/aa933230.aspx
reference: http://www.kodyaz.com/articles/alter-single-user-multi-user-mode.aspx

Labels: , , , , ,

0 Comments:

Post a Comment

<< Home