Loading TOC...

admin:database-copy

admin:database-copy(
   config as element(configuration),
   database-id as xs:unsignedLong,
   database-name as xs:string
) as element(configuration)

Summary

This function creates a new database specification with the same settings as the database with the specified ID. The new database configuration will have the specified name.

Parameters
config A configuration specification, typically as returned from one of the Admin module functions.
database-id The ID of the database to copy (for example, xdmp:database("myDatabase")).
database-name The name of the new database to create.

Required Privileges

http://marklogic.com/xdmp/privileges/admin/database

Example


  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("myOldDatabase"),
                    "myNewDatabase")

   => Creates a configuration with a new database specification
      having the same settings as the database named "myOldDatabase".
      Use admin:save-configuration 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.