Slacker News Slacker News logo featuring a lazy sloth with a folded newspaper hat
  • top
  • new
  • show
  • ask
  • jobs
Library

Comment by simonw

2 years ago

The ".backup" mechanism is safe - it's directly copying the file with "cp" that doesn't work.

Here's how to use .backup:

    sqlite3 data.db ".backup 'backup.db'"

You can also do this:

   sqlite3 data.db 'VACUUM INTO "backup.db";'

That's slower, but results in a smaller backup file: https://www.sqlite.org/lang_vacuum.html

1 comment

simonw

Reply

hnben  2 years ago

thanks!

Slacker News

Product

  • API Reference
  • Hacker News RSS
  • Source on GitHub

Community

  • Support Ukraine
  • Equal Justice Initiative
  • GiveWell Charities