Site Collection is not accessible after CDB restore

In my case the symptom was a blank page or 404 indicating that site is not accessible. i have notice though, that one server in the farm did present/serve the site. that triggered research that lead me to find a solution involving clearing the config cache. i have also open a ticket with Microsoft to make sure this is the right solution.

The config caches is stored in the program data ( hidden folder|) on the c drive.

the path :   C:\ProgramData\Microsoft\SharePoint\Config

follow these steps to ALL SERVERS, this is a copy of the config DB and if you won’t follow this process on all servers in your farm, you will have weird behavior on one server, which will be a nightmare to debug later.

  1. stop the timer service on the server
  2. Go to the path : C:\ProgramData\Microsoft\SharePoint\Config
  3. sort by modified date and pick the latest folder name ( long number), not the Object Collection.
  4. copy it to the same location as backup

 

 

5. Go into the folder and sort it by type

6. change the cache.ini file value inside the file to 1

7. delete all the reset of the file in the folder.

8. restart the timer service.

you can do it manual or using the power shell bellow ( i haven’t tested the power-shell use in your discretion):

Add-PSSnapin -Name Microsoft.SharePoint.PowerShell –erroraction SilentlyContinue
Stop-Service SPTimerV4
$folders = Get-ChildItem C:\ProgramData\Microsoft\SharePoint\Config
foreach ($folder in $folders)
{
$items = Get-ChildItem $folder.FullName -Recurse
foreach ($item in $items)
{
if ($item.Name.ToLower() -eq “cache.ini”)
{
$cachefolder = $folder.FullName
}}
}
$cachefolderitems = Get-ChildItem $cachefolder -Recurse
foreach ($cachefolderitem in $cachefolderitems)
{
if ($cachefolderitem -like “*.xml”)
{
$cachefolderitem.Delete()
}}$a = Get-Content $cachefolder\cache.ini
$a = 1

 

resources :

Clear SharePoint Config Cache with PowerShell
How to Fix a SharePoint 404 Error After Restoring a Content Database