3

I have a farm and I see in sql many content databases. I have some site collection and would like to find something in the userinfo table in the sql database. But in which content database do I need to look for a site collection like?

http://myCompany.com/sites/archive

4 Answers 4

12

Follow these steps:

  1. Open Central Administration.
  2. Application Management.
  3. 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.

-Hope it helps-

0
6

use below PowerShell code:

$url="http://sharepoint.contoso.com/site/subsite/"
(Get-SPSite $url).ContentDatabase.name

Result should appear as:

WSS_Content_2
0
4

Another way via PowerShell

 $site = Get-SPSite "your site url"
 write-host $site.WebApplication.ContentDatabases

Result look like:

SPContentDatabase Name=DEV2_WSS_Content_80
1
  • If the site collection belongs to a web application that has multiple site collections stored in mulitple databases, than this script does not tell you, in wich database your site collection is stored. See the answer from @Trevor for the right way.
    – pholpar
    Commented Oct 22, 2019 at 8:40
0

I know this is an old post, but this will also work well:

Get-SPSite -Limit All | Where-Object{($_.URL -eq 'https://whatever.test.com/sites/sitename')} | Select-Object URL, ContentDatabase

Obviously you would replace the URL with yours. The result should look like this:

Url                                      ContentDatabase                                      
---                                      ---------------                                      
https://whatever.test.com/sites/sitename SPContentDatabase Name=WHATEVER_CONTENT_03

Not the answer you're looking for? Browse other questions tagged or ask your own question.