Loading TOC...

MarkLogic 10 Product Documentation
admin:database-daily-backup

admin:database-daily-backup(
   $backup-dir as xs:string,
   $backup-period as xs:positiveInteger,
   $start-time as xs:time,
   $max-backups as xs:unsignedLong,
   $backup-security-db as xs:boolean,
   $backup-schemas-db as xs:boolean,
   $backup-triggers-db as xs:boolean,
   [$include-replicas as xs:boolean],
   [$journal-archiving as xs:boolean?],
   [$journal-archive-path as xs:string?],
   [$lag-limit as xs:unsignedLong?]
) as element(db:database-backup)

Summary

This function constructs a daily scheduled database backup specification.

Parameters
backup-dir The directory to save the backup.
backup-period The number of days to elapse between each backup.
start-time The time of day of the backup, in 24:00:00 notation.
max-backups The maximum number of backups to keep. When you reach the specified maximum number of backups, the next backup will delete the oldest backup. Specify 0 to keep an unlimited number of backups.
backup-security-db Whether to backup the security database alongside the current backup.
backup-schemas-db Whether to backup the schemas database alongside the current backup.
backup-triggers-db Whether to backup the triggers database alongside the current backup.
include-replicas If set to false, do not include the replicas in the backup. The default is true, which means to include all replicas in the backup.
journal-archiving Whether or not to enable journal archiving. Defaults to false.
journal-archive-path Path for where archived journals are stored. Defaults to the backup data directory.
lag-limit Maximum difference in seconds that the archived journal can lag behind its forest's active journal. Defaults to 900.

Usage Notes

Using this function in conjunction with admin:database-add-backup will return a configuration object.

Example


  xquery version "1.0-ml";

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

  let $config := admin:get-configuration()
  return
   admin:database-daily-backup("/backup-dir", 2,
      xs:time("19:45:00"),10,true(),true(),true())

  (: returns the daily database backup specification :)
   

Example


xquery version "1.0-ml";
import module namespace admin = "http://marklogic.com/xdmp/admin"
    at "/MarkLogic/admin.xqy";

let $config := admin:get-configuration()
let $database := xdmp:database("Documents")
let $backup :=
 admin:database-daily-backup("/backup-dir", 2,
    xs:time("19:45:00"),10,true(),true(),true())

return
  admin:database-add-backup($config, $database, $backup)
  (: 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.  :)
   

Example


  xquery version "1.0-ml";
  import module namespace admin = "http://marklogic.com/xdmp/admin"
      at "/MarkLogic/admin.xqy";
  let $config := admin:get-configuration()
  return
   admin:database-daily-backup("/backup-dir", 2,
      xs:time("19:45:00"),10,true(),true(),true(),false(),true(),(),500)
  (: returns the daily database backup specification :)
   

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