How to empty the oc_activity table?

is it possible to truncate the oc_activity table in the mysql database without any adverse effects?
I've tried to do that with the 'activity_expire_days' entry in the config.php and set it to one day. But since three days (since upgrade to 9.0.4) the activities are not cleaned as defined. There is a webcron that runs fine every 15 minutes. That shouldn't be the problem.

Is there any other way to get rid of all old activities? Is it that easy to do that by empty the oc_activity table or is there anything else to consider?

Thank you in advance for your support!

Can you check the oc_jobs-table, there should be an entry:


The last field shows the last run of this job (

If the job exists and was run lately, then please check your logfiles for errors.

Probably, there are no references to the activity-app and the cleaning does the same thing such as (make a backup to be sure):

DELETE FROM oc_activity WHERE timestamp < 1470009600;

will delete everything older than Aug 1, 2016.

Thanks for your answer!
Yes, in the oc_jobs-table is the entry:
OCA\Activity\BackgroundJob\ExpireActivities null 1470073552
Therefore the last run was on Mon, 01 Aug 2016 17:45:52 (UTC).
The Cronjob runs fine and there are no errors in the logfiles. Maybe there will be some with another loglevel.

I hope that there are no other references to the activity table. I will try that during the day (of course with a backup).

Cleaning the oc_activity-table by simply deleting the old entries seems to work well.
Maybe I am going to figure out why the 'activity_expire_days' entry in the config.php is ignored by the background job.
If I find the issue, I will post it here. And if it is a bug, I will post it on GitHub too.

1 Like

Is it possible to run activity_expire_days from config manually?