Fetch Database Name from Database ID in SharePoint Farm
Word of warning, the following script directly queries a SharePoint database; this is never a good idea. Therefore I recommend you restore the database to a restore or test server where you can execute the query as to prevent any potential issues with your production environment.
Luckily there is a way to get this information from SQL Server, to do this you must run a query against the Configuration database (See warning above).
First you need to open Management Studio
- Select New Query.
- Select the Configuration Database from the Available Databases dropdown list.
- Copy the script below and paste it into the Query window and press Execute.
Select ID, Name from objects
where properties like
'%Microsoft.SharePoint.Administration.SPContentDatabase%m_nWarningSiteCount%'
This will output the Database GUID and Database Name in a nice list, giving you the data you need to identify what database SharePoint is talking about when it is talking GUID’s to you.
As stated There is some risk involved in running queries against SharePoint databases, Microsoft advises not to run any query against a SharePoint database as it might interfere with any SharePoint processes running against the databases. When this happens the database will lose support status and if you need to contact Microsoft for support with issues in the future you might be asked to replace the database with a fresh copy. I usually restore a recent backup of the configuration database to a restore server or a test server and run the query there. This allows me to get the data but still comply with the “No query for you!” rule that SharePoint databases have.
|