Alex W
Alex W

Reputation: 3373

How to clone a MarkLogic database

I tried the following xquery example but it seems to be only returning a configuration script and not actually creating the NewDB on the server. What are the steps to actually create the DB and forest?

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-copy($config, xdmp:database("ExistingDB"), "NewDB")

Upvotes: 3

Views: 280

Answers (1)

Dave Cassel
Dave Cassel

Reputation: 8422

The missing step is to call admin:save-configuration(). Most of the admin function help you set up a revised configuration, with the idea that you'll apply all changes at once by calling the above function.

Additional reference: General Steps for Scripting Administrative Tasks -- part of the Scripting Administrative Tasks Guide

Upvotes: 2

Related Questions