23

In the Control Panel, there is a "Clean up databases" button. How does it work? What operations are carried out during a database cleanup?

Sitecore Control Panel and Clean up databases button

2 Answers 2

32

In a Sitecore 8, this will:

  1. Cleanup CyclicDependences (items that couldn't be removed by CleanupOrphans because they have a parent but are not in the item tree)
  2. Cleanup InvalidLanguageData (remove all data from items in languages that are not defined as a valid language in the Sitecore system)
  3. Cleanup Fields (delete data from fields -SharedFields, UnversionedFields, VersionedFields- that have no related item anymore)
  4. Cleanup Orphans (delete items that have no parent anymore)
  5. Cleanup Blobs (delete blob fields that have no related field)
  6. Cleanup OrphanFields (clean the field data from the orphans removed in 4)
  7. RebuildDescendants
  8. Clear All Caches

Might be a few things less in older versions, although I don't think it has changed a lot.

2
  • So it is safe because it does not affect in-use item, right?
    – Imad
    Commented Feb 1 at 12:50
  • Should be safe. But always take a backup before doing such operations. And I would not do it on the core database.
    – Gatogordo
    Commented Feb 1 at 12:52
14

Typically, a cleanup operation will remove data in invalid languages and items in orphaned trees. That means:

  • all invalid language data (i.e. data for which the language does not exist) will be removed;

  • all field data for non-existing items will be removed;

  • orphaned items from the database will be removed;

  • all caches will be cleared.

Update : This code is triggered on last versions :

     public override bool CleanupDatabase(CallContext context)
      {
       this.CleanupCyclicDependences();
       this.CleanupInvalidLanguageData();
       this.CleanupFields(context);
       this.CleanupOrphans();
       this.CleanupBlobs(context);
       this.CleanupOrphanFields(context);
       this.RebuildDescendants();
       CacheManager.ClearAllCaches();
       return true;
      }
1
  • So it is safe because it does not affect in-use item, right?
    – Imad
    Commented Feb 1 at 12:50

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.