
sec:amps-change-modules-database( $old-db as xs:unsignedLong, $new-db as xs:unsignedLong ) as xs:unsignedLong*
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. | 
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: Get the most useful answers to questions from the MarkLogic community, or ask your own question.