Loading TOC...

MarkLogic 10 Product Documentation
sec:amps-change-modules-database

sec:amps-change-modules-database(
   $old-db as xs:unsignedLong,
   $new-db as xs:unsignedLong
) as xs:unsignedLong*

Summary

This function changes all amps that refer to one modules database to refer to a different database. This is useful when using database replication for disaster recovery and a replica security database is being promoted to master during a disaster scenario.

Parameters
old-db The ID of the old modules database.
new-db The ID of the new modules database.

Usage Notes

WARNING: because this function changes the modules database IDs for all the amps stored in the security database, the amps will no longer work with the old modules database. If this is being done for the purpose of disaster recovery with a replica modules database, the change will need to be reversed when the original data center reclaims the role as master.

Example


xquery version "1.0-ml"; 
 
(: run this against the new security database :) 
import module namespace sec = "http://marklogic.com/xdmp/security" 
      at "/MarkLogic/security.xqy";

sec:amps-change-modules-database(
   xdmp:database("Security"),       
   xdmp:database("Security-replica"))       
(: changes the database ID for all of the amps in the system to make the 
   amps function correctly in a disaster recovery scenario.  :) 
    

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