[Help] Contacts problem after restore and ownbackup

Hi, my problem is, I have restore the Contacts with ownbackup and now i have a load loop on contacts. I can’t see the Contacts Adressbook and the contacs.

The Restore Tables:

  • oc_addressbookchanges
  • oc_addressbooks
  • oc_cards
  • oc_cards_properties

When restoring I get the following error:

[details=Summary] Table(s) could not be restored: Inserting data row failed: An exception occurred while executing ‘INSERT INTO oc_cards (id,addressbookid,carddata,uri,lastmodified,etag,size) SELECT ?,?,?,?,?,?,? FROM oc_cards WHERE id = ? AND addressbookid = ? AND carddata = ? AND uri = ? AND lastmodified = ? AND etag = ? AND size = ? HAVING COUNT(*) = 0’ with params [“1”, “4”, “BEGIN:VCARD\r\nVERSION:4.0\r\nPRODID:+//IDN bitfire.at//DAVdroid/1.4.0.3-gplay vcard4android ez-vcard/0.1\r\n 0.1\r\nUID:7cac7d59-3edd-4158-b181-58af232c97cb\r\nCATEGORIES:

=\r\nREV:20170225T124301Z\r\nEND:VCARD\r\n”, “7cac7d59-3edd-4158-b181-58af232c97cb.vcf”, “1488026583”, “f794851d27e30afddc9581925e48382d”, “140558”]: SQLSTATE[42S22]: Column not found: 1054 Unknown column ‘carddata’ in ‘where clause’
[/details]

If I want to access the contacts I get the following entry in the log:

Summary
Doctrine\DBAL\Exception\InvalidFieldNameException: An exception occurred while executing 'SELECT `id`, `uri`, `lastmodified`, `etag`, `size`, `carddata` FROM `oc_cards` WHERE `addressbookid` = ?' with params ["3"]: SQLSTATE[42S22]: Column not found: 1054 Unknown column 'carddata' in 'field list'

/var/www/nextcloud/3rdparty/doctrine/dbal/lib/Doctrine/DBAL/DBALException.php - line 128: Doctrine\DBAL\Driver\AbstractMySQLDriver->convertException('An exception oc...', Object(Doctrine\DBAL\Driver\PDOException))
/var/www/nextcloud/3rdparty/doctrine/dbal/lib/Doctrine/DBAL/Connection.php - line 836: Doctrine\DBAL\DBALException driverExceptionDuringQuery(Object(Doctrine\DBAL\Driver\PDOMySql\Driver), Object(Doctrine\DBAL\Driver\PDOException), 'SELECT `id`, `u...', Array)
/var/www/nextcloud/lib/private/DB/Connection.php - line 194: Doctrine\DBAL\Connection->executeQuery('SELECT `id`, `u...', Array, Array, NULL)
/var/www/nextcloud/3rdparty/doctrine/dbal/lib/Doctrine/DBAL/Query/QueryBuilder.php - line 206: OC\DB\Connection->executeQuery('SELECT `id`, `u...', Array, Array)
/var/www/nextcloud/lib/private/DB/QueryBuilder/QueryBuilder.php - line 177: Doctrine\DBAL\Query\QueryBuilder->execute()
/var/www/nextcloud/apps/dav/lib/CardDAV/CardDavBackend.php - line 460: OC\DB\QueryBuilder\QueryBuilder->execute()
/var/www/nextcloud/3rdparty/sabre/dav/lib/CardDAV/AddressBook.php - line 80: OCA\DAV\CardDAV\CardDavBackend->getCards('3')
/var/www/nextcloud/3rdparty/sabre/dav/lib/DAV/Tree.php - line 195: Sabre\CardDAV\AddressBook->getChildren()
/var/www/nextcloud/3rdparty/sabre/dav/lib/DAV/Server.php - line 893: Sabre\DAV\Tree->getChildren('addressbooks/us...')
/var/www/nextcloud/3rdparty/sabre/dav/lib/DAV/Server.php - line 947: Sabre\DAV\Server->addPathNodesRecursively(Array, Object(Sabre\DAV\PropFind))
/var/www/nextcloud/3rdparty/sabre/dav/lib/DAV/CorePlugin.php - line 336: Sabre\DAV\Server->getPropertiesForPath('addressbooks/us...', Array, 1)
[internal function] Sabre\DAV\CorePlugin->httpPropFind(Object(Sabre\HTTP\Request), Object(Sabre\HTTP\Response))
/var/www/nextcloud/3rdparty/sabre/event/lib/EventEmitterTrait.php - line 105: call_user_func_array(Array, Array)
/var/www/nextcloud/3rdparty/sabre/dav/lib/DAV/Server.php - line 479: Sabre\Event\EventEmitter->emit('method PROPFIND', Array)
/var/www/nextcloud/3rdparty/sabre/dav/lib/DAV/Server.php - line 254: Sabre\DAV\Server->invokeMethod(Object(Sabre\HTTP\Request), Object(Sabre\HTTP\Response))
/var/www/nextcloud/apps/dav/lib/Server.php - line 227: Sabre\DAV\Server->exec()
/var/www/nextcloud/apps/dav/appinfo/v2/remote.php - line 30: OCA\DAV\Server->exec()
/var/www/nextcloud/remote.php - line 165: require_once('/var/www/nextcl...')
{main}

Can someone help me there?

Hi, I had the same Issue. Found a workaround and posted a bug report at the github from ownbackup: https://github.com/pbek/ownbackup/issues/15

navigate into your data folder and go through the subdirectories. e.g. /var/www/nextcloud/data/ownbackup/[backupid]/oc_cards/structure.xml and insert the datatype for carddata field (see the link above). after that you should restore your contacts successfully.

hope this helps!

edit: the issue was found some hours before, they had the same workaround: https://github.com/pbek/ownbackup/issues/14

additionally, the ownbackup dev says this is not a problem with ownbackup itself and should be related to the nextcloud API. Do we need to address this issue somewhere else so it can be fixed?

thanks Ronav thats it is, the solution is:

<field><name>carddata</name></field> to <field><name>carddata</name><type>clob</type><notnull>false</notnull></field> fixed the restore problem for me.