android SQLiteDatabase 错误 database disk image is malformed

crash:java.lang.IllegalStateException: attempt to re-open an already-closed object: SQLiteDatabase:


crash:android.database.sqlite.SQLiteDatabaseCorruptException: database disk image is malformed (code 11)


DefaultDatabaseErrorHandler: Corruption reported by sqlite on database: /storage/emulated/0/.database/xxx.db


10-28 09:20:06.382  4423  5128 E DefaultDatabaseErrorHandler: deleting the database file: /storage/emulated/0/.database/xxx.db
10-28 09:20:06.391  4423  5128 I photocombserver: crash:android.database.sqlite.SQLiteDatabaseCorruptException: database disk image is malformed (code 11)
10-28 09:20:06.391  4423  5128 I photocombserver:       at android.database.sqlite.SQLiteConnection.nativeExecuteForCursorWindow(Native Method)
10-28 09:20:06.391  4423  5128 I photocombserver:       at android.database.sqlite.SQLiteConnection.executeForCursorWindow(SQLiteConnection.java:843)
10-28 09:20:06.391  4423  5128 I photocombserver:       at android.database.sqlite.SQLiteSession.executeForCursorWindow(SQLiteSession.java:836)
10-28 09:20:06.391  4423  5128 I photocombserver:       at android.database.sqlite.SQLiteQuery.fillWindow(SQLiteQuery.java:62)
10-28 09:20:06.391  4423  5128 I photocombserver:       at android.database.sqlite.SQLiteCursor.fillWindow(SQLiteCursor.java:143)
10-28 09:20:06.391  4423  5128 I photocombserver:       at android.database.sqlite.SQLiteCursor.getCount(SQLiteCursor.java:132)
10-28 09:20:06.391  4423  5128 I photocombserve[   45.093254@0] SysRq : Emergency Remount R/O



针对这个问题: database disk image is malformed

跟踪后发现一个sql语句都会报错select * from t_tmp where accessid= 'xxxxxxxxxxxxxxxxxxxxxxxxx'; 

运行检查数据库的语句: PRAGMA integrity_check

删除这个索引,或重建索引就没问题了


sqlite数据库有reindex的功能



你可能感兴趣的:(android,数据库,sqlite,android)