Missing db.table "nextcloud.oc_file_locks" at installation

Hey tuxedo-rb,

I tried the commands you suggested, but both of them resulted in errors:
ALTER TABLE oc_file_locks DISCARD TABLESPACE; results in:
ERROR 1146 (42S02): Tablespace for table 'nextcloud.oc_file_locks' doesn't exist
DROP TABLE oc_file_locks; results in:
ERROR 1051 (42S02): Unknown table 'nextcloud.oc_file_locks'

Finally I found a solution that work, I’m not sure if it is 100% complete, because I tried lots of thinks, but hopfully it works for others too.

  1. I created the table in another database(in my chase “test”) with the following command:
    use test; CREATE TABLEoc_file_locks(idbigint(20) unsigned NOT NULL AUTO_INCREMENT,lockint(11) NOT NULL DEFAULT '0',keyvarchar(64) COLLATE utf8mb4_bin NOT NULL,ttlint(11) NOT NULL DEFAULT '-1', PRIMARY KEY (id), UNIQUE KEYlock_key_index(key), KEYlock_ttl_index(ttl) ) ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_bin ROW_FORMAT=COMPRESSED;
  2. Then I removed the file oc_file_locks.ibd from the nextcloud database with the following:
    rm /var/db/mysql/nextcloud/oc_file_locks.ibd
  3. Next I moved the files oc_file_locks.ibd and oc_file_locks.frm from the test database to the nextcloud database:
    mv /var/db/mysql/test/oc_file_locks.ibd /var/db/mysql/nextcloud
    mv /var/db/mysql/test/oc_file_locks.frm /var/db/mysql/nextcloud
  4. Then I restarted the System (I think this is not nessesary, but thats what I did)
  5. After restart I removed the oc_file_table from the nextcloud database with the SQL commands:
    use nextcloud; ALTER TABLE oc_file_locks DISCARD TABLESPACE;
    DROP TABLE oc_file_locks;
  6. Then I created the table again with the following:
    use nextcloud; CREATE TABLEoc_file_locks(idbigint(20) unsigned NOT NULL AUTO_INCREMENT,lockint(11) NOT NULL DEFAULT '0',keyvarchar(64) COLLATE utf8mb4_bin NOT NULL,ttlint(11) NOT NULL DEFAULT '-1', PRIMARY KEY (id), UNIQUE KEYlock_key_index(key), KEYlock_ttl_index(ttl) ) ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_bin ROW_FORMAT=COMPRESSED;

After all this I connected with the webpage to nextcloud, entered all parameters again and finished the setup. Unfortunately the setup process never finished, so after about 20min I restarted the server and connected again. This time I got a normal login screen and was able to login.

Note: all the paths I noticed, are from the filesystem of the jail. If you use FreeNAS to execute the commands you need to add the path of your Jail.

Thank you for your help.

1 Like