First create a backup of the database, which will have no locks on it.
Then after, replace the database with its backup copy.
Follow the latter script to do the same where .x.Sqlite is the Sqlite database file:
Sqlite> .backup main backup.Sqlite
Want to learn about databases in depth? Here is the Database Training Course provided by Intellipaat.
Further, you will have a file named backup.Sqlite in the corresponding directory. Then you will have to swap your old database with the backup copy of the database. Thus, the backup copy does not have any locks in it, the SQLite database is locked error code 5 will not be conflicted.
$mv .x.Sqlite old.Sqlite
$mv backup.Sqlite .x.Sqlite
After the successful execution of the above script, you can moreover access the SQLite database. Review that the database is allowing both the read and write operations to run successfully, and then you can delete the old SQLite database file.
Want to be a SQL expert? Come and join this SQL Certification course by Intellipaat.