There are times when we ignore the clean up process of any database server which are used by various SharePoint farm. So when we remove a farm with out bothering about the Database used then its becomes very difficult to identify the Databases used. At the same time we do not have the SP farm with us to check using Central Admin for PowerShell command. So if you came across this kind of scenario don't worry we have the solutions here.Using following query we can find out the Database names...Step 1: Run the below query in Configuration Database
SELECT Id
,BaseClassId
,FullName
FROM Classes
WHERE FullName LIKE 'Microsoft.SharePoint.Administration.SPDatabase,%'
========================================================
This will give a GUID.
Now using that ID execute the below query.
===================== Query 2===============================
DECLARE @returnValue int,
@RequestGuid uniqueidentifier
EXEC @returnValue = [dbo].[proc_getObjectsByBaseClass]
@BaseClassId = 'USE THE ID GOT IN ABOVE QUERY',
@ParentId = NULL,
@RequestGuid = @RequestGuid OUTPUT
SELECT @RequestGuid as N'@RequestGuid'
SELECT 'Return Value' = @returnValue
This will list out the ID (GUID) assigned for each Database.
===================== Query 3===============================
Using one by one you can get the all the database names in the column named 'Name'
DECLARE @returnValue int,
@RequestGuid uniqueidentifier
EXEC @returnValue = [dbo].[proc_getObject]
@Id = 'ID of Last Result',
@RequestGuid = @RequestGuid OUTPUT
SELECT @RequestGuid as N'@RequestGuid'
SELECT 'Return Value' = @returnValue
No comments:
Post a Comment