Troubleshooting UrBackup Server Database
Warning: You should not normally have to apply things described in this document. Please file a bug, if appropriate (i.e. your hard disk did not corrupt the database).
UrBackup uses the popular and well tested SQLite Database library. The Server stores its data in two such SQLite Databases urbackup/backup_server.db and urbackup/backup_server_settings.db . The Database can be opened by any recent SQLite database manager. For a list see e.g. this page http://stackoverflow.com/questions/835069/which-sqlite-administration-console-do-you-recommend .
Assuming you are using the official SQLite shell from http://www.sqlite.org/download.html you can open one of the databases via
sqlite3 backup_server.db
Now you can e.g. get a list of existing tables:
.tables
Now make sure, that UrBackup server is not running. The following command enables a more efficient (for single users) journal mode for the database:
PRAGMA journal_mode=delete;
Now you could check the integrity of the database with:
PRAGMA integrity_check;
You can defragment the database (maybe this also fixes integrity issues) via:
VACUUM;
One way to repair the database is often to export and import the database. That is:
.output export.sql
.dump
.exit
Delete file backup_server.db.
sqlite3 backup_server.db
.read export.sql
Maybe the import/export procedure skips some tables because of errors. In this case you either have to create them manually (Use .tables and .schema to find the commands to create them) or copy the existing data to a non-corrupt Database.
UrBackup Server 1.3 also includes a procedure that automatically does the import/export.
On Linux use the command:
start_urbackup_server --repair_database
On Windows use
repair_database.bat
UrBackup Server creates nightly backups of its database per default. If the restore procedure fails you can restore those. Steps:
- Stop UrBackup Server
- Create a backup of the damaged database files
- Delete all files belonging to the databases: backup_server.db, backup_server.db-shm, backup_server.db-wal, backup_server_settings.db, backup_server_settings.db-shm, backup_server_settings.db-wal (rm backup_server*)
- Copy the files from the urbackup folder in the storage directory (backup_server.db and backup_server_settings.db)
- Start UrBackup Server