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:

capture21

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.

Advertisement
Clearing Sitecore Analytics data

4 thoughts on “Clearing Sitecore Analytics data

  1. Josh says:

    This is not working as expected for me.
    I’ve still got all the contacts etc…
    Anyone else have issue with this?

    1. Contacts are stored in Mongo, assuming you’re using Sitecore 7.5-8.2. You’ll have to delete the repository there, too. The instructions in this article will only clear aggregate data in the reporting database.

Leave a Reply

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

WordPress.com Logo

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

Facebook photo

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

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.