Examples
- Last Updated: April 14, 2026
- 1 minute read
- MarkLogic Server
- Version 12.0
- Documentation
This example copies all documents and their metadata from the source database to the destination database:
# Windows users, see Modifying the Example Commands for Windows
$ mlcp.sh copy -mode local -input_host srchost -input_port 8000 \
-input_username user1 -input_password password1 \
-output_host desthost -output_port 8010 -output_username user2 \
-output_password password2
This example copies selected documents, excluding the source permissions and adding the documents to 2 new collections in the destination database:
# Windows users, see Modifying the Example Commands for Windows
$ mlcp.sh copy -mode local -input_host srchost -input_port 8000 \
-input_username user1 -input_password password1 \
-output_host desthost -output_port 8000 -output_username user2 \
-output_password password2 -copy_permissions false \
-output_collections shakespeare,plays
This example copies data from one MarkLogic Server database to another while connecting through a reverse proxy:
# Windows users, see Modifying the Example Commands for Windows
$ mlcp.sh copy -mode local -input_host proxy.marklogic.com -input_port 8080 \
-input_username user1 -input_password password1 \
-input_base_path "/test/marklogic/app-services/" \
-output_host proxy.marklogic.com -output_port 8080 \
-output_username user2 -output_password password2 \
-output_base_path "/test/marklogic/mlcp/"
For an example of using -query_filter, see Example: Exporting Documents Matching a Query.
This example copies data between MarkLogic Server databases hosted on Progress Data Cloud:
# Windows users, see Modifying the Example Commands for Windows
$ mlcp.sh copy -mode local -input_host "cloud.marklogic.com" -input_port 443 \
-input_api_key "K3kiInmmnIV72pOCkHmWXg==" \
-input_base_path "/test/marklogic/input/" \
-output_host "cloud.marklogic.com" \
-output_port 443 \
-output_api_key "yquPg5b0PPN9n9FnEjPo3w==" \
-output_base_path "/test/marklogic/output/"