I was recently brought into a client to help troubleshoot an issue with a SharePoint Timer Job, that appeared to be executing multiple times (around the same time) although it was scheduled to run only once daily. While others in the SharePoint community appeared to experience the same problem, no one seemed to be able to point to a cause.. much less a solution. In this case it was always running 9 times, significantly more than the three or four others where reporting.

After much digging around, and focusing on the magic number (why 9) it struck me. How many Content Databases did the client have on the web application that the Timer Job was associated with? 9 to be exact. It was doing what it needed to do based on how it had been developed, the developers failed to test it on a Web Application with more than one Content Database. From there on, fixing the code was simple.. but it may be different for you based on what your timer job needs to do. Remember every Site Collection (SPSite) has a property that gives you the Content Database, and every time a Timer Job is called (targeting a Content Database) the Content Database GUID for which it is running is passed in… use it for validation.

Anyhow, at the very least, if you are running into this problem this might help point you in the right direction.

For information on how to develop SharePoint Timer Jobs (SPJobDefinition) see Andrew Connells MSDN Article “Creating Custom Timer Jobs in Windows SharePoint Services 3.0”

digg_url = “https://blog.rafelo.com/2009/04/sharepoint-timer-jobs-running-multiple.html”;digg_title = “SharePoint Timer Jobs Running Multiple Times”;digg_bgcolor = “#FFFFFF”;digg_skin = “compact”;digg_url = undefined;digg_title = undefined;digg_bgcolor = undefined;digg_skin = undefined;
Advertisements