How to rescue contacts only from old Mariadb Nextcloud database to current one?

Nextcloud version: 28.0.1
Operating system and version: Fedora 39
Apache or nginx version: Apache 2.4.58
PHP version: PHP 8.2.14

The issue you are facing:
How can I restore contacts only from a quite old (2019) MariaDB Nextcloud database named “nextwind”? Unfortunately this is the only backup source left over.

My fresh install of NC28.0.1 is up and running with a couple of users and even more active devices using a MariaDB database named “nextdb”.

Meanwhile I managed to import the old database additionally into MariaDB

MariaDB [(none)]> show databases;
+--------------------+
| Database           |
+--------------------+
| information_schema |
| mysql              |
| nextdb             |  <-- The one active with NC 28.0.1
| nextwind           |  <-- Additionally imported backup
| performance_schema |
+--------------------+

Good news is that the

oc_cards

table of nextwind contains my contacts.
Could you assist me in how to best get the contact data (only them) from the old database to the current one: nextdb? Optimally separated by users, but if not that’s fine as well. The table currently contains the automatically created cards for the users existing in the instance, but no self-supplied ones.

Any hint would be greatly appreciated!

The safest and most reliable way that comes to mind would be to:

  • deploy a separate Nextcloud Server app instance that is the same major Nextcloud Server version as whatever that 2019 db was used with
  • Point that separate instance at the old database
  • Export your contacts with the Contacts app on the separate instance
  • Import the contacts into your new (v28) Server from the export

You could also use calcardbackup to export your contacts from the database.

Have a look at the README in the repo (section ‘does this work with a broken instance’).

1 Like

This topic was automatically closed 8 days after the last reply. New replies are no longer allowed.