SQLite Forum

How to find out which table is affected by page corruption
I have a sqlite3 database which has become corrupted, most likely due to repeated power outages. Various selects return a "SQLite error SQLITE_CORRUPT (database disk image is malformed)" error.

So I ran an integrity check:

`frankvw@dellfvw:~/tmp$ ./sqlite3 MyVideos116.db 
SQLite version 3.35.5 2021-04-19 18:32:05
Enter ".help" for usage hints.
sqlite> PRAGMA integrity_check;
*** in database main ***
Page 3284: btreeInitPage() returns error code 11
Page 3283: btreeInitPage() returns error code 11
Page 3282: btreeInitPage() returns error code 11
Error: database disk image is malformed`

Question: how do I find out which tables are affected?

I tried to run the .recover command on the database, but ran into problems with the following:

`CREATE TABLE "lost_and_found"(rootpgno INTEGER, pgno INTEGER, nfield INTEGER, id INTEGER, c0, c1, c2, [...]  c2046, c2047);`

which results in:

`Error: near line 128760: too many columns on lost_and_found
Error: near line 128761: no such table: lost_and_found
Error: near line 128762: no such table: lost_and_found`

and also has other problems:

`Error: near line 34: UNIQUE constraint failed: version.rowid
Error: near line 35: UNIQUE constraint failed: bookmark.idBookmark
Error: near line 36: UNIQUE constraint failed: art.art_id`
(repeated many times)

Any suggestion would be appreciated!