If you have enabled “Piwik archiving” and want to to recreate all your reports, you need to perform two steps:
First, remove all database tables that start with:
Second, run the following command, with archive.php pointing to the correct path on your Piwik install:
php /var/www/piwik/misc/cron/archive.php --force-all-websites --force-all-periods=157788000 --url=https://example.com/piwik
The old snippet above still works, but Piwik 2.12 and up now recommends using the following command instead:
php /var/www/piwik/console core:archive --force-all-websites --force-all-periods=157788000 --url=https://example.com/piwik
This will recreate all reports for up to five years back in time. Beware that it can take a long time to finish.