Thursday 10 May 2018

SharePoint Configuration Cache

Finding SharePoint Config Cache


$connectionString = "Data Source=SharePoint; Initial Catalog=Config;Integrated Security=True; Enlist=False; Connect Timeout=15"
$query = "Select Id, Properties from Objects with (nolock)"
$command = New-Object System.Data.SqlClient.SqlCommand($query)
$connection = New-Object System.Data.SqlClient.SqlConnection($connectionString)
$command.Connection = $connection
try
{
      $connection.Open()
      $reader = $command.ExecuteReader()
      while ($reader.Read())
      {
            Write-Host "Processing object " $reader.GetGuid(0)
            $xml = $reader.GetString(1)
            $xmlDoc = New-Object System.Xml.XmlDocument
            $stringReader = New-Object System.IO.StringReader($xml)
            $xmlReader = New-Object System.Xml.XmlTextReader($stringReader)
            $xmlDoc.Load($xmlReader)
            $xmlReader.Close();
      }
}
finally
{
      if ($connection -ne $null)
      {
            $connection.Close()
      }
     
}


Clearing SharePoint Configuration Cache
1. Stop the SharePoint Timer service on each of the servers within the SharePoint farm.
    - Click Start, go to Administrative Tools, and then click Services.
    - Right-click SharePoint Timer, and then click Stop.
    - Close the Services console.
2. On the server hosting Central Administration, click Start, click Run, type explorer, and then press ENTER.
3. In Windows Explorer, locate and then double-click the following folder: %SystemDrive%\ProgramData\Microsoft\SharePoint\Config\GUID
Note: The %SystemDrive% variable relates to the drive on which Windows is installed. By default, Windows is installed on drive C. The GUID placeholder specifies the GUID folder. There may be more than one of these. See Additional Information for steps to view hidden folders.
4. Back up the Cache.ini file. (Make a copy of it. DO NOT DELETE THIS FILE, Only the XML files in the next step)
5. Delete all the XML configuration files in the GUID folder (DO NOTE DELETE THE FOLDER).
Note: When emptying the configuration cache in the GUID folder, do NOT delete the GUID folder and the Cache.ini file that is located in the GUID folder.
6. Double-click the Cache.ini file.
7. On the Edit menu, click Select All.
8. On the Edit menu, click Delete.
9. Type 1, and then click Save on the File menu. (The only text in the config.ini file should be the number 1.)
10. On the File menu, click Exit.
11. Clear the SharePoint Configuration Cache:
     - Click Start, point to Administrative Tools, and then click Services.
     - Right-click SharePoint Timer, and then click Start.
     - Close the Services console.
12. Make sure that the Cache.ini file in the GUID folder now contains its previous value. For example, make sure that the value of the Cache.ini file is not 1.
13. Check in the GUID folder to make sure that the xml files are repopulating. This may take a bit of time.

No comments:

Post a Comment