DB restore #2306

Closed
opened 2025-10-09 17:58:19 +03:00 by OVERLORD · 5 comments
Owner

Originally created by @Biepa on GitHub.

Hello together,
I am using the command in the documentation to backup the db.
sqlite3 /$DATA_FOLDER/db.sqlite3 ".backup '/$DATA_FOLDER/db-backup/backup.sq3'"

Unfortunately my knowledge about databases is very limited.
How do I restore a backup.sq3 file?

Tried it with...
sqlite3 db.sqlite3 < backup.sq3
but getting a "syntax error".

Is that because of the different endings?

Originally created by @Biepa on GitHub. Hello together, I am using the command in the documentation to backup the db. `sqlite3 /$DATA_FOLDER/db.sqlite3 ".backup '/$DATA_FOLDER/db-backup/backup.sq3'"` Unfortunately my knowledge about databases is very limited. How do I restore a backup.sq3 file? Tried it with... `sqlite3 db.sqlite3 < backup.sq3` but getting a "syntax error". Is that because of the different endings?
OVERLORD added the documentationquestion labels 2025-10-09 17:58:19 +03:00
Author
Owner

@dani-garcia commented on GitHub:

The backup should be a simple copy of the original database, I think. I'm not sure why we are using different extensions, that seems confusing.

Simply replace the db.sqlite3 file with the backup to restore it (This probably needs to be done when bitwarden_rs is stopped)

@dani-garcia commented on GitHub: The backup should be a simple copy of the original database, I think. I'm not sure why we are using different extensions, that seems confusing. Simply replace the `db.sqlite3` file with the backup to restore it (This probably needs to be done when bitwarden_rs is stopped)
Author
Owner

@mprasil commented on GitHub:

Agreed, I think we should also add restore information. I guess @Biepa was trying to approach this as restore from dump as it's more common with MySQL/Postgres? So maybe we need to be more specific that .backup command does consistent copy of the binary database and it's not the same as .dump which is probably what @Biepa was expecting.

@mprasil commented on GitHub: Agreed, I think we should also add restore information. I guess @Biepa was trying to approach this as restore from dump as it's more common with MySQL/Postgres? So maybe we need to be more specific that `.backup` command does consistent copy of the binary database and it's not the same as `.dump` which is probably what @Biepa was expecting.
Author
Owner

@dani-garcia commented on GitHub:

The documentation is updated now with #224

@dani-garcia commented on GitHub: The documentation is updated now with #224
Author
Owner

@Biepa commented on GitHub:

A simple copy with stopped container worked without problems. Thank you for the quick answer.

@Biepa commented on GitHub: A simple copy with stopped container worked without problems. Thank you for the quick answer.
Author
Owner

@Biepa commented on GitHub:

@mprasil You're right. That was, what I expected.
And if there isn't a need for the different endings, maybe that could also be changed in the documentation as it confused me a bit.

@Biepa commented on GitHub: @mprasil You're right. That was, what I expected. And if there isn't a need for the different endings, maybe that could also be changed in the documentation as it confused me a bit.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/vaultwarden#2306