Database restore and file cache in SharePoint

I never aware there is file cache for SharePoint configuration.
 
But there is.
 
It is located at the %ALLUSERSPROFILE% Application DataMicrosoftSharePointConfig<GUID> folder. It contains infomation with timer jobs and farm data such as content databases for a web application, site collection count.
 
So in a system restore scenario in the same farm (same server names), all the sharepoint databases are restored including the configuration database. Note that there may be new activities between the time the config database is backed up and restored on the server. Those new activities are cached in the physical file on the server and they are out of sync with the config db. So when you access the Central Administration website, you start to experience errors in modifying the farm settings!
 
This is what happened over the past weekend at the client site: null object reference when accessing a content database information inside Central Administration after a config db restore. What makes it even worse, a 404 came back when browsing to the portal site.
 
After serveral hours of digging and helpless attempt to fix the situation, we discovered that the config db data gets modified minutes after the db was restored.
 
Central Administration web application is referring data from the config file cache, which is now showing inconsistent data with the restored configuration database, and OWSTIMER.exe is what controlled the file cache. An really really easy way to clear the cache is:
 
  1. stop the OWSTIMER.exe
  2. navigate to the file cache location
  3. delete or move all the files inside
  4. start the OWSTIMER.exe
  5. file cache will be populated with the correct information from the config db
  6. repeat above steps on all the servers in the farm with OWSTIMER.exe

After re-creating the config cache, Central Administration web application is showing correct values again ……

Knowing the importance of the OWSTIMER cache, I did some google quickly and find some resources about the SharePoint cache:

JOPX on SharePoint 2007 – Clearing the SharePoint Configuration Cache

Office Online – Configure Object Cache Settings

Leave a Reply