Reinstall possible without db dump?

I ran into some annoying problems (e.g. could not delete files from trash) after having used our instance for around five years.
Even after a standard reinstall (move data and db dump to a new server) the problems persisted.
It’s not the data itself (backup checksums correct, no fs errors, new disks) so the problem must arise from the db.

The next db dump/import will very likely not yield other results so I’m looking for a route to only transfer users (with their credentials, calendars/todo lists and contacts) to a naked instance and scan the files afterwards.

How would I do this?

  1. Create users with matching names & passwords on the new instance
  2. Export every user’s calendar(s)/todolist(s) to an .ics file and reimport that file(s) logged into the new instance as the corresponding user
  3. Export every user’s address book(s) to an .vcf file and reimport that file(s) logged into the new instance as the corresponding user

And now?
I suppose the calendar shares will have to be recreated manually since the new instance has no knowledge of with whom a calendar has been shared with on the old instance. Same for the group folders.

Two and a half questions remain:

  1. How do I scan the data dir for files and assign them to the right user?
  2. Is scanning for files (& assigning them) in the trash and the versions folders of that user possible too (or would going this route mean to loose trash and versions altogether)?
  3. How can I keep the colours of the calendars (and individually coloured events)?

The best solution would be a possibility to purge just the files related stuff from the db (leaving users with their credentials, calendars and address books untouched) and recreate these entries through scanning.
Unfortunately I have little understanding of the db structure so I will refrain from poking around it’s intestines via PhpMyAdmin or sth.

The normal operation of our instance is fine even after five years; “only” the files related stuff is a PITA (did I mention the dumb Windows client, reup- or downloading tons of files even tough they have the same dates/times and unchanged content on the server and the client?).

I’d really like to have a broom to partially sweep the db and a wand to “restore order” afterwards.

Some people complain about Nextcloud failing all the time even though they have already reinstalled 5 times. If you do the same setup, it is possible to trigger the same problem.

What I would do to avoid too much work with unsure outcome:

If the repair steps are not helping, and the test instance does not reproduce any of the errors, then I’d consider a new install.

If you start fresh, you can manually copy data, you can backup user calendars and contacts. If you go further than that, you probably need to poke around with the database, risking to copy the problems of your old setup to the new one. Or even create a new problem. And if your problem is a bug, if nobody has fixed this bug, you end up in the same situation like before.

occ files:cleanup, files:repair-tree, files:scan-app-data and maintenance:repair did not help; I have no external-files.

I set up a test instance (had to modify it a bit since I have no spare ssl host certificate but the rest should be 1:1) and (of course) it worked while being fresh.
After I restored the db the trouble began - files-wise.
Which is no surprise since the corresponding data wasn’t available (at first; and r/o afterwards since the test instance should not interfere with the live data - I have not enough space to simply copy all the data).

What persisted was the versions and trash stuff: In the UI the contents of the folders according to their status in the db are displayed, leading to errors when trying to really do something with the files displayed in the browser (of course).

So I’m still stuck with the question: how can I force NC to scan not only for files/folders, but for the contents of the trash and versions folders too?

I’d hate to lose all the trash contents and file versions just due to db issues…

But even if there is no other way than to start from scratch - how can I scratch all files related stuff from the db and scan the data folder into the db afterwards?