sqlite-wal-safe-ops

Backs up SQLite WAL-format databases by checkpointing cache and copying all three files with verification.

Updated Apr 4, 2026
One-click install
npx skills add https://github.com/saintgo7/claude-skills --skill sqlite-wal-safe-ops
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: sqlite-wal-safe-ops
Source: https://github.com/saintgo7/claude-skills/tree/main/sqlite-wal-safe-ops
Command: npx skills add https://github.com/saintgo7/claude-skills --skill sqlite-wal-safe-ops

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill requires sqlite3, and includes scripts (resource) components.

What problem does it solve?

SQLite WAL mode can silently corrupt or roll back your latest state when you back up or move only the main .db file, or when you mishandle the related -wal/-shm sidecar files during operations like shutdown, deployment, or recovery.

Core Features & Use Cases

  • Safe WAL-aware backup: Checkpoint WAL into the main database and copy all three files (.db, .db-wal, .db-shm) with integrity verification.
  • Operational guardrails: Avoid forbidden actions like moving/removing active WAL/SHM files and “.db-only” backups that omit recent transactions.
  • Troubleshooting and recovery playbook: Provide an incident flow for WAL/SHM-related errors such as disk I/O errors, malformed DB images, and locked databases, including data reinitialization guidance.

Quick Start

Ask your AI to run the SQLite WAL safe backup by executing safe-backup.sh on your live WAL-mode database file to produce a verified backup in a target directory.

Frequently Asked Questions about sqlite-wal-safe-ops

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I back up a SQLite database in WAL mode without losing recent transactions?

To back up a SQLite WAL mode database safely, you must checkpoint the WAL file into the main database and copy all three sidecar files (.db, .db-wal, .db-shm). Backing up only the .db file omits recent transactions and risks data loss.

Why does my SQLite backup rollback or corrupt when I copy only the .db file?

Your SQLite backup corrupts because WAL mode stores recent transactions in the .db-wal file. Copying only the .db file omits the .db-wal and .db-shm sidecar files, silently rolling back your latest state.

What is the best way to move a SQLite WAL database during a k8s deployment cutover?

The best way to move a SQLite WAL database during a k8s deployment is to checkpoint the WAL, verify integrity using PRAGMA integrity_check, and copy the complete trio of .db, .db-wal, and .db-shm files with timestamps to the target directory.

How do I checkpoint a SQLite WAL file before backing up?

You checkpoint a SQLite WAL file by triggering a checkpoint command to merge WAL transactions into the main database. This ensures the .db file contains the latest state before you copy the .db, .db-wal, and .db-shm files for backup.

Do I need to copy the .db-shm file when backing up a SQLite WAL database?

Yes, you need to copy the .db-shm file along with the .db and .db-wal files when backing up a SQLite WAL database. Omitting the .db-shm sidecar file can lead to corrupted database images and recovery failures.

How do I troubleshoot SQLite disk I/O errors and database locked events in WAL mode?

To troubleshoot SQLite disk I/O errors and locked database events in WAL mode, follow an operational recovery playbook that checks WAL and SHM file integrity, runs PRAGMA integrity_check, and guides data reinitialization if the database image is malformed.