22 to 23 and again table issues, missing index that need linux actions

With the update from 22 to 23 there seems again a database issue.
The OCC addon does not work any more. And why should I go to a Linux login to correct this?

Missing index “fs_id_storage_size” in table “oc_filecache”.
Missing index “fs_storage_path_prefix” in table “oc_filecache”

Please do these actions in the update process …

If you read the message completely, it won’t be done within the update process because for large installations this could run into timeouts and leave you with broken installations.

1 Like

Yes, I’ve read that.
But one could add this as an option in the process. Or update the good old OCC addon. That worked fine for most maintanance on all NC instals we have. (most < 40GB).

This won’t happen… See adphi/occweb

What is the fix for the reported problem? I have it too.

You have go in Linux with SSH and adequate rights. (I my case ROOT does not work. It should be the owner of the account.

Then you go to the Nextcloud folder and then:

php occ db:add-missing-indices

That should be enough. It can be done on a running NC installation. But if you want, you can use these:
php occ maintenance:mode --on
php occ maintenance:mode --off


It took 3 seconds to exectute…

1 Like

As you say, root doesn’t work. Says that the owner of the file is “33” which I believe is “www-data”.
I got that info by typing ‘getent passwd “33”’ - is that right?

If so, how do I log in as www-data. Though I presume that this:
runuser -l www-data -c ‘php occ db:add-missing-indices’

Should be enough?

Cheers for any pointers.

If you have sudo installed the following should work also (@Hendrik / @Walsh):
sudo -u www-data php /path/to/nextcloud/occ db:add-missing-indices


Awesome - that worked. Thanks!