Skip to main content

From The Field

Go Search
From The Field
  

From The Field > Posts > Does this SQL Server Host a SharePoint Farm ?
Does this SQL Server Host a SharePoint Farm ?
I recently responded to a thread on Twitter (http://www.twitter.com) offering to describe a method of detecting whether a SQL server hosts a SharePoint farm. Several folks followed up asking for a blog on how to do this so here goes. Note: This is the same for 2007 and for 2010
 
Consider the way PSConfig identifies a Configuration Database when you try to join a server to an existing farm.
 
Once you choose to join an existing farm, you will then be asked to specify a database server.  At that point you have the option of retrieving the database names of every configuration database on that server so that you can choose the farm you would like to join.
 
The database name field is populated by issuing the following SQL command from the WFE to the SQL Server:

 
SELECT name FROM sysdatabases WHERE has_dbaccess (name) = 1
 
The server responds with a list of all databases to which the logged in user has access.
In order to determine which databases are configuration databases, the following SQL query is used:

SELECT @Version=Version FROM [dbo].[Versions] WHERE VersionId=@VersionId

In this case the VersionId that SharePoint is trying to match is:

60B1F2BE-5130-45AB-AF1D-EDD34E626B5D

Only a configuration database will have a row that matches this GUID although you will find a Versions table in all SharePoint databases.
Once the information requested is provided, clicking Next will perform the following actions.
The database id is determined using the friendly name for the database. 

SELECT @dbid = db_id(@databaseName)

Next, SharePoint will read in the application settings that are related to the farm to be connected to. Once that is complete, the configuration wizard will display a final confirmation before performing the configuration.

Comments

Which versions does this work on?

Does the GUID you specified for Version change by Version/Edition/Service Pack of Sharepoint? 
 
Do you happen to have a list of the GUIDs for other versions or is it just a matter of installing that version & looking up the version number?
at 11/5/2009 8:51 AM

Is this reliable across versions and SKUs?

Is this the same for all SharePoint 2007 based SKUs (WSS, MOSS, Proj, Search, Forms, Groove, etc. etc.)?
 
Is it the same for all major/minor versions (2003, 2007, 2010, etc.)?
 
Is this supported/documented by SharePoint team (i.e., we can rely on it not being changed ever)?
 
Great data, thanks! I just want to know the parameters/expectations I can set around this.
at 11/5/2009 10:46 AM

Response to Q regarding SKUs and Versions

I can confirm this is accurate for WSSv3, WSSv4 (SharePoint Foundation), MOSS 2007 and SP2010 across all SKUs and that it is independent of the build number.
 
I cannot confirm this works for Groove, Project or Forms Server but since Project and Forms require an underlying WSS instance there is a good chance you are on safe ground with those.
 
This approach is the way PSCONFIG determines the presence of a SharePoint farm so I see no supportability issue in using the same approach. I do need to add of course that direct access to the SharePoint databases is not recommended but under situations requiring infrequent read only access this is not a problem as long as the NOLOCK parameter is used with the queries.
 
 
HTH - Neil
 
at 11/5/2009 3:39 PM

Add Comment

Items on this list require content approval. Your submission will not appear in public views until approved by someone with proper rights. More information on content approval.

Title (required) *


Body (required) *

Name (required) *


Are you a bot? *


Anti-Spam Filter 1

What's 10+4? *


Anti-Spam Filter 2
Attachments