How to Find the Web Application-Database ID (Content DB GUID) on MOSS 2007 or SharePoint 2010

To list all web application-ids. Try to execute the following query in SQL when you are connected to the sharepoint_config database:


Select ID, Name from objects

where properties like ‘%Microsoft.SharePoint.Administration.SPContentDatabase%m_nWarningSiteCount%’

This is useful for example, if you start to see the following type entries in MOSS log files:

“”ProfSynch: Exception attempting to enumerate site ddbcdc0c-4ddd-4101-8945-030e01c7c12f for ContentDB d648aa85-04d8-488e-9ce8-5633e2779209”