Yes, more! Timer jobs not running!

OK, so I’ve posted 5 times in the last 2 days on various SharePoint related things. Any regular readers of this blog will know that is entirely out of the ordinary and does not take a genius to determine that I’ve been doing something with SharePoint and, as with most SharePoint projects, I’ve encountered a bunch of issues. The events that have led to these are probably not common but equally something that you will face from time to time. The perfect storm of requirements consist of:

  • Doing major database work to split one gigantic site collection database down to smaller ones
  • Install a service pack
  • Restore a copy of the Production database in to the Test environment

Regrettably, at various stages (not to mention a few cock-ups on my behalf) has led to a torrent of issues that have moreorless wiped out the past 2 days on things that really shouldn’t be an issue.

The latest chapter of this sorry saga was finally trying to test some functionality that is heavily dependent on the timer service. We have a bunch of custom timer jobs, as well as relying on some of the in-built ones (e.g. Content Organiser processing). After finally stitching the environment back together, I was seeing strange things. Timer jobs that were on a schedule were all there and running no problem – but

  1. The ‘running jobs’ screen was always completely empty (even if scheduled jobs were running)
  2. I could edit timer jobs (e.g. change schedule) but it had zero impact
  3. Most frustratingly, jobs would simply not run on demand (i.e. clicking Run Now in the job, did sweet fa.)

I did all the usual guff like resetting the timer job cache. I had been playing with permissions so tried to undo some of that. And, of course, the servers got rebooted… once or twice.

But still no dice. The bastard things just would not run.

After a lot of Googleaging (ironically, Bing appears to be thoroughly useless for searching Microsoft related issues) I stumbled across an innocuous post on the Microsoft Support centre – ‘Administrative Timer jobs not running after upgrade‘. Well that sounded like a good place to look!

Every SharePoint server has one SPTimerServiceInstance object which represents the SPTimerV4 Windows Service. In certain circumstances (typically after an upgrade), you could end up in a situation where your timer service is running on the server but the SPTimerSericeInstance object is not Online. In this case, any administrative operations that depend on timer jobs to be completed (such as starting the User Profile Synchronization Service) will not be successful.

The cause is suggested as being: “An unexpected event during the upgrade prevented the timer service instance object to be brought back online.”

Well, in fairness, as you might have seen, I did have to run the upgrade process a number of times.

Fortunately, the post provides a script:

$farm = Get-SPFarm
$disabledTimers = $farm.TimerService.Instances | where {$_.Status -ne "Online"}
if ($disabledTimers -ne $null)
{
foreach ($timer in $disabledTimers)
{
Write-Host "Timer service instance on server " $timer.Server.Name " is not Online. Current status:" $timer.Status
Write-Host "Attempting to set the status of the service instance to online"
$timer.Status = [Microsoft.SharePoint.Administration.SPObjectStatus]::Online
$timer.Update()
}
}
else
{
Write-Host "All Timer Service Instances in the farm are online! No problems found"
}

Pretty filthy looking Powershell if you ask me, but by this point I was desperate. And would you Adam and Eve it it detected that there was one disabled timer instance. The script claimed to have resolved the issue… but still nothing. But after then restarting the timer service… boom, a whole bunch of stuff sprang back in to life.

Love SharePoint.

Footnote: I mostly put this stuff up here so that if (when) I encounter these issues again in the future, it’s easy to find. But also hopefully it’s helpful to other people out there. I could easily have posted another 10 things about the stuff that’s gone on over the last 2 days… but such is the life of a SharePoint geek.

Be the first to comment

Leave a Reply

Your email address will not be published.


*