Site collection does not load after mounting database

MDuBose 716 Reputation points
2021-02-23T20:18:52.84+00:00

Hello,

In SharePoint Server 2016, to test dismounting/mounting a database, I had backed up a content database from the Production database server and restored it to the Dev database server. Then, through Central Administration, I'd dismounted the Dev content database from the Dev web application and mounted the Prod content database. The site collection in the browser loads as expected.

Now, when dismounting the Prod content database from the Dev web application and mounted the Dev content database back then opening the site collection, the site will not load. I get the message below:

HTTP/1.1 200 OK
Server: Microsoft-IIS/8.5
Date: Tue, 23 Feb 2021 20:08:28 GMT
Connection: close

I've checked in the "View Site Collections" page in Central Administration that the site collection is pointing the the Dev content database. In addition, for further troubleshooting, I tried dismounting the Dev content database again but this time through Powershell (Dismount-SPContentDatabase "<ContentdBName>"). The Powershell command throws an error in that it cannot find the content database. The Dev content database is listed when viewing from SSMS.

I did not see anything in the ULS logs that would explain these errors.

What could be causing this issue?

Microsoft 365 and Office | SharePoint Server | For business
{count} votes

Accepted answer
  1. MDuBose 716 Reputation points
    2021-03-01T14:39:45.533+00:00

    These are the steps that I'd followed and the issue finally resolved. All commands were ran on the App server.

    1. Ran below scripts that did not fix the issue
      $db = Get-SPContentDatabase "dbName" ;$db.RefreshSitesInConfigurationDatabase();
    2. Ran Get-SPDeletedSite. Did not fix the issue
    3. Ran Get-SPDeletedSite | Restore-SPDeletedSite. Did not fix the issue
    4. Ran Dismount-SPContentDatabase "dbName". No error this time. It ran successfully.
    5. Checked in Central Administration that the DB was dismounted and it was.
    6. Checked the website in a browser to see if it did not load which was an expected behavior.
    7. Ran below script to test the DB. No errors.
      test-spcontentdatabase -name "dbName" -webapplication "webURL"
    8. Ran the below script. No errors returned.
      Mount-SPContentDatabase "dbName" -DatabaseServer "dbServer" -WebApplication "webURL"
    9. Checked in Central Administration to see if DB was attached and it was. Checked if DB was listed under site collection and it was.
    10. Checked the website in a browser and got the same error as before.
    11. Ran the below script to see if anything came up from the script and it did.
      Get-SPSite "webURL"
    12. Checked the website in a browser and got the same error as before.
    13. Ran below script again and checked site and it finally comes up.
      $db = Get-SPContentDatabase "dbName";$db.RefreshSitesInConfigurationDatabase();

    I still don't understand the cause of the issue. I'd dismounted and mounted a different web application before running the steps above and it worked fine. Maybe mounting the Prod DB before dismounting the Stage DB caused issues initially.

    1 person found this answer helpful.

2 additional answers

Sort by: Most helpful
  1. Echo Du_MSFT 17,316 Reputation points
    2021-02-24T10:48:29.88+00:00

    Hello @MDuBose ,

    This error means your entire site collection is accidentally deleted. You need to restore it.

    In order to restore this site collection, you can use Restore-SPSite -Path PowerShell command (Pay attention, this command works only when you have a backup, because you need to set -Path).

    If you do not have a backup, use this instead:

    Get-SPDeletedSite | Restore-SPDeletedSite  
    

    There are similar cases for reference:

    Thanks,
    Echo Du

    ================

    If an Answer is helpful, please click "Accept Answer" and upvote it.
    Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.


  2. trevorseward 11,711 Reputation points
    2021-02-24T15:56:31.823+00:00

    This means one of three things:

    1) You have a site in another database that has the same Site ID; Site IDs are unique per farm.

    2) You need to refresh the list of sites in the content database; $db = Get-SPContentDatabase dbName;$db.RefreshSitesInConfigurationDatabase();.

    3) The site just doesn't exist in that database (but this sounds unlikely).


Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.