How to merge contents of SQLite 3.7 WAL file into main database file

浪子不回头ぞ 提交于 2019-12-18 10:35:42

问题


With WAL (Write-Ahead-Logging) enabled in SQLite 3.7 (which is the default for Core Data on iOS 7), how do I merge/commit the content from the -wal file back into the main database file?


回答1:


Do a checkpoint, i.e., execute PRAGMA wal_checkpoint.




回答2:


From the command line, do this:

  1. sqlite3 MyDatabase.sqlite
  2. VACUUM;
  3. CTRL-D to exit the sqlite console.

Done!

The -wal file should now have a size of 0 and everything should be in your main database file.



来源:https://stackoverflow.com/questions/19574286/how-to-merge-contents-of-sqlite-3-7-wal-file-into-main-database-file

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!