Hosting Operations
Read-onlyBack Up a SQLite Database File
You need to create a SQLite backup through sqlite3 instead of a raw file copy.
Command
sqlite3 app.db ".backup backup/app.db"
Before you run this
System impact: Read-only. Low when scoped to the shown target.
When not to use it: Do not use it as your only production backup plan; automate and verify backups separately.
Expected output
The sqlite3 backup command is quiet on success; verify with ls afterward.
System impact
Read-only. SQLite writes a backup copy to backup/app.db.
When to use it
Use before risky data work, migrations, or manual inspection on a SQLite-backed app.
When not to use it
Do not use it as your only production backup plan; automate and verify backups separately.
Recovery / rollback
Remove the backup file with rm backup/app.db if it was created only for a temporary check.
next steps
Related commands
Check SQLite Database Integrity
When a SQLite-backed app behaves strangely, first rule out file corruption.
sqlite3 app.db "PRAGMA integrity_check;"
Count Rows in Key SQLite Tables
A quick row count can reveal empty imports, runaway events, or missing data.
sqlite3 app.db "SELECT 'users', count(*) FROM users UNION ALL SELECT 'orders', count(*) FROM orders UNION ALL SELECT 'events', count(*) FROM events;"
List SQLite User Tables Only
System metadata tables can distract from the app tables you care about.
sqlite3 app.db "SELECT name FROM sqlite_master WHERE type='table' ORDER BY name;"
Show Recent SQLite Events
For small apps, the quickest timeline may be inside the SQLite file.
sqlite3 app.db "SELECT created_at, event_type FROM events ORDER BY created_at DESC LIMIT 5;"
Show One SQLite Table Schema
A failed query is often just a wrong assumption about column names.
sqlite3 app.db ".schema users"
Study mapping
Use this as independent command practice: read the notes, predict the output, then compare it with the example before using a real shell.
Independent study support only. No affiliation, endorsement, exam dumps, or real exam questions.