Thursday, January 3, 2013

SharePoint cache?

I've been working with SharePoint for about 5 /12 years now and never had any issues with SharePoint cache.

Two weeks ago, I restored a web app/site collection on Production using database backup.  I could navigate to the site collection and contents just fine from one Web Front End, but the other WFE was throwing errors.  I found that i had to reset the sharepoint cache on that server.  Once I did that, all was golden.

Yesterday, I found this error going off every hour:
Error shows up hourly: failure trying to synch site 28961a6e-da6c-dddd-96a1-9a3d0d979d6e for ContentDB ad130497-9927-4976-hiya-0f51777acf6c WebApp 6593083c-6926-4ecb-boot-13ba9e96c2d7.  Exception message was Cannot insert duplicate key row in object 'dbo.UserMemberships' with unique index 'CX_UserMemberships_RecordId_MemberGroupId_SID'. The duplicate key value is (0c37852b-34d0-418e-rock-2ac25af4be5b, 3617, 67, 0x010500000000000515000000b375ce907e0574cfe5fbbe0d5b780000).
The statement has been terminated..

Doing some investigation (Googling), I found this helpful post from Guna K:
http://gunakuppusamy.wordpress.com/2012/07/06/sharepoint-2010-failure-trying-to-synch-site-issue/

Ran the Powershell script on DEV first, and after I found no issues, I ran it on the one troubled server and the errors stopped occuring.

If you don't learn something new every day, you are not having fun.

Powershell from Guna's page:

if ( (Get-PSSnapin -Name Microsoft.SharePoint.Powershell -ErrorAction SilentlyContinue) -eq $null )
{
    Add-PsSnapin Microsoft.SharePoint.Powershell
}
# Variables Declerations
$GUID = [Guid](Get-ItemProperty 'HKLM:\SOFTWARE\Microsoft\Shared Tools\Web Server Extensions\14.0\Secure\ConfigDB' -Name Id).Id
$ConfigDir = "c$\ProgramData\Microsoft\SharePoint\Config\$GUID"
# Function which is used to STOP the Timer Service
Function StopTimer()
{
    Write-Host "The SPTimerV4 service will be stopped on " $Server.Name
    $Service = Get-WmiObject -computer $Server.Name Win32_Service -Filter "Name='SPTimerV4'"
    $Service.InvokeMethod('StopService',$Null)
    start-sleep -s 5
    Write-Host "The SPTimerV4 service has been stopped on " $Server.Name
}
# Function which is used to CLEAR the cache and resetting the value to 1
Function ClearCache()
{
  Write-Host "Cached config items will be cleared on " $Server.Name
  $ServerName = $Server.Name
  $ConfigDirPath = "
\\$ServerName\$ConfigDir"
  $CacheIni = Get-Item "$ConfigDirPath\Cache.ini"
  Get-ChildItem "$ConfigDirPath\*" -Filter *.xml | Remove-Item
  Set-Content -Path $CacheIni -Value "1"
  Write-Host "Cached config items have been cleared on " $Server.Name
}
# Function which is used to START the Timer Service
Function StartTimer()
{
    Write-Host "The SPTimerV4 service will be started on " $Server.Name
    $Service = Get-WmiObject -computer $Server.Name Win32_Service -Filter "Name='SPTimerV4'"
    $Service.InvokeMethod('StartService',$Null)
    start-sleep -s 5
    Write-Host "The SPTimerV4 service has been started on " $Server.Name
}
# Get SPFarm object
$Farm = Get-SPFarm
# Loop through all the servers in the Farm and carry out all the functions (START and STOP the Timer and clear the Cache
foreach ($Server in $Farm.Servers)
  {
    # This will make sure that other types of servers (DB, SMTP etc.,) will not be affected
    if ($Server.Role -eq "Application")
       {
          try
            { 
               StopTimer
               ClearCache
            }
          catch
            {
                Write-Host "Error Occured " ; $error[0]
            }
          finally
            {
                StartTimer
            }  
       }
  }

Monday, July 30, 2012


I thought for my first blog, I would grab something I posted in a forum a few years back troubleshooting alerts.  I had to go back and read these over a few weeks ago to troubleshoot alerts not working on our one farm.


  • Things to check when Alerts are not working:
  • Verified Alerts are enabled (set alerts-enabled to false, then back to true.)
  • tried stsadm -o updatealerttemplates -url "http://client" -filename "c:\Program Files\Common Files\Microsoft Shared\Web Server Extensions\12\template\xml\alerttemplates.xml"
  • tried STSADM -o setproperty -pn job-immediate-alerts -url url -pv "every 3 minutes"
  • tried sts add-on stsadm -o restarttimer
  • tried using sts add-on stsadm -updatealerts as client has web server https:// and app server http://, so  to do a search and replace of https with http and vice versa (alert propertybag setting).
  • added the account used to run the SharePoint Timer Service as SharePoint Administration Group account (farm admin).
  • Made sure the account used for OWSTimer.exe had read/write access to the Content Databases and SQL.
  • verified account that the SharePoint Timer Service is running under does have access to the content database
  • Re-entered username and password of Timer service account, stopped, started
  • rebooted the servers (web, app, and db)
  • Looked in WSS_Content and other content db's and looked in ImmedSubscriptions, schedsubscriptions for anything out of the ordinary.
  • Looked in log files and this message appears.
  • break permissions of site, then list/doc lib, then re-inherit.
  • Ran vb script to test message to verify the configuration of the SMTP service (http://technet.microsoft.com/en-us/magazine/cc718983.aspx)
  • Make sure your server is allowed to send out email (at my one client, the network guys didn't allow the one SharePoint server to send email
  • Make sure your outgoing email server is allowing email from your SharePoint severs (issue I had recently).