Databases diskspace tips

Created: 6 Mar 2017, last update: 30 Jan 2022

Sitecore development databases disk space cleanup tip

Today width fast but small SSD disk and Dropbox, OneDrive and other heave disk space apps like multiple Sitecore installations with local SQL and MongoDB Databases you can easily run into a low disk space situation. Of course you can use a cloud, external Database server but if you have a decent computer locally is much faster.


SQL server
Today not everyone is a SQL server expert but a very simple tip to get more free disk space is cleaning up the transaction logs.
Open in Windows the Microsoft SQL server Management Studio.
Go to your Sitecore databases.
First check you using Simple Recovery Model, In the Object Explorer right mouse click on a Sitecore Database, Properties, Options.
Now you can shrink your database. In the Object Explorer right mouse click on a Sitecore Database, Tasks, Shrink, Database. Do this for all your databases

 

MongoDB, the Sitecore Experience Database (xDB)
Of course you can use a cloud/external services for this to save space. But as Developer it is nice to have it local.
The simplest way is throw all data in MongoDB. Use a tool like Mongo Vue, Mongo Compass or Robomongo and delete your Sitecore collections. Sitecore will create again a collection. And also restore a clean SQL rapportage database the Sitecore analytics DB or use the __DeleteAllReportingData Stored Procedure. The Sitecore Experience Database (xDB) uses two database systems (SQL Server and MongoDB) that need to be kept in sync to provide accurate data for Sitecore reporting applications. If you choose to not delete all data you can rebuild the SQL Rapportage DB

See Sitecore experience platform setting up and maintaining xdb server considerations walkthrough rebuilding the reporting database

Another option to remove data from the xDB is using the Analytics Database Manager (ADM) tool from the marketplace. This free tool is now also available for Sitecore 8+
See: Analytics Database Manager