问题
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:
sqlite3 MyDatabase.sqlite
VACUUM;
- 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