SQLite打开提示database disk image is malformed

网上说产生这种错误的原因有很多种,磁盘空间不足,还有就是写入数据过程中突然掉电等。

这种情况,如果数据还可以导出,那么就可以修复

 

>sqlite Database_1.db
SQLite version 3.6.2
Enter ".help" for instructions
Enter SQL statements terminated with a ";"
sqlite> .output “_temp.tmp”
sqlite> .dump
sqlite> .quit

>sqlite Database_1.new.db
SQLite version 3.6.2
Enter ".help" for instructions
Enter SQL statements terminated with a ";"
sqlite> .read “_temp.tmp”
sqlite> .quit

还有更快的方法,我还没用过:

另一种更快的修复方法

$echo “.dump” | sqlite3 old.db | sqlite3 new.db
//直接将 old.db 修复为 new.db

或者

sqlite3 newsfeed.db .dump > newsfeed.sql
sqlite3 newsfeed.db < newsfeed.sql

相关文章:

  • 2021-06-19
  • 2021-08-07
  • 2022-12-23
  • 2022-02-03
  • 2021-10-04
猜你喜欢
  • 2022-12-23
  • 2021-07-01
  • 2021-11-25
  • 2021-06-19
  • 2021-12-21
相关资源
相似解决方案