Loading TOC...

xdmp.databaseRestore

xdmp.databaseRestore(
   $forestIDs as (Number|String)[],
   $pathname as String,
   [$restoreToTime as Date?],
   [$journal-archiving as Boolean?],
   [$journal-archive-path as String?],
   [$incremental-backup as Boolean?],
   [$incremental-backup-path as String?],
   [$backup-passphrase as String?],
   [$forest-map as Object?]
) as (Number|String)

Summary

Starts an asynchronous restore of the specified list of destination forests from the backup data directory. Returns a job ID that uniquely identifies the restore task.

Parameters
$forestIDs A sequence of destination forest IDs.
$pathname A backup data directory pathname.
$restoreToTime The date and time to restore the forest data to.
$journal-archiving Whether to restore from archived journals. Defaults to false.
$journal-archive-path Path to where archived journals are stored. Defaults to the backup data directory.
$incremental-backup Whether to restore using incremental backups. Defaults to false.
$incremental-backup-path Path to where incremental backups are stored. Defaults to the backup data directory.
$backup-passphrase An additional backup passphrase that can be used to restore from backup.
$forest-map An optional forest map that specify the change of forest topology.

Required Privileges

This operation requires at least one of the following privileges:

http://marklogic.com/xdmp/privileges/xdmp-database-restore

http://marklogic.com/xdmp/privileges/xdmp-database-restore/database/{id}

Usage Notes

Reindexing will stop while a backup or restore is in progress.

All forests in forestIDs must exist in the current configuration.

$forest-map is a map from the names of destination forests to be restored to the names of backup forests (fd1<-fb1, fd2<-fb2, ...). Please note that there are several constraints on the map:

Example

xdmp.databaseRestore([11183608861595735720,898513504988507762],
  "/backups/Data")
=> 33030877979801813489

Example

const map = {
    fd1: xdmp.arrayValues(["fb1"]),
    fd2: xdmp.arrayValues(["fb2"]),
    fd3: xdmp.arrayValues(["fb3"])
};
xdmp.databaseRestore(
  xdmp.databaseForests(xdmp.database("db")), "/backups/Data", null, false, "",
    false, "", "", map);
=> 33030877979801813489

Example

const map = {
    fd1: xdmp.arrayValues(["fb1","fb2"]),
    fd2: xdmp.arrayValues(["fb3"]),
    fd3: xdmp.arrayValues([]),
    fd4: xdmp.arrayValues([])
};
xdmp.databaseRestore(
  xdmp.databaseForests(xdmp.database("db")), "/backups/Data", null, false, "",
    false, "", "", map);
=> 33030877979801813489

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