Can anyone found and fixed the problem with corrupted database?
It is opened via command line tools, but nothing is available.
sqlcipher myDb.db
sqlite> pragma key = “my key”
sqlite> pragma cipher_licencse=‘my license’
sqlite> .tables
Error: File is not a database
Hi @signum-net,
After providing the key
and cipher_license
PRAGMA commands (but without executing the .tables
command), would you try running PRAGMA cipher_integrity_check
and PRAGMA integrity_check
and report your findings?
OMG!
PRAGMA cipher_integrity_check produces the list of “HMAC verification failed for page nnnn”
and the summary is:
page 5462 has an invalid size of 2048 bytes
PRAGMA integrity_check returns an error (file is not a database)
(I forgot to note that it is db in 3 ver format, so I also use pragma cipher_compatibility=3;)
What to do ? How to live with this ?
Hello @signum-net,
The PRAGMA cipher_integrity_check
performs an independent verification of the database based on the HMAC stored for each page in the database. Because it appears the HMAC validation is failing on multiple pages of the database, that suggests that something independent from SQLCipher may be operating on the database file leaving it in an invalid state.
Since you are a Commercial customer would you mind reaching out to us at support@zetetic.net for private support with answers to the following:
- Does your application use multiple threads/connections for processing the database file in question?
- Are there any file I/O operations that might include moving/renaming/reading the database file or files in the same directory as the database?
- Does more than 1 application access the database file?
- Does the database file exist on a network share?
- Does your application bundle other SQLite/SQLCipher implementations?
- What
PRAGMA
settings does your application use?
Thank you,