Loading TOC...


   config as element(configuration),
   database-id as (Number|String),
   backup-id as (Number|String),
   enabled as Boolean
) as element(configuration)


This function enables database backup for the specified database.

config A configuration specification, typically as returned from one of the Admin module functions.
database-id The ID for the database (for example, xdmp:database ("myDatabase")).
backup-id The ID of the backup, found by XPath to the backup location(for example, //db:backup-id/).
enabled Sets the database backup to enabled. The default is true, which means the database backup will take place.

Required Privileges

This operation requires at least one of the following privileges:





xquery version "1.0-ml";

import module namespace admin = "http://marklogic.com/xdmp/admin"
      at "/MarkLogic/admin.xqy"
declare namespace db =  "http://marklogic.com/xdmp/database";

 let $backup-ids := admin:database-get-backups(
  admin:get-configuration(), xdmp:database("Documents"))//db:backup-id/fn:data()
 return admin:database-backup-set-enabled(admin:get-configuration(), xdmp:database("Documents"),
 $backup-ids, fn:true())

  (: returns the new configuration element -- use admin:save-configuration
     to save the changes to the configuration or pass the configuration
     to other Admin API functions to make other changes.  :)

Stack Overflow iconStack Overflow: Get the most useful answers to questions from the MarkLogic community, or ask your own question.