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 (8)

  1. Recently I had to move all databases including the content database in a MOSS 2007 farm from one SQL

  2. Esto es muy útil especialmente cuando en la misma instancia de SQL-Server compartimos la instalación

  3. Matt Glew says:

    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%'

  4. Msg 208, Level 16, State 1, Line 1

    Invalid object name 'Objects'.

  5. Teeranai Nakjittrakarn says:

    Msg 208, Level 16, State 1, Line 1

    Invalid object name 'Objects'.

  6. InsertNameHere says:

    Msg 208, Level 16, State 1, Line 1

    Invalid object name 'Objects'.

  7. Aaron says:

    Try running it against SharePoint_Config