Clearing Sitecore Analytics data

So I’ve been moving a Sitecore website to a live server, and one of the problems I had was that the analytics database already had data in it. The MongoDB instance was new, so that was empty – but how do I clear our test/development data out of the Analytics database?

Well it turns out that there is a stored procedure – __DeleteAllReportingData – in the Analytics database for just that:


Run that, and all your data will be gone. Obviously, use with care – but useful.

It seems to work by removing all foreign keys, truncating each table, and adding the keys back, so the user running this will need permission to do all these things.

Also, you can exclude tables, but I just ran it with the input of an empty string ( ” ) to clear all.

Clearing Sitecore Analytics data

2 thoughts on “Clearing Sitecore Analytics data

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s