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: , , , , ,

Friday, March 21, 2008

Determing the SQL Server 2005 version and SP

Hello,

I find that I need to figure out what version of SQL build and SP is applied to a client's SQL Server. For 2005, running either of these two queries is extremely helpful:
SELECT @@Version
or
SELECT SERVERPROPERTY('productversion'), SERVERPROPERTY ('productlevel'), SERVERPROPERTY ('edition')

I found excellent information on this Microsoft page:
http://support.microsoft.com/kb/321185

In general, I have been looking to see if the build is: 9.00.3054 or 9.00.3159 to figure out if the installation is SQL Server 2005 with SP2.

Thanks,
Mark

Labels: , ,