At some point you might need to move your UVexplorer Server database from one MongoDB instance to another MongoDB instance. This article explains how this can be done.


The basic approach is:


1. Backup your UVexplorer Server database on the machine running the origin MongoDB instance.


2. Copy the backup files to the machine running the target MongoDB instance.


3. Restore the backup files into the target MongoDB instance.


The specific steps are listed below.  In these steps you will use the following MongoDB tools which are located in the "bin\" folder within your MongoDB installation:


\Program Files\MongoDB\Server\x.y\bin\mongo.exe

\Program Files\MongoDB\Server\x.y\bin\mongodump.exe

\Program Files\MongoDB\Server\x.y\bin\mongorestore.exe


where "x.y" is the version of MongoDB you are using.


These instructions assume they are operating on the local MongoDB instance running on the default port 27017.


1. Backup Origin UVexplorer Server Database


To backup the origin UVexplorer Server database, run the following commands on the origin machine:


1. Create an empty folder where the backup data will be stored (called<backup-folder> below).


2. Run the following command:


        mongodump.exe --db=uvexplorer --out=<backup-folder> 


3. This will store the backup files in<backup-folder>.


2. Copy the backup folder and its contents from the origin machine to the target machine.


3. Restore Backup into Target MongoDB Instance


To restore the backup of the origin database into the target MongoDB instance, run the following commands on the machine running the target database:


1. Stop UVexplorer Server by selecting the "UVexplorer Server 2.0\Stop UVexplorer Server" item in the Windows Start Menu.


2. Delete the existing data in the target database by running the following command:


        mongo.exe uvexplorer --eval "db.dropDatabase()"


3. Restore the data from the origin backup by running the following command (where <backup-folder> is the folder on the target machine containing the backup files copied from the origin machine):


        mongorestore.exe --db=uvexplorer <backup-folder>


4. Restart your UVexplorer Server by selecting the "UVexplorer Server 2.0\Start UVexplorer Server" item in the Windows Start Menu.