MariaDB mysqldump fails because table does not exist

Support intro

Sorry to hear you’re facing problems :slightly_frowning_face:

help.nextcloud.com is for home/non-enterprise users. If you’re running a business, paid support can be accessed via portal.nextcloud.com where we can ensure your business keeps running smoothly.

In order to help you as quickly as possible, before clicking Create Topic please provide as much of the below as you can. Feel free to use a pastebin service for logs, otherwise either indent short log examples with four spaces:

example

Nextcloud version: 17.01
Operating system and version: Ubuntu 18.04.3
Apache or nginx version: Apache /2.4.29
PHP version : 7.2.24
MariaDB version: 10.4.10

The issue you are facing:

I am in the process of a regular backup, the first after upgrading from NC15 to NC16 and then to NC17. The NC-data backup worked smoothly, but the sqldump does not work:

mysqldump --single-transaction -h localhost -u USERNAME -p nextcloud_db > /mnt/extdisk/Nextcloud/NextcloudBackup_DB_`date +"%Y%m%d"`.sql
Enter password: 
Error: Couldn't read status information for table oc_login_flow_v2 ()
mysqldump: Couldn't execute 'show create table `oc_login_flow_v2`': Table    'nextcloud.oc_login_flow_v2' doesn't exist (1146)

The problem is that the table oc_login_flow_v2 is listed in the database. I tried deleting it with

MariaDB [nextcloud]> Select * from oc_login_flow_v2;
ERROR 1146 (42S02): Table 'nextcloud.oc_login_flow_v2' doesn't exist

MariaDB [nextcloud]> drop table oc_login_flow_v2;
ERROR 1051 (42S02): Unknown table 'nextcloud.oc_login_flow_v2'
MariaDB [nextcloud]> drop view oc_login_flow_v2;
ERROR 4092 (42S02): Unknown VIEW: 'nextcloud.oc_login_flow_v2'

So apparently it does not exist but it still shows up in the tables overview:

MariaDB [nextcloud]> show tables;

±----------------------------+
| Tables_in_nextcloud |
±----------------------------+
| oc_accounts |
| oc_activity |
| oc_activity_mq |
| oc_addressbookchanges |
| oc_addressbooks |
| oc_appconfig |
| oc_authtoken |
| oc_bruteforce_attempts |
| oc_calendar_invitations |
| oc_calendar_reminders |
| oc_calendar_resources |
| oc_calendar_resources_md |
| oc_calendar_rooms |
| oc_calendar_rooms_md |
| oc_calendarchanges |
| oc_calendarobjects |
| oc_calendarobjects_props |
| oc_calendars |
| oc_calendarsubscriptions |
| oc_cards |
| oc_cards_properties |
| oc_collres_accesscache |
| oc_collres_collections |
| oc_collres_resources |
| oc_comments |
| oc_comments_read_markers |
| oc_credentials |
| oc_dav_cal_proxy |
| oc_dav_shares |
| oc_directlink |
| oc_federated_reshares |
| oc_file_locks |
| oc_filecache |
| oc_filecache_extended |
| oc_files_trash |
| oc_flow_checks |
| oc_flow_operations |
| oc_group_admin |
| oc_group_user |
| oc_groups |
| oc_jobs |
| oc_login_flow_v2 |
| oc_migrations |
| oc_mimetypes |
| oc_mounts |
| oc_notifications |
| oc_notifications_pushtokens |
| oc_oauth2_access_tokens |
| oc_oauth2_clients |
| oc_preferences |
| oc_privacy_admins |
| oc_properties |
| oc_schedulingobjects |
| oc_share |
| oc_share_external |
| oc_storages |
| oc_systemtag |
| oc_systemtag_group |
| oc_systemtag_object_mapping |
| oc_text_documents |
| oc_text_sessions |
| oc_text_steps |
| oc_trusted_servers |
| oc_twofactor_backupcodes |
| oc_twofactor_providers |
| oc_users |
| oc_vcategory |
| oc_vcategory_to_object |
| oc_whats_new |
±----------------------------+
69 rows in set (0.001 sec)

Also, I am not able to create it again:

CREATE TABLE oc_login_flow_v2 (id BIGINT UNSIGNED AUTO_INCREMENT NOT NULL, timestamp BIGINT UNSIGNED NOT NULL, started SMALLINT UNSIGNED DEFAULT 0 NOT NULL, poll_token VARCHAR(255) NOT NULL, login_token VARCHAR(255) NOT NULL, public_key TEXT NOT NULL, private_key TEXT NOT NULL, client_name VARCHAR(255) NOT NULL, login_name VARCHAR(255) DEFAULT NULL, server VARCHAR(255) DEFAULT NULL, app_password VARCHAR(1024) DEFAULT NULL, UNIQUE INDEX poll_token (poll_token), UNIQUE INDEX login_token (login_token), INDEX timestamp (timestamp), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_bin ENGINE = InnoDB ROW_FORMAT = compressed;
ERROR 1005 (HY000): Can't create table `nextcloud`.`oc_login_flow_v2` (errno: 74 "Bad message")

I had some issues while upgrading from NC15 to NC16 and if I remember correctly it had to do with exactly this table. I might have deleted it back then, but am not sure anymore. Can anyone help me to fix this issue? I really want to be able to do updates again.

The nextcloud server works, I can updload/download everything and there do not seem to be any further issues.

Is this the first time you’ve seen this error? : Yes

Steps to replicate it:

  1. sudo -u www-data php occ maintenance:mode --on 
    
  2. mysqldump --single-transaction -h localhost -u nextcloud_db_user -p nextcloud_db > /mnt/extdisk/Nextcloud/NextcloudBackup_DB_`date +"%Y%m%d"`.sql

Same Problem here. In my case it’s the Table “oc_fulltextsearch_indexes”.
Did you find any solution to this problem?
Thank you!