NC restore without complete database

Already mentioned here but now moved to a new topic: NC12: occ maintenance:singleuser no more available?


  • Have a completely missconfigured NC 12.0.0 with about 20 users.
  • Installed now a fresh VM from
  • Don’t want to migrate the waste in the old database
  • Calendar and Address book had bugs in the old DB. These entries I want to create new from attached clients (i.e. Android Davdroid, Thunderbird)
  • Calendar and Address book are only used by me, not by the users (I hope). So for me I would get it working restoring from Android

What I want in the new NC:

  • Creating all users with their passwords and e-mail-addresses
  • Restore their data - they may not have synchronization problems
  • Restore users group memberships (not a must)

For that I just exported these data with phpMyadmin:


Any table else usable for my migration?

Remember: I have shit in the DB which I want to leave behind me … :wink:

  • occ maintenance:singleuser no more available since NC12

Okay, I have:

  • oc_accounts.sql, oc_groups.sql, oc_users.sql
  • Data folder with all users data

How to proceed? - My first try will be:

  1. Restore oc_groups.sql
  2. Restore oc_users.sql
  3. Restore oc_accounts.sql
  4. Restore complete data folder

I would be very careful to restore databases, especially when you say that there are bugs. If possible, I would export calender and contacts from apps that were synced. Or if you restore from the old database, do it in a special recovery session, export the data and import them into the new setup.

Without the filecache, you can use the old data, re-index all data but this will lead to a complete resync on all clients.

Exactly this is what I want to prevent: Restoring old shit.

So I tried to reduce it to a minimum: I restored:

  • oc_accounts
  • oc_credentials
  • oc_groups
  • oc_group_admin
  • oc_group_user
  • oc_users.sql ← erst am Schluss!!!

I tried a short login with one user with old passwort: Works!
While thiis short phase also data directories of 2 users were created: Seems, that synchronization works too.
Perhaps a bad database situation for these users now … I don’t know.

Now I copied all the old data folders of all users … and now will create a snapshot to be able to revert to this situation.

Now I deactivated all users. NC is in maintenance mode

What does that command do?

occ maintenance:data-fingerprint

Help prints out:

update the systems data-fingerprint after a backup is restored

Documentation of config-php for NC12:

'data-fingerprint' => '',

Sets the data-fingerprint of the current data served

This is a property used by the clients to find out if a backup has been restored on the server. Once a backup is restored run ./occ maintenance:data-fingerprint To set this to a new value.

Updating/Deleting this value can make connected clients stall until the user has resolved conflicts.

Defaults to ‘’ (empty string)

  • So I should use this?

I run

occ maintenance:data-fingerprint

The result in config-php is this:

'data-fingerprint' => '63a31e6c878efdba4debfdbeec5a10a2',

Actually I just had a corrupted oc_filecache without any possibility to even dump it. So needed to do occ files:scan --all and scan-app-data to rebuild it. I was happy to see, that the clients did NOT resync all the files. They just checked all of them without actually transfering one.

As the oc_filecache can be large and for sure be a holder of errors/corruption I would give it a try to rebuild it. In case of course backup/dump of the whole database should be done in every case.

Backup and resync of calendar, tasks and contacts via clients on phone and/or desktop is good hint. Did it the same way and worked fast and great. Just take care that these clients support the full caldav/carddav fields. E.g. Thunderbird+SoGo just allows 2 phone numbers and 2 mail addresses, so I needed to do contact backup with Android app, which provides the sometimes 4 to 5 fields I have for some contacts.

1 Like


# sudo -u www-data ./occ files
Nextcloud is in maintenance mode - no app have been loaded
  Command "files" is not defined.                                 

No file scan available anymore!?!?! :scream:

  • Disabled all users without 1 admin
  • “User disabled” message appears:

Roll back to “Before DB-Import” or “After DB-Import” ?