I have upgraded my Sitecore solution from 7.5 to 8.1 update 1 upgraded site from 7.5 version when When trying to rebuild the reportingReporting database, I gotam getting the following error in the log files:
7084 2016:12:18 05:26:24 ERROR Exception when executing agent aggregation/rebuildAgent
Exception: System.InvalidOperationException
Message: Cannot initialize when there is work to do
Source: Sitecore.Kernel
at Sitecore.Diagnostics.Assert.IsFalse(Boolean condition, String message)
at Sitecore.Analytics.RangeScheduler.MongoDbRangeMap.Initialize(Guid left, Guid right, Int64 count)
at Sitecore.Analytics.Automation.Aggregation.Data.Processing.AutomationHistoryAggregatorManager.Start(List`1 targetProvidersConfigPaths)
at System.Linq.Enumerable.WhereSelectListIterator`2.MoveNext()
at System.Collections.Generic.List`1..ctor(IEnumerable`1 collection)
at System.Linq.Enumerable.ToList[TSource](IEnumerable`1 source)
at Sitecore.Analytics.Aggregation.History.ReportingStorageManager.ProcessRebuild()
at Sitecore.Analytics.Core.BackgroundService.Run()
7084 2016:12:18 05:26:24 ERROR Exception when executing agent aggregation/rebuildAgent
Exception: System.InvalidOperationException
Message: Cannot initialize when there is work to do
Source: Sitecore.Kernel
at Sitecore.Diagnostics.Assert.IsFalse(Boolean condition, String message)
at Sitecore.Analytics.RangeScheduler.MongoDbRangeMap.Initialize(Guid left, Guid right, Int64 count)
at Sitecore.Analytics.Automation.Aggregation.Data.Processing.AutomationHistoryAggregatorManager.Start(List`1 targetProvidersConfigPaths)
at System.Linq.Enumerable.WhereSelectListIterator`2.MoveNext()
at System.Collections.Generic.List`1..ctor(IEnumerable`1 collection)
at System.Linq.Enumerable.ToList[TSource](IEnumerable`1 source)
at Sitecore.Analytics.Aggregation.History.ReportingStorageManager.ProcessRebuild()
at Sitecore.Analytics.Core.BackgroundService.Run()
Any ideas how to solve this?