Restore database from backup leaving current data folder in tact - how best to manage


I’m hoping for some general information in relation to what I might expect if I restore the database (current v10.x.x production) from a 2 month old backup, whilst maintaining the existing data directory. The latter is mounted from an external NFS share.

I had an issue with a VM that forced me to go back to this time. My clients do not necessarily maintain all their files on every device, so assume some are only in the data file cache (still in tact).

Is their a method to ensure all the backend data files are synchronized with the earlier database restore.

I see a lot of posts on people losing the data cache and then relying on client re sync, but not much for when the database goes back in time and there are files in the cache that are current and no where else.

I also have external storage for cloud services and a local photo repository on a NAS. I assume these are unaffected, as it appears a one way operation whereby OC will simply make available whatever is in the external storage and not manage the files in any other way, i.e remove them if the db says they don’t exist…

I see the digital fingerprint is a recommended step after a restore of either data or database (as published in the help). Does this assist in recovering already cached files back into the database. I have used scan before to resolve issues. Are there any other maintenance commands that would be recommended in this scenario.

Any info would be appreciated. I;m leaving the VM off until I get a better understanding. I’ve backed up the data folder and everything else is in the VM (also backed up).

My issue was to not have a daily backup of the database, so that has now been corrected.

Thanks again.
just the SQL part?

1 Like

Well files that are in the file backend (NFS) but haven’t been added to ownCloud, and therefore have no entry in the oc_filecache table, basically all files newer than your backup, ownCloud won’t know about.

When you restore that backup and the client connects, I’m not sure what the client will exactly do with them. There are as far as I know two possibilities.

  1. It will upload them to the ownCloud instance, as it just detects new files in the folder.
  2. Or depending on if the server is the primary holder of truth, it might delete these folders when it starts syncing the state from the server.

So perhaps you can set up a little test environment and figure out what the behavior is. Then you’re 100% sure, what is going to happen. Perhaps a clone of your restore, where you set the new IP address of the clone in your host file as the server. That way you have the right environment to reproduce the behavior.

Finally to get the new filles since the backup into your ownCloud you should run the following occ command:

occ files:scan --all --repair

However depending on the amount of files this might take quite a bit of time (during which your ownCloud will be offline [in maintenance mode])

1 Like