Skip to content

Instantly share code, notes, and snippets.

@huacnlee
Created May 3, 2013 03:01
Show Gist options
  • Save huacnlee/5506914 to your computer and use it in GitHub Desktop.
Save huacnlee/5506914 to your computer and use it in GitHub Desktop.
自动修复损坏的 SQLite 3 数据库:“database disk image is malformed”
#!/bin/bash
mv "$1" "old_$1"
cat <( sqlite3 "old_$1" .dump | grep "^ROLLBACK" -v ) <( echo "COMMIT;" ) | sqlite3 "$1"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment