linuxcommand-linesqlitecorruption

Is there a command line utility for validating SQLite databases in Linux?


I am looking for a command line utility to validate SQLite databases. I ran into a situation in some inherited code where an application fails to startup because an attempt to access a database produced the following error:

database disk image is malformed

So I need to instrument some validation code in the application. Additionally, though, I need a tool that I can run from the Linux prompt to tell me simply if the database is corrupt or not.

Thanks


Solution

  • You can do something like this:

    sqlite3 database.db "PRAGMA integrity_check"