What do you do when the database is corrupt?

Server version is 2.2.8
It is corrupt:
2018-03-19 12:16:15: WARNING: SQLite: database corruption at line 115702 of [0ee482a1e0] errorcode: 11
2018-03-19 12:16:15: WARNING: SQLite: database corruption at line 60844 of [0ee482a1e0] errorcode: 11
2018-03-19 12:16:15: WARNING: SQLite: statement aborts at 8: [] database disk image is malformed errorcode: 11
2018-03-19 12:16:15: WARNING: SQLite: malformed database schema (4) errorcode: 11
2018-03-19 12:16:15: ERROR: Error in CQuery::Execute - malformed database schema (4) Stmt: [UPDATE clients SET lastseen=datetime(?, ‘unixepoch’) WHERE id=?]

Are there any options besides complete remove and reinstall?

I have had to removing/reinstall server S/W more that once.
Then, deleting all backups and starting from scratch. Not much fun.
repair-database does not fix this problem.


It does auto backup it s database, did you tried to restore it?

Yes, but the backup was corrupt too.

I opened a post in the Feature Request section to have the Server S/W make sure the current backup is healthy before making the backup.
Backing up a corrupt database over a good one, makes the backup useless.

Currently urbackupsrv will not start because of the corrupted database.

Do I have to remove/reinstall?

I agree with you that this needs better handling. As far as I can tell, there is no “reset” function within UrBackup that lets you start backups from the beginning with a fresh database. Like you, I would prefer not to redo all server and client settings (i.e., reinstall).

However, I was able to fix some corruption by manually deleting my backups from their destination directories, and then running urbackupsrv remove-unknown. This had the effect of cleaning out the database of its corruption, and allowing me to start over with those clients’ backups without reinstalling from scratch.

I hope this will be of some help to you.

I just removed/reinstalled the server software.
I did not try deleting databases and then running server.
I will try that if it happens again. Thanks for the tip.