Primary key missing from DB table oc_collres_accesscache

Hi all,

I hope your all well :slight_smile:

I have a question in regards to a table in nextclouds database, (ours is running on a galera cluster)

Since we upgraded from I believe it was one of the 16 versions, to the latest 17 version the table oc_collres_accesscache is now missing its primary key from its table.

Is this something that has gone wrong during the upgrade, or is this nextcloiud entirely?

I would like to implement backups to our DB but allegedly our cluster needs to have a primary on every table in order to do that.


have you already tried

sudo -u <nc-owner-account> php occ db:add-missing-indices

in your installation directory?

Cheers for a very swift reply, looking through the command history, I don’t believe it was done.

Is this safe to do during a working day? I don’t want to take nextcloud down as I may get shouted at by all our staff hahaha. :slight_smile:

it heavily depends upon the size of your installation… like how many users, how many data, how fast is your hardware…

so maybe it was good idea to do it in the evening? :wink:

1 Like

I’ll give it a try later on as it is quite a busy site and last thing I want is colleagues piling in to my office complaining that I broke nextcloud :stuck_out_tongue: Thank you once again for a swift reply, I will give it a shot later in the evening and update you tomorrow.

1 Like
1 Like

quick! look what @kesselb found on github! the solution seems to be a bit different from what i suggested!

1 Like

I’ll need to take a better look at Daniels reply github has always confused me lol.

Tried your command though Jimmy and didn’t work :frowning: Will read up on Daniels reply tomorrow and get a better understanding of it :slight_smile:

1 Like

Just trying to read and understand all this correctly which is difficult as I am not actually a DBA.

I am not sure if it will be same as we use Galera without Percona, as well as MariaDB where as a lot of this is mentioning MySQL, while I understand they are nearly similar in how the 2 DBs, would this still solve my problem? :slight_smile:

The github link wasn’t of any use to me lol, there doesn’t really say how to fix it.

After scouring the internet, i found this article on serveralnines;

In this article it states the alter table command auto increment statement would suffice, but this looks like its for a fresh build, but it should work for a small 7-8GB db without any problem?

i am afraid i’m outta here… i can’t help you in terms of clustering. and i feel deeply sorry about that.

1 Like

Ahaha please don’t worry about it bud :slight_smile: I think it will be OK, due to it only being a DB thing and it replicates straight on to the 2nd DB, but it would be great to see if someone has any other suggestions as I have inherited this from a dev who has now left and didn’t really care about fixing the issues.

Its more I am new to Nextcloud so trying to figure it out :slight_smile: and don’t want to screw the app up as I dont know how it interacts with this certain DB. table.

1 Like

if it’s really only about this one table (which might get replicated automatically) then the way is clear… see above…

plus: i dunno where you are from… but maybe your country will go on corona-lockdown as well so you would have enough time to fix any problem, i bet giggle

1 Like

The sunny UK :wink: Most of us are still in the bulldog spirit and not letting a flu shut us down :stuck_out_tongue:

If your referring to github one, its really gone over my head all the stuff there lol github is not something I have used before.

Its such a pain learning new technologies sometimes, I am going to pull out a database dump tonight and then check out the alter tables command as posted by severalnines and see how it responds.

If it fails, then I’ll just restore the dump lol.

1 Like

i was referring to this one… —> Primary key missing from DB table oc_collres_accesscache

Yeah, I did try that and unfortunately it didn’t work.

I believe its something to do with the migration file Version16000Date20190427105638.php which deletes the collres_accesscache from the DB by looks of it:

public function preSchemaChange(IOutput $output, Closure $schemaClosure, array $options) {

Now, I could be entirely wrong, as mentioned I am not very proficient with Nextcloud at all, and still learning, I’ll figure this out, I need find out if this table is even being used anymore, would be great if a dev from nextcloud could give us a tip. Haha :slight_smile:

Cheers for your assistance though Jimmy, it is very appreciated to help this new comer :slight_smile:

1 Like