Restoring from ownbackup


One day, after power failure 2 tables became corrupted.
Since that time nextcloud cannot start properly (logging page is not available).
How can I use files:
to restore manually tables directly to mysql (i.e. with mysqldump restore) ?


Looking at the code ( it should provide a restore procedure.

If you want to do it manually via command line, just check the data.dump, if there are any commands to create tables, usually stuff like this (from an output of mysqldump):

DROP TABLE IF EXISTS `oc_filecache`;
CREATE TABLE `oc_filecache` (

then you can probably directly use it, if not, you need to use structure.xml first to create the table structure. I have no code snipped at hand, but your favourite search engine can help you with that.


That is, I need to DROP table at beginning because it exists but ones tried to access it server returns “table not exists in engine” or so while “SHOW TABLES” present it.
I already dig through the code and realised function “updateDbFromStructure” that refers to Core and than to Symphony. At that point I stopped searching.
data.dump file is not xml formatted as “mysqldump --xml” creates neither sql type. Thus I asked for solution.


I already asked for that on github:

So far it is not possible to restore tables from outside of Nextcloud web ui. Therefore mysql dumps (or whatever database you use) is still necessary for such cases.

Indeed this makes ownBackup somehow useless, because restoring single table is possible from mysql dump as well. It just makes it comfortable via web ui and also to restore on just lost/accidently removed entries from calendar or what.

Then it would be nice to have some sort of command-line script to restore the backup. Luckily mysqldump is very easy to run and to build your own small backup script should be no problem.

Don’t only do backup, also test the restore procedure!!

@MichaIng - you’re right.
Finally I did clean installation and tried restore table via ownBackup unfortunately without success because of ‘not existing column’. Moreover, I tried several tables with the same result.
In my case ownBackup is rather useless at all.

Yes, restore is the goal for making backup, indeed.
So, since that mysqldump is going to be my friend :slight_smile: