> To backup:
> sqlite your_db_file '.dump wiki' > wikibackup.sql
>
> To restore:
> sqlite your_db_file < wikibackup.sql

Note that this may be a little bit more complex than the above example
to restore from the backup file:

This dump the wiki table (only)
sqlite your_db_file '.dump wiki' > wikibackup.sql

This load the wiki table (only)
sqlite your_db_file < wikibackup.sql

In your_db_file, the table you want to restore already exists (*), so
you need to first get rid of the table as the SQL file tells the
sqlite tool to create the table, then inserts items in it.
This can be achieve with a command (in sqlite) like:
"drop table wiki;"

(*): or this would mean that you'd want to start from an empty DB. It
is no sense to restore the wiki table only, without some other
'administrative' tables...

I find easier to always backup the DB as a whole (and filter out the
unwanted statements - if any - at restoration time). I simply discard
the session and auth_cookie table, using grep:
grep -Ev "^INSERT INTO session|auth_cookie VALUES"

HTH,
Manu
_______________________________________________
Trac mailing list
[email protected]
http://lists.edgewall.com/mailman/listinfo/trac

Reply via email to