sqlite: database disk image is malformed svn commit code example

Example: svn commit sqlite: database disk image is malformed

sqlite3 .svn/wc.db

sqlite> .mode insert
sqlite> .output dump_all.sql
sqlite> .dump
sqlite> .exit

mv .svn/wc.db .svn/wc-corrupt.db
sqlite3 .svn/wc.db

sqlite> .read dump_all.sql
sqlite> .exit

//compare user-version from new db with backup
sqlite3 .svn/wc.db 'PRAGMA user_version;'
sqlite3 .svn/wc-corrupt.db 'PRAGMA user_version;' //remember user-version

sqlite3 .svn/wc.db 'PRAGMA user_version = XXX;' //replace XXX with user-version from backup

Tags:

Misc Example