修復/損毀 SQLite 檔案(Repair SQLite)

修復/損毀 SQLite 檔案(Repair SQLite)

修復/損毀 SQLite 檔案(Repair SQLite)


資料來源:https://sqlite.org/download.html [工具下載]

https://jackyu.medium.com/%E4%BF%AE%E5%BE%A9%E7%88%9B%E6%8E%89%E7%9A%84-sqlite-%E8%B3%87%E6%96%99%E5%BA%AB-27355343291e
https://comate.baidu.com/zh/page/0kp79vemaj7
https://chatgpt.com/share/6a2f8699-a460-83e8-9349-1e6646a5a846 [檔案功能說明]
    sqlite3_rsync.exe
    sqlite3_analyzer.exe
    sqlite3.exe
    sqldiff.exe
https://chatgpt.com/share/6a2f870e-9178-83ee-a1a8-570ce97588d3 [修復教學]


GITHUB:https://github.com/jash-git/Repair-SQLite


修復BAT(ANSI):

REM 使用PRAGMA integrity_check指令檢測資料庫狀態
sqlite3 vpos.db "PRAGMA integrity_check;"
PAUSE

REM 快速檢查 index 狀況是否還正常
sqlite3 vpos.db "PRAGMA quick_check"
PAUSE

REM 完整檢查 DB 狀況
sqlite3 vpos.db "PRAGMA integrity_check"
PAUSE

REM 數據導出與重建
REM ?出?据到SQL文件
sqlite3 vpos.db ".output dump.sql" ".dump" ".exit"
REM ?建新?据?并?入?据
sqlite3 new_database.db ".read dump.sql"
PAUSE

REM 另一個方法是把 DB 還可以用的部分救出來,其他就算了 …
sqlite3 vpos.db ".dump" | sqlite3 new.db
PAUSE

發表迴響

你的電子郵件位址並不會被公開。 必要欄位標記為 *