A good way to backup/restore database to/from an external file

Friday, 29 August 2014 · 2 messages · last reply 2 Sep 2014
IF
Ioan Fericel29 Aug 2014 12:46 #
Hi all, I would ask you to give me an opinion on what would be the simplest solution, when pressing a button in a web page that triggers the function "db:create-backup" of BaseX, to have the possibility of saving the resulting file in a location chosen by the user, including the name generated from the concatenation of timestamp. Possibly with the option to not be saved in the default location. And also the reverse way: restore a database from a backup file (zip), showing the path to it, with the file upload. Thanks for any ideas, Ioan
CG
Christian Grün2 Sep 2014 12:49 #
Hi Ioan, if you plan to use db:create-backup or db:restore, you'll have to rely on the built-in functionality: backups will always be placed in the database directory of BaseX, so there's no way to choose a custom destination. What you could do instead: * Access a backup file from the database directory (which can be retrieved via db:system) and copy/move the file to another place in a second step * Use db:export, archive:create, or zip:zip-file to manually copy or zip all files from a database. You will need to use XQuery locking options [1] to ensure that no other process changes the currently accessed databases. Hope this helps, Christian [1] http://docs.basex.org/wiki/Transactions#XQuery_Locking_Options
Quoted text · Ioan Fericel · 14 lines
> I would ask you to give me an opinion on what would be the simplest > solution, when pressing a button in a web page that triggers the function > "db:create-backup" of BaseX, to have the possibility of saving the resulting > file in a location chosen by the user, including the name generated from the > concatenation of timestamp. Possibly with the option to not be saved in the > default location. > > And also the reverse way: restore a database from a backup file (zip), > showing the path to it, with the file upload. > > Thanks for any ideas, > Ioan > >

⚡Generated with XQuery