Search code examples
databasesitecoresitecore-xdb

Sitecore: rebuild reporting database failed


I'm trying to rebuild reporting database, but when I open [site]/sitecore/admin/RebuildReportingDB.aspx page, I get following overall status:

Process State: Failed;
Last stored error: No rebuild request was found.
Started at (Server Time):   0001-01-01 00:00:00 GMT+02:00
Last Process State Change At (Server Time): 0001-01-01 00:00:00 GMT+02:00

I haven't found any useful information in the log files. Any advice will be appreciated.


Solution

  • Just ignore this error. It's normal to see it in case you've never rebuilt your Reporting database in the past.

    Here's the decompiled code of the method GetRebuildStatus() of the class MongoDbRebuildReportingTaskDataProvider:

    public RebuildStatus GetRebuildStatus()
    {
      RebuildStatus rebuildStatus1 = (RebuildStatus) this.driver.HistoryTasks.FindOneByIdAs<MongoDbRebuildReportingTaskDataProvider.StoredRebuildStatus>((BsonValue) 1, new ExceptionBehavior?());
      if (rebuildStatus1 != null)
      {
        return rebuildStatus1;
      }
    
      RebuildStatus rebuildStatus2 = new RebuildStatus();
      rebuildStatus2.Step = RebuildStep.Failed;
      rebuildStatus2.Error = "No rebuild request was found.";
      return rebuildStatus2;
    }
    

    As you can see, if xDB can't find an existing rebuild status in MongoDB, it's going to return this weird error status.

    Just click the "Start" button to start the process.

    And of course, remember to follow this walkthrough before starting the rebuild. I.e. set up a secondary reporting database, add the reporting.secondary connection string, etc.