码迷,mamicode.com
首页 > 数据库 > 详细

如何备份和还原sqlite数据库

时间:2015-04-08 21:33:17      阅读:320      评论:0      收藏:0      [点我收藏+]

标签:

Backing up the database

To make a backup copy of the database, simply do a "dump" and redirect the results to a file.

cd /home/sqlite
sqlite3 sample.db .dump > sample.bak

Restoring the database

Restoring the database from a backup is just as easy as backing up, except we must make sure the destination database is empty first. Alternatively you may want to delete or rename the destination database and let sqlite create a new one for you.

cd /home/sqlite
mv sample.db sample.db.old
sqlite3 sample.db < sample.bak

After restoring, verify the results.

sqlite3 sample.db ‘select * from music;‘

Beastie Boys|Paul‘s Boutique
John, Elton|Goodbye Yellow Brick Road
Parliment|Mothership Connection

如何备份和还原sqlite数据库

标签:

原文地址:http://www.cnblogs.com/jayzee/p/4403616.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!