Otherwise you’ll overwrite your backup and there will be no ability to restore it back to an earlier version. If you use this method, you’ll probably want to take a copy of your back ups and only attach the copy. In this case I created a blank database called Chinook2 with which to restore the backup to.Īnother way to do it is to simply attach the backup, just like you’d do with any other database file: ATTACH DATABASE 'Chinook_backup.db' AS Chinook This accepts the name of the database to restore to, followed by the location of the backup file.Įxample: ATTACH DATABASE 'Chinook2.db' AS Chinook2 I’ll combine all commands for the sake of brevity: sqlite3 In this example, I connect to SQLite without specifying a database. Here’s another example that is similar to the previous one, but with a slightly different use case. That will back up the database to the specified file. This database will appear as the main database.
For example, you could connect to SQLite like this: sqlite3 Chinook.db backup Store /Users/sqlite/bak/Store_backup.db Backup the Main Database To backup to another directory, use the path. This backs up the database called Store to a backup file called Store_backup.db in the current directory. Here’s an example of backing up a database.backup Store Store_backup.db To use this command, provide the name of the database you want to back up, and a file name for the backup file. backup dot command that enables you to quickly and easily back up a database. The SQLite engine is not a standalone process. SQLite implements most of the SQL-92 standard for SQL. It is a self-contained, serverless, zero-configuration and transactional SQL database engine.
SQLite is an embedded relational database engine.
The SQLite command line shell provides the. C SQLite tutorial shows how to program SQLite databases in C.