As time progresses, the data being stored on any database application will continue to grow and grow. This will inevitably lead to reduced performance, and most likely some garbage data will be taking up space. Ultimately, the DB may even become unwieldy and unmanageable. Now, this probably won’t happen overnight, and may not even happen until a number of years have passed – but again, in an active DB, it’s eventually going happen. Sitecore of course stores all of its data in a database, which means your website running on top of Sitecore is susceptible to this issue. The best way to combat this problem is by doing some routine maintenance to keep your database clean.
Choosing a Global Software Development Partner to Accelerate Your Digital Strategy
To be successful and outpace the competition, you need a software development partner that excels in exactly the type of digital projects you are now faced with accelerating, and in the most cost effective and optimized way possible.
If you’re using Sitecore Fast Query on your site, and you begin to get wonky results from the queries you’re running, it’s a good indicator that you are probably at the point where you need to perform some of that database cleanup to combat the above problem. Don’t fret however, as there are a few easy things you can do to combat any unwanted growth and keep your website running as smoothly as the day it launched. I’ll cover the steps you can take in this post. Even if you’re not having any issues, as the saying goes, it’s better to be safe than sorry, so I would recommend setting up a schedule where you regularly go through the following steps to ensure the best performance you can for your Sitecore implementation. (The schedule will vary based on your individual site / implementation – I would think it could be anywhere from quarterly to bi-yearly to yearly. On the most used / content heavy sites, a monthly schedule might even be necessary)
- The first thing you want to do to keep your Sitecore database clean is to log into the Sitecore Desktop as an admin user so that you can see the Sitecore Control Panel.
- Click the Sitecore button on the desktop, and then open up the Sitecore Recycle Bin
- From here, you have two choices.
- If you’re sure that everything in the Sitecore Recycle Bin can be permanently deleted, simply click the “Empty” button in the Ribbon, and then click “OK” on the pop-up.
- If you’re not positive that the entire contents can be deleted for good, select the items you know are OK to delete (you can use Shift + Left Click and CTRL + Left Click on this screen) and then hit the “Delete” button on the ribbon.
- After you’ve completed one of the two choices from Step 3, you can close the Sitecore Recycle Bin
- Next, click on the Sitecore button on the desktop once again, and this time open the Sitecore Control Panel
- In the Control Panel, click on the “Database” option
- Click the “Clean Up Databases” link, and choose which of the Sitecore databases to clean. (There is no harm in choosing all of them). This process can take a few minutes, so be patient.
- After that completes, click the Finish button and you are done with the Sitecore Desktop. Switch over to SQL Server Management Studio, or whatever DB tool you’re Sitecore databases are on.
- Our next step is to shrink our databases. To do this in SQL Server 2008, you right click on your target DB, mouse over “Tasks”, then “Shrink”, and select “Database”. You’ll get a pop-up with an option or two and an OK button to start the process.
- After you’ve shrunk your DB’s, you can use the following SQL commands (in SQL Server 2008 at least) to shrink your DB Logs.
USE [MyTargetDatabase] GO ALTER DATABASE [MyTargetDatabase] SET RECOVERY SIMPLE GO DBCC SHRINKFILE(2) GO ALTER DATABASE [MyTargetDatabase] SET RECOVERY FULL GO
There you have it, 10 easy steps to help keep your Sitecore DB’s clean, trim and performing at their highest abilities!