Share via


List All Databases In A MOSS 2007 Farm

Run the following script in the content database:

 SELECT o.[Name] AS 'DatabaseName',
    Instance.[Name] AS 'DatabaseInstance',
    [Server].[Name] AS 'DatabaseServer'
FROM Objects AS o
    INNER JOIN classes c on c.id = o.classid     
    LEFT JOIN Objects AS Instance ON o.ParentId = Instance.Id
    LEFT JOIN [Objects] AS [Server] ON Instance.ParentId = [Server].Id
    WHERE c.Fullname LIKE '%Administration.SPConfigurationDatabase%'
    OR c.Fullname LIKE '%Administration.SPContentDatabase%'
    OR c.Fullname LIKE '%Administration.SharedDatabase%'
    OR c.Fullname LIKE '%Administration.SearchSharedDatabase%'
 

Comments

  • Anonymous
    March 09, 2008
    PingBack from http://msdnrss.thecoderblogs.com/2008/03/09/list-all-databases-in-a-moss-2007-farm/

  • Anonymous
    March 09, 2008
    Recently I had to move all databases including the content database in a MOSS 2007 farm from one SQL

  • Anonymous
    July 01, 2008
    Esto es muy útil especialmente cuando en la misma instancia de SQL-Server compartimos la instalación

  • Anonymous
    February 26, 2009
    Can I ask why you don't include the following statement in youe WHERE clause? I came across your post & liked it, but wondered why the search database wasn't being returned by your query (I'm an SP noob btw, so I wouldn't be surprised if you had good reason to leave it out?!). OR c.Fullname LIKE '%Administration.SPSearchDatabase%'

  • Anonymous
    October 11, 2011
    The comment has been removed

  • Anonymous
    December 04, 2013
    The comment has been removed

  • Anonymous
    December 15, 2013
    The comment has been removed

  • Anonymous
    January 27, 2014
    Try running it against SharePoint_Config