开发者

Programmatically Repair SQLite Database

I have a need to try and repair a SQLite database from a .NET program if the database file gets corrupted. I have found several sites such as Fix SQLite and in the FAQ it describes that you can:

Depending how badly your database is corrupted, you may be able to recover some of the data by using the CLI to dump the schema and contents to a file an开发者_如何转开发d then recreate.

Does anyone know of a way to repair a SQLite database programmatically in .NET?


You might consider implementing your own strategy for database recovery. You could store backups of the SQLite file and then check that it is OK using:

PRAGMA integrity_check; 

If errors are found then you can revert to a backup.


You are overlooking one important word: you can 'recover some data', this is not a repair!

If there is a sitatuation where a corrupted database could be repaired perfectly without user-interaction than it would not be corrupted in the first place and such an repair would have been a standard function of SQLite

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜