Friday, February 26, 2016

PowerShell to know the SQL Server DB Name for a site collection

SQL Server DB Name for a specific SharePoint site collection

If you are having the central admin access of SharePoint, then follow the below steps to know the Database name of a particular site collection


Follow these steps:
  1. Open Central Administration.
  2. Go to "Application Management".
  3. Click on "View all site collections".
  4. Select the site collection you need to get the database name.
  5. In the panel on the right you should see "Database Name", that's the name of the content database.


If you are not having central admin access, you can use the PowerShell to know the same.  Open SharePoint 2010 Management Shell.

PS C:\Users\<username> $url="http://<host-name>/sites/<site collection name>"
PS C:\Users\<username> $site = Get-SPSite $url
PS C:\Users\<username> $site.ContentDatabase.name
WSS_Content

So in this case "WSS_Content" is the Content Database Name which is  being used by this site collection.