Loading TOC...

admin.databaseDailyBackup

admin.databaseDailyBackup(
   backup-dir as String,
   backup-period as Number,
   start-time as (Number|String),
   max-backups as (Number|String),
   backup-security-db as Boolean,
   backup-schemas-db as Boolean,
   backup-triggers-db as Boolean,
   [include-replicas as Boolean],
   [journal-archiving as Boolean?],
   [journal-archive-path as String?],
   [lag-limit as (Number|String)?]
) as element(db.databaseBackup)

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.databaseAddBackup will return a configuration object.

Example


const admin = require('/MarkLogic/admin.xqy');
const config = admin.getConfiguration();
const database = xdmp.database('Documents');
const backup = admin.databaseDailyBackup('/backup-dir', 2,
      '19:45:00',10,true,true,true);

admin.databaseAddBackup(config, database, backup)
// Returns the new configuration element -- use admin.saveConfiguration to save
// the changes to the configuration or pass the configuration to other Admin API
// functions to make other changes.
 

Example


const admin = require('/MarkLogic/admin.xqy');
const config = admin.getConfiguration();
const database = xdmp.database('Meters');
const backup = admin.databaseDailyBackup('/backup-dir2', 2,
      '01:00:00',8,false,false,false,false,true,'/journals/archives');

admin.databaseAddBackup(config, database, backup)
// Returns the new configuration element -- use admin.saveConfiguration 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.