So, my server got an outage, which has left my contacts unaccessible. Mails and calendar are working, but I can’t open the contacts anymore. Nextcloud log shows something like this:
"SQLSTATE[HY000]: General error: 11 database disk image is malformed\"
For me there are two options, which I tried to solve on my own, but failed.
Restore from a previous backup.
Just start over with the whole thing.
So I tried my very best understanding to restore with this duplicity, and googled around for “delete the database and start over”. Next try would be to just wipe the server. Any tips?
It sounds like the sqlite database of NextCloud got corrupted. You can try to recover most of it using sqlite.
service php5-fpm stop
cd /home/user-data/owncloud
cp owncloud.db owncloud_backup.db
sqlite3 owncloud.db ".dump" | sqlite3 owncloud_recover.db
chown www-data:www-data owncloud_recover.db
mv owncloud_recover.db owncloud.db
service php5-fpm start
It may cause lost data around the crash but should recover the database to a point that makes it usable again. It may also not be able to do anything - but it’s worth a shot. If this doesn’t work, restoring from backup is your only bet.
I thought about doing a restore from maybe three days ago. First it’s not quite clear for me how to actually define a certain backup file to restore from. The other problem I had is with providing the secret key. I did the PASSPHRASE export, but I still get asked for a gpg key.
BUT (!), the tip from hachre worked. Contacts back again. Thanks!
We’ll a little bit too rash. Still no contact sync, but I can see them again in nextcloud. At least one point. I think I’ll sleep over this, and maybe do a re setup…
In fact now it seems to work, I’ll check if it stays like that. I did a nice hopping around in every log file I could find, no errors so far. But thanks for the prompt reply, helps a lot to know that helping folks are around.