Cron table oc_filecache

I am using Owncloud 10.7.0 on Mac os 10.15.7
The oc_filecache mysql table is very often full I have to empty it manually every day

So I would like to create a chrome task that will run this query once a day: DELETE FROM oc_filecache WHERE oc_filecache.fileid = fileid;

Only I don’t know anything about PHP. Can anyone help me create some code that runs this query?

May I ask why you want to achieve this? What do you mean with “very often full”?

I think there is a possibility to deal with the cache.

occ files:check-cache [--remove] [--] <uid> <target-file>

No need to fiddle with PHP for this, let ownCloud manage its file cache.


Again this morning I received a message of my departure I told myself that my database was full. When I looked at this one, it was the oc_filecache table that was full
For example look at the image below. I emptied it barely an hour ago and it is already at 205021

I creat this code but is not work !

$dbhost = "xxxxxx";
$dbuser = "xxxxx";
$dbpassword = "xxxxx";
$dbname = "xxxxx";
$connect = @mysql_connect($dbhost,$dbuser,$dbpassword);

// Empty table
$query = "DELETE FROM `oc_filecache` WHERE `oc_filecache`.`fileid` = `fileid`";
$result = mysql_query($query);

Well, I can’t tell you, what is too much here. Maybe there is something wrong here. I’d suggest finding out, where this increase comes from first.

Good luck!

This sounds absolutely absurd to me. The oc_filecache table contains file metadata for every file/folder/share in ownCloud. Without it ownCloud can’t work. Deleting it, destroys ownership, share and a lot of other vital information. Why are you meddling with this? Are you getting a specific error message?

Yes I get a message every day from my shared hosting (ovh) telling me that my database is almost full!

You will have to upgrade your plan to allow for a larger database, or remove data/users/shares from your owncloud installation in order to resolve this issue.

1 Like

Sorry but I don’t speak English very well. I am translating what you say with google translate and if I understand correctly I have to take a larger database is that it?

What do you mean when you say

remove, data/users/shares from your owncloud installation in order to resolve this issue.

1 Like

This means, that you maybe have too many users having too many files/shares in use. Reduce this or increase the allowed db size.


As other users already wrote: the file cache table is the main table which stores all the files and shares metadata. You must never touch this table unless you really know what you are doing.

From my experience, a big amount of filecache entries comes from the trashbin and version apps. When files are deleted or versioned they occupy an entry in the table. To reduce this “overhead” you may provide harder retention policies, see the documentation at Define the trashbin retention obligation and Define the files versions retention obligation


This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.