Create database backup

Creating a full database backup.

This action could take up to 10 minutes. Note: the server will not be available to users (due to very slow performance). Note: this query has to be done on an eXist-db that is up and running.

To run the xquery below on the server:

  • Open a webbrowser, surf to: http://<server>:8877
  • Click on ‘dashboard’.
  • Log in as ‘admin’.
  • Open eXide.
  • Click: ‘New XQuery’ (paste the xquery in the box below to the browserscreen)
  • Click: ‘eval’ to run the xquery.
xquery version "3.0";
import module namespace repair="http://exist-db.org/xquery/repo/repair" at "resource:org/exist/xquery/modules/expathrepo/repair.xql";

(:http://exist-db.org/exist/apps/doc/backup.xml:)

let $params     :=
    <parameters>
        <param name="output" value="export"/>
        <param name="backup" value="yes"/>
        <param name="zip" value="yes"/>
        <param name="incremental" value="no"/>
    </parameters>

let $repair     := repair:clean-all()
let $repair     := repair:repair()
let $repair     := system:trigger-system-task("org.exist.storage.ConsistencyCheckTask", $params)

return <done/>
  • When the ‘eval’ action is completed, eXide should output: <done/> in the results panel down below.
  • After the action is completed, log in via SSH and check whether the backup is successful (replace <datetime> with current date and export time:

less /usr/local/exist_atp/webapp/WEB-INF/data/export/report-<datetime>.log

  • Example of a backup report with no errors (database is consistent):
   COLLECTION: /db
   COLLECTION: /db/apps
   ...
   COLLECTION: /db/system/security/exist/groups
   COLLECTION: /db/system/security/exist/groups/removed
   DOCUMENT: 1000 of 3058
   DOCUMENT: 2000 of 3058
   DOCUMENT: 3000 of 3058
   DOCUMENT: 3058 of 3058

Example of a backup with errors (database is not consistent):

   ...
   DOCUMENT: 6000 of 23816
   ----------------------------------------------
   ERR_NODE_TYPE:
   Wrong number of attributes. Expected: 3; found: 4
   Document ID: 11894
   DOCUMENT: 7000 of 23816
   ...
  • The backup will be created at the following location on the server:

/usr/local/exist_atp/webapp/WEB-INF/data/export/full-<datetime>.zip

This is a zipped archive of all the database contents under /db