https://github.com/superfly/sqlite3-restore
Utility for performing an online restore of a SQLite database.
https://github.com/superfly/sqlite3-restore
Last synced: about 1 month ago
JSON representation
Utility for performing an online restore of a SQLite database.
- Host: GitHub
- URL: https://github.com/superfly/sqlite3-restore
- Owner: superfly
- License: apache-2.0
- Created: 2023-01-25T22:13:28.000Z (over 2 years ago)
- Default Branch: main
- Last Pushed: 2023-01-26T18:46:12.000Z (over 2 years ago)
- Last Synced: 2025-04-20T10:13:16.709Z (about 2 months ago)
- Language: Go
- Size: 12.7 KB
- Stars: 9
- Watchers: 3
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
sqlite3-restore
===============This is a repository for the `sqlite3-restore` utility that provides a way to
restore a SQLite database online while other clients are connected. It acquires
the necessary locks on the destination database before performing a file copy.
This preserves the inodes so that existing clients can continue to read and
write from the database after the copy is complete.## Usage
The utility accepts a source database file and a destination database file:
```sh
sqlite3-restore SRC DST
```If the destination database file does not exist, then it will be created. If it
does exist, the journal file will be removed, the WAL file truncated, and the
SHM file will be invalidated.You can also set a timeout to wait on locks. By default, it is set to 5 seconds:
```sh
sqlite3-restore -timeout 30s SRC DST
```## Caveats
The source and destination databases must have the same journal mode when
performing a restore. Otherwise, you may experience locking issues when restoring.Please note that running `VACUUM INTO` will cause the output database to have a
rollback journal mode (`DELETE`) regardless of the journal mode of the database
you are vacuuming from.You can update the journal mode using the `sqlite3` CLI:
```sh
sqlite3 /path/to/src "PRAGMA journal_mode = wal"
```