Repairing Configuration Database SQLite3 Files
Repairing an SQLite3 configuration database for Access Server is a rare but occasionally necessary task. If you encounter an error indicating a malformed database, such as DatabaseError: database disk image is malformed
, this topic will help you diagnose the issue and attempt a recovery.
Ensure your server is stable and the hardware is functioning properly.
Run diagnostics to check memory, disk health, and available disk space.
Connect to your Access Server console and get root privileges.
Halt the Access Server service to prevent further changes:
service openvpnas stop
Back up your database files before attempting any repairs:
cd /usr/local/openvpn_as/etc/db/ mkdir backup cp *.db ./backup
Now, you have files in the backup subfolder if needed.
Important
This is a simplified backup process done with a stopped Access Server. We recommend creating regular backups. Refer to this tutorial, which doesn't require stopping Access Server's service:
Use SQLite3 to convert the damaged database into SQL commands and rebuild it.
Attempt recovery on each of the four main database files.
cd /usr/local/openvpn_as/etc/db/ mv config.db config.db.backup sqlite3 config.db.backup .dump | sqlite3 config.db mv config_local.db config_local.db.backup sqlite3 config_local.db.backup .dump | sqlite3 config_local.db mv certs.db certs.db.backup sqlite3 certs.db.backup .dump | sqlite3 certs.db mv userprop.db userprop.db.backup sqlite3 userprop.db.backup .dump | sqlite3 userprop.db mv log.db log.db.backup sqlite3 log.db.backup .dump | sqlite3 log.db
Tip
If you have an issue with only one of the four database files, you can run the commands for that file only.
After running the recovery commands, restart the server and check functionality:
service openvpnas restart
Test the server to ensure the repair was successful.
If the issues persist, ever to the backup files or contact us for support.