Yup! Under steps to reproduce I have the command as “sudo -u apache php occ db:add-missing-indices” and my web server runs as the user apache. Wish it was that easy!
One more basic question and I am sure you checked it already but sometimes it is better to do it twice :
Does your db user as sufficient rights to add/modify indices?
Yup it does! When I installed the calendar app it needed to build some indices and they completed just fine Always worth double checking though!
Just for reference and commands, could someone who doesn’t have this issue running NC18 let me know what their indexes look like please?
For additional information here… here is the current permission list and the schema for the table as well. Does this differ from anyone’s working instance?
For anyone else who is having this issue, I have solved it finally. As it turns out the calendarobject_value_index is no longer a required index, and it doesn’t seem to have been one for a VERY long time. I have been upgrading this instance since OwnCloud 5.x release so I have fully manually cleaned up the database. I purged the failing index, (also some legacy procedures, and a trigger) which completed successfully, so both value_index entries shown in my post above were gone.
I was then able to re-run the add-missing-indexes command and it completed successfully.
Good catch. My install is from OC3 and my db is full of dead entries
But it works well
New installation of
PHP Version: 7.4.2
Database Type: mysql Version: 5.7.28
Missing index “calendarobject_calid_index” in table “dDzvw_calendarobjects_props”.
Missing index “schedulobj_principuri_index” in table “dDzvw_schedulingobjects”.
On shared hosting I have access to phpMyAdmin. Following Query:
dDzvw_calendarobjects_propsDROP INDEX calendarobject_calid_index;
did give an error
#1091 - Can't DROP 'calendarobject_calid_index'; check that column/key exists
Sorry, I have no SQL knowledge so I can’t come up with own queries etc. Help appreciated.
Since the warning/error message says, that the index is missing, a ALTER TABLE…DROP would not work.
If you have SSH access, you can use the occ commands. If you don’t have SSH access, there is an app, occ-web I think it’s called, which you can use from your Nextcloud instance.
This is the link to the occ-web app: https://apps.nextcloud.com/apps/occweb (can be installed from within your admin account on Nextcloud)
This is the link to the occ commands documentation: https://docs.nextcloud.com/server/15/admin_manual/configuration_server/occ_command.html#add-missing-indices
Hi, can anyone give me the SQL queries to manually add the missing indexes?
I am renting a server where I am not able to execute CLI commands.
Thanks in advance.
Try installing the occ-web App as mentioned in my previous post. This allows you to execute CLI commands without having to have access to SSH.
You do not rent a server, or? Otherwise you should have shell access.
Hi @rakekniven .
The host where I’m hosting my NC version is private, and I don’t have shell access on it.
PS: Sorry, surely I’m using some uncommon verbs to express the situation, and that is why you don’t understand me (spanish native here).
PS2: Problem solved using @CFelix solution. Thanks!
How do you do this with docker since OCC-Web does not support Nextcloud 19? I’ve attached to my docker container and run this command, but it doesn’t recognize it as a valid bash command.
If you are using docker, I presume you have Shell access? If that is the case, you could just connect to your docker container and execute the OCC command from within the container.
Connect to docker container:
docker exec -it CONTAINER_NAME /bin/bash
I’ve tried that. It tells me OCC is not a supported command. It doesn’t even know
sudo. I’ve had this problem for a while when accessing a container with
docker exec -it CONTAINER_NAME bash.
When you connect to your docker container, do you change directory to NC root? OCC can only be executed from either inside the NC root folder, or by providing the full path to it.
What error message are you getting, when you execute the
sudo command inside the docker container?
This is the error I get:
bash: sudo: command not found
Thank for this.
Just for letting you know that you can do it using the CLI / SSH, if available:
MariaDB [ncocloud]> ALTER TABLE oc_calendarobjects_props DROP INDEX calendarobject_value_index;
And then run:
php occ db:add-missing-indices
All good now.