MarkLogic 12 EA 1 Product Documentation
xdmp:database-restore-validate

xdmp:database-restore-validate(
   $forestIDs as xs:unsignedLong*,
   $pathname as xs:string,
   [$restoreToTime as xs:dateTime?],
   [$include-replicas as xs:boolean?],
   [$journal-archiving as xs:boolean?],
   [$journal-archive-path as xs:string?],
   [$incremental-backup as xs:boolean?],
   [$incremental-backup-path as xs:string?],
   [$backup-passphrase as xs:string?],
   [$forest-map as map:map?]
) as element()

Summary

Validates that the specified list of destination forests can be restored from the backup data directory. Returns a database restore set node.

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.
include-replicas Whether to include replica forests
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 backup passphrase that can be used to decrypt this backup.
forest-map An optional forest map that specify the change if forest topology.

Required Privileges

This operation requires at least one of the following privileges:

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

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

Example

xdmp:database-restore-validate((11183608861595735720,898513504988507762),
    "/backups/Data")
=> ..database restore set node
<bp:backup-plan xsi:schemaLocation="http://marklogic.com/xdmp/backup-plan
  backup-plan.xsd" xmlns:bp="http://marklogic.com/xdmp/backup-plan"
  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
  <bp:taginfo>
    <bp:version>8.0-20141030</bp:version>
    <bp:jobid>10780760300302561575</bp:jobid>
    <bp:startdate>2014-10-31T14:52:11</bp:startdate>
    <bp:enddate>2014-10-31T14:52:19</bp:enddate>
  </bp:taginfo>
  <bp:forest>
    <bp:forest-name>bill</bp:forest-name>
    <bp:forest-id>7201957734358937355</bp:forest-id>
    <bp:forest-status>okay</bp:forest-status>
    <bp:directory-path>/space/Backups/20141031-1452115365630</bp:directory-path>
    <bp:directory-status>okay</bp:directory-status>
    <bp:action>restore</bp:action>
    <bp:incremental-backup>false</bp:incremental-backup>
    <bp:journal-archiving>false</bp:journal-archiving>
  </bp:forest>
  <bp:database>
    <bp:database-name>bill</bp:database-name>
    <bp:database-id>16618783434388932604</bp:database-id>
    <bp:assignment-policy-name>bucket</bp:assignment-policy-name>
    <bp:database-forests>
      <bp:database-forest>
        <bp:forest-name>bill</bp:forest-name>
        <bp:forest-id>7201957734358937355</bp:forest-id>
      </bp:database-forest>
    </bp:database-forests>
  </bp:database>
</bp:backup-plan>

Example

(: database-restore-validate with incremental backup :)
xdmp:database-restore-validate(
xdmp:database-forests(xdmp:database("db1")),
"/space/backup", (), fn:false(),
fn:false(),(),
fn:true(),())
=> ..database restore set node
<bp:backup-plan xsi:schemaLocation="http://marklogic.com/xdmp/backup-plan backup-plan.xsd" xmlns:bp="http://marklogic.com/xdmp/backup-plan" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
  <bp:taginfo>
    <bp:version>9.0-20171103</bp:version>
    <bp:jobid>897252092727381381</bp:jobid>
    <bp:startdate>2017-11-03T13:38:42</bp:startdate>
    <bp:enddate>2017-11-03T13:38:43</bp:enddate>
  </bp:taginfo>
  <bp:forest>
    <bp:forest-name>forest1</bp:forest-name>
    <bp:forest-id>172083195763380802</bp:forest-id>
    <bp:forest-status>okay</bp:forest-status>
    <bp:directory-path>/space/backup/20171103-1337145777320</bp:directory-path>
    <bp:directory-status>okay</bp:directory-status>
    <bp:action>restore</bp:action>
    <bp:backup-timestamp>15097414345777320</bp:backup-timestamp>
    <bp:incremental-backup>true</bp:incremental-backup>
    <bp:incremental-directory-path>/space/backup/20171103-1337145777320/20171103/1338338439870</bp:incremental-directory-path>
    <bp:incremental-directory-path-status>okay</bp:incremental-directory-path-status>
    <bp:incremental-backup-timestamp>15097415138439870</bp:incremental-backup-timestamp>
    <bp:incremental-min-query-timestamp>15097409220413550</bp:incremental-min-query-timestamp>
    <bp:journal-archiving>false</bp:journal-archiving>
  </bp:forest>
  <bp:forest>
    <bp:forest-name>forest2</bp:forest-name>
    <bp:forest-id>7765837070180252819</bp:forest-id>
    <bp:forest-status>okay</bp:forest-status>
    <bp:directory-path>/space/backup/20171103-1337145777320</bp:directory-path>
    <bp:directory-status>okay</bp:directory-status>
    <bp:action>restore</bp:action>
    <bp:backup-timestamp>15097414345777320</bp:backup-timestamp>
    <bp:incremental-backup>true</bp:incremental-backup>
    <bp:incremental-directory-path>/space/backup/20171103-1337145777320/20171103/1338338439870</bp:incremental-directory-path>
    <bp:incremental-directory-path-status>okay</bp:incremental-directory-path-status>
    <bp:incremental-backup-timestamp>15097415138439870</bp:incremental-backup-timestamp>
    <bp:incremental-min-query-timestamp>15097409220413550</bp:incremental-min-query-timestamp>
    <bp:journal-archiving>false</bp:journal-archiving>
  </bp:forest>
  <bp:forest>
    <bp:forest-name>forest3</bp:forest-name>
    <bp:forest-id>8801375350195007054</bp:forest-id>
    <bp:forest-status>okay</bp:forest-status>
    <bp:directory-path>/space/backup/20171103-1337145777320</bp:directory-path>
    <bp:directory-status>okay</bp:directory-status>
    <bp:action>restore</bp:action>
    <bp:backup-timestamp>15097414345777320</bp:backup-timestamp>
    <bp:incremental-backup>true</bp:incremental-backup>
    <bp:incremental-directory-path>/space/backup/20171103-1337145777320/20171103/1338338439870</bp:incremental-directory-path>
    <bp:incremental-directory-path-status>okay</bp:incremental-directory-path-status>
    <bp:incremental-backup-timestamp>15097415138439870</bp:incremental-backup-timestamp>
    <bp:incremental-min-query-timestamp>15097409220413550</bp:incremental-min-query-timestamp>
    <bp:journal-archiving>false</bp:journal-archiving>
  </bp:forest>
  <bp:database>
    <bp:database-name>db1</bp:database-name>
    <bp:database-id>10598856079264601200</bp:database-id>
    <bp:assignment-policy-name>bucket</bp:assignment-policy-name>
    <bp:database-forests>
      <bp:database-forest>
	<bp:forest-name>forest1</bp:forest-name>
	<bp:forest-id>172083195763380802</bp:forest-id>
      </bp:database-forest>
      <bp:database-forest>
	<bp:forest-name>forest2</bp:forest-name>
	<bp:forest-id>7765837070180252819</bp:forest-id>
      </bp:database-forest>
      <bp:database-forest>
	<bp:forest-name>forest3</bp:forest-name>
	<bp:forest-id>8801375350195007054</bp:forest-id>
      </bp:database-forest>
    </bp:database-forests>
  </bp:database>
</bp:backup-plan>

Example

xquery version "1.0-ml";

let $map := map:new((
  map:entry("forest1", ("forest2","forest3")),
  map:entry("forest2", ("forest1")),
  map:entry("forest3", ())
))
return xdmp:database-restore-validate(
xdmp:database-forests(xdmp:database("db1")),
"/space/backup", (),
fn:false(),
fn:false(),(),
fn:true(),(),
"",$map
)
=> ..database restore set node
<bp:backup-plan xsi:schemaLocation="http://marklogic.com/xdmp/backup-plan backup-plan.xsd" xmlns:bp="http://marklogic.com/xdmp/backup-plan" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
  <bp:taginfo>
    <bp:version>9.0-20171103</bp:version>
    <bp:jobid>897252092727381381</bp:jobid>
    <bp:startdate>2017-11-03T13:38:42</bp:startdate>
    <bp:enddate>2017-11-03T13:38:43</bp:enddate>
  </bp:taginfo>
  <bp:forest>
    <bp:forest-name>forest1</bp:forest-name>
    <bp:forest-id>172083195763380802</bp:forest-id>
    <bp:forest-status>okay</bp:forest-status>
    <bp:directory-path>/space/backup/20171103-1337145777320</bp:directory-path>
    <bp:directory-status>okay</bp:directory-status>
    <bp:action>restore</bp:action>
    <bp:backup-timestamp>15097414345777320</bp:backup-timestamp>
    <bp:incremental-backup>true</bp:incremental-backup>
    <bp:incremental-directory-path>/space/backup/20171103-1337145777320/20171103/1338338439870</bp:incremental-directory-path>
    <bp:incremental-directory-path-status>okay</bp:incremental-directory-path-status>
    <bp:incremental-backup-timestamp>15097415138439870</bp:incremental-backup-timestamp>
    <bp:incremental-min-query-timestamp>15097409220413550</bp:incremental-min-query-timestamp>
    <bp:journal-archiving>false</bp:journal-archiving>
    <bp:backup-forests>
      <bp:backup-forest>
	<bp:forest-name>forest2</bp:forest-name>
	<bp:directory-status>okay</bp:directory-status>
      </bp:backup-forest>
      <bp:backup-forest>
	<bp:forest-name>forest3</bp:forest-name>
	<bp:directory-status>okay</bp:directory-status>
      </bp:backup-forest>
    </bp:backup-forests>
  </bp:forest>
  <bp:forest>
    <bp:forest-name>forest2</bp:forest-name>
    <bp:forest-id>7765837070180252819</bp:forest-id>
    <bp:forest-status>okay</bp:forest-status>
    <bp:directory-path>/space/backup/20171103-1337145777320</bp:directory-path>
    <bp:directory-status>okay</bp:directory-status>
    <bp:action>restore</bp:action>
    <bp:backup-timestamp>15097414345777320</bp:backup-timestamp>
    <bp:incremental-backup>true</bp:incremental-backup>
    <bp:incremental-directory-path>/space/backup/20171103-1337145777320/20171103/1338338439870</bp:incremental-directory-path>
    <bp:incremental-directory-path-status>okay</bp:incremental-directory-path-status>
    <bp:incremental-backup-timestamp>15097415138439870</bp:incremental-backup-timestamp>
    <bp:incremental-min-query-timestamp>15097409220413550</bp:incremental-min-query-timestamp>
    <bp:journal-archiving>false</bp:journal-archiving>
    <bp:backup-forests>
      <bp:backup-forest>
	<bp:forest-name>forest1</bp:forest-name>
	<bp:directory-status>okay</bp:directory-status>
      </bp:backup-forest>
    </bp:backup-forests>
  </bp:forest>
  <bp:forest>
    <bp:forest-name>forest3</bp:forest-name>
    <bp:forest-id>8801375350195007054</bp:forest-id>
    <bp:forest-status>okay</bp:forest-status>
    <bp:directory-path>/space/backup/20171103-1337145777320</bp:directory-path>
    <bp:directory-status>okay</bp:directory-status>
    <bp:action>restore</bp:action>
    <bp:backup-timestamp>15097414345777320</bp:backup-timestamp>
    <bp:incremental-backup>true</bp:incremental-backup>
    <bp:incremental-directory-path>/space/backup/20171103-1337145777320/20171103/1338338439870</bp:incremental-directory-path>
    <bp:incremental-directory-path-status>okay</bp:incremental-directory-path-status>
    <bp:incremental-backup-timestamp>0</bp:incremental-backup-timestamp>
    <bp:incremental-min-query-timestamp>0</bp:incremental-min-query-timestamp>
    <bp:journal-archiving>false</bp:journal-archiving>
    <bp:backup-forests/>
  </bp:forest>
  <bp:database>
    <bp:database-name>db1</bp:database-name>
    <bp:database-id>10598856079264601200</bp:database-id>
    <bp:assignment-policy-name>bucket</bp:assignment-policy-name>
    <bp:database-forests>
      <bp:database-forest>
	<bp:forest-name>forest1</bp:forest-name>
	<bp:forest-id>172083195763380802</bp:forest-id>
      </bp:database-forest>
      <bp:database-forest>
	<bp:forest-name>forest2</bp:forest-name>
	<bp:forest-id>7765837070180252819</bp:forest-id>
      </bp:database-forest>
      <bp:database-forest>
	<bp:forest-name>forest3</bp:forest-name>
	<bp:forest-id>8801375350195007054</bp:forest-id>
      </bp:database-forest>
    </bp:database-forests>
  </bp:database>
</bp:backup-plan>
Powered by MarkLogic Server | Terms of Use | Privacy Policy