Thanks for your answer.
Through the error code timeline, it shows that much of SQLITE_FULL, SQLITE_IOERR, SQLITE_CANTOPEN happened before SQLITE_CORRUPT. Database might be in an obscure state while disk is full, then it corrupt in some unknown reason. As you said, disk full might corrupt the database. Can you teach me a little more in detail ? I haven?t found the relative code in SQLite source code. ???? ???:Simon Slavinslavins at bigfraud.org ???:SQLite mailing listsqlite-users at mailinglists.sqlite.org ????:2016?1?14?(??)?17:46 ??:Re: [sqlite] Database Corrupt While Disk Full On 14 Jan 2016, at 8:44am, sanhua.zh sanhua.zh at foxmail.com wrote: Recently, my monitoring system showed that the error code SQLITE_FULL and SQLITE_CORRUPT increasing in same trend. And thousands of users, who?s database is corrupt, also traped inlow disk free space and their log show that SQLITE_IOERR, SQLITE_FULL happened simultaneously. Once you have received SQLITE_CORRUPT once, the database is corrupt and you should no longer use it. Later commands may return SQLITE_OK but that just means that they didn't read the corrupt part of the database. Somewhere else in the database file it is still corrupt. I confuse that whether disk full will corrupt the database (may be indirectyly). Not always ("will"), but sometimes (might). It depends on what SQLite is doing when it finds no spare space. However, if this happens 1) The program returned SQLITE_IOERR or SQLITE_FULL then crashed 2) you deleted some files to make some free space 3) you restart the program 4) the program works without returning any other SQLite error SQLite has returned the database to an uncorrupted state by rolling back the last transaction before the crash. This cannot happen if the error is instead SQLITE_CORRUPT. That result always means that the database is corrupt in a way that SQLite will not automatically fix. Simon. _______________________________________________ sqlite-users mailing list sqlite-users at mailinglists.sqlite.org http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users