xdmp.databaseRestoreValidate( forestIDs as (Number|String)[], pathname as String, [restoreToTime as Date?], [include-replicas as Boolean?], [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 Object
Validates that the specified list of destination forests can be restored from the backup data directory. Returns a database restore set node.
http://marklogic.com/xdmp/privileges/xdmp-database-restore-validate
http://marklogic.com/xdmp/privileges/xdmp-database-restore-validate/database/{id}
xdmp.databaseRestoreValidate( xdmp.databaseForests( xdmp.database("MyDB")), // previously backed-up dir "/tmp/database_backup" ) => { "tagInfo": { "version": "8.0-20141119", "jobid": "1975326905393827288", "startdate": "2014-11-19T10:37:37", "enddate": "2014-11-19T10:37:38" } , "forests": [ { "forestName": "forest1", "forestId": "12393306467180079458", "forestStatus": "okay", "directoryPath": "/tmp/database_backup/20141119-1037377997450", "directoryStatus": "okay", "action": "restore", "incrementalBackup": false, "journalArchiving": false "backupForests" : [ { "forestName": "foresta", "directoryStatus": "okay", } { "forestName": "forestb", "directoryStatus": "okay", } ] }, { "forestName": "forest2", "forestId": "2102578687500930109", "forestStatus": "okay", "directoryPath": "/tmp/database_backup/20141119-1037377997450", "directoryStatus": "okay", "action": "restore", "incrementalBackup": false, "journalArchiving": false } ], "databases": [ { "databaseName": "MyDB", "databaseId": "13433268924640794832", "assignmentPolicyName": "bucket", "databaseForests": [ { "forestName": "forest1", "forestId": "12393306467180079458" }, { "forestName": "forest2", "forestId": "2102578687500930109" } ] } ] }
const map = { forest1: xdmp.arrayValues(["forest2", "forest3"]), forest2: xdmp.arrayValues(["forest1"]), forest3: xdmp.arrayValues([]) }; xdmp.databaseRestoreValidate( xdmp.databaseForests(xdmp.database("db1")), "/space/tsoi/backup", null, true, false, "", true, "", "", map); => { "tagInfo": { "version": "9.0-20171103", "jobid": "897252092727381381", "startdate": "2017-11-03T13:38:42", "enddate": "2017-11-03T13:38:43" }, "forests": [ { "forestName": "forest1", "forestId": "172083195763380802", "forestStatus": "okay", "directoryPath": "/space/tsoi/backup/20171103-1337145777320", "directoryStatus": "okay", "action": "restore", "incrementalBackup": true, "incrementalDirectoryPath": "/space/tsoi/backup/20171103-1337145777320/20171103/1338338439870", "incrementalDirectoryPathStatus": "okay", "incrementalBackupTimestamp": "15097415138439870", "incrementalMinQueryTimestamp": "15097409220413550", "journalArchiving": false, "backupForests": [ { "forestName": "forest2", "directoryStatus": "okay" }, { "forestName": "forest3", "directoryStatus": "okay" } ] }, { "forestName": "forest2", "forestId": "7765837070180252819", "forestStatus": "okay", "directoryPath": "/space/tsoi/backup/20171103-1337145777320", "directoryStatus": "okay", "action": "restore", "incrementalBackup": true, "incrementalDirectoryPath": "/space/tsoi/backup/20171103-1337145777320/20171103/1338338439870", "incrementalDirectoryPathStatus": "okay", "incrementalBackupTimestamp": "15097415138439870", "incrementalMinQueryTimestamp": "15097409220413550", "journalArchiving": false, "backupForests": [ { "forestName": "forest1", "directoryStatus": "okay" } ] }, { "forestName": "forest3", "forestId": "8801375350195007054", "forestStatus": "okay", "directoryPath": "/space/tsoi/backup/20171103-1337145777320", "directoryStatus": "okay", "action": "restore", "incrementalBackup": true, "incrementalDirectoryPath": "/space/tsoi/backup/20171103-1337145777320/20171103/1338338439870", "incrementalDirectoryPathStatus": "okay", "incrementalBackupTimestamp": 0, "incrementalMinQueryTimestamp": 0, "journalArchiving": false, "backupForests": [ ] } ], "databases": [ { "databaseName": "db1", "databaseId": "10598856079264601200", "assignmentPolicyName": "bucket", "databaseForests": [ { "forestName": "forest1", "forestId": "172083195763380802" }, { "forestName": "forest2", "forestId": "7765837070180252819" }, { "forestName": "forest3", "forestId": "8801375350195007054" } ] } ] }
Stack Overflow: Get the most useful answers to questions from the MarkLogic community, or ask your own question.