Schedule Syracuse database backup

1 minute read time.

If you wish to take Sage X3 installed MongoDB Syracuse database backup and schedule it, you could perform the task in following steps.

Step 1. MongoDB tool “mongodump” setup

In the installed MongoDB folder, you should find MongoDB tools. In my case “mongodump” tool is in the below folder.

Include “mongodump” tool in server System environment path variable

Step 2: Backup batch file

In text editor create a text file with extension .bat with following command line syntax

 @ echo off

REM To create date folder 'DTF' formatting system date by separating it in Day / Month/ Year

SET dd=%date:~0,2%

SET mm=%date:~3,2%

SET yyyy=%date:~6,4%

SET DTF=%dd%-%mm%-%yyyy%

 

REM Before running backup setting Backup parameters as per MongoDB installation

REM 1.Hostnmae: "--host X3ERPV12VM "

REM 2 Port:  "--port 27017"

REM 3 Certificate details and location:  --ssl --sslPEMKeyFile "C:\Sage\Safex3\MongoDB\certs\client.pem" --sslPEMKeyPassword " " --sslCAFile "C:\Sage\Safex3\MongoDB\certs\ca.cacrt"

REM 4 MongoDB Database: "Syracuse"

Rem 5 Backup folder location: "--out X:\mongoback\%DTF%"

mongodump.exe --host W25-SQL22-X3V12 --port 27017 --ssl --sslPEMKeyFile "X:\Sage\WebComponents\MongoDB\certs\client.pem" --sslPEMKeyPassword " " --sslCAFile "X:\Sage\WebComponents\MongoDB\certs\ca.cacrt" --db syracuse --out X:\mongoback\%DTF%

@ echo "Backup successful"

Note:

 You may need to verify the date format of the server (based on regional setting) and make the changes in the date parameter for dd mm yyyy

Step 4: Verify backup

Run the batch file created above to verify is the backup is done without issue.

Ideally you should find the Syracuse backup inside current date folder in your designated folder location in the batch file

Step 5: Scheduling Syracuse database backup

 Open Task scheduler of the server where MongoDB is installed

A. Create Task

  • Specify Name of the task
  • Run with highest privileges

B. Set Trigger Tab

 Set the trigger as per your requirement

C. Action Tab

  • Action: Start a program
  • Program Script: Location of your backup batch file

D. Setting Tab

Verify condition and setting tab, leave default or change if necessary

         Select Ok and make sure you have User with appropriate windows rights who will run the task

Step 6 : Verify the schedule Job

Run the Schedule job manually to verify if the backup is done successfully

  • My process is:

    mongodump the current MongoDB database in case anything were to go south.

    Prepare a folder to be used as mongorestore target. From your old mongodump, put these two files here: `license.bson` and `license.metadata.json`.

    mongorestore from that folder.

    Turn off and turn on the `Sage X3 Syracuse Server` Windows service.

    On Sage X3 website as `admin` or `admin`-equivalent X3 user, check `Administration > License data` and confirm all the Sage X3 license and partner legislation license are there. 

  • Dropping additional note for future me reference considering I usually install MongoDB fresh first, mongorestore, and then install Syracuse fresh.
    Make sure to keep a mongodump before installing Syracuse fresh.

    During my Sage X3 migration work, I lost the license data of the partner legislations, some of which were defunct and lost in time due to Syracuse overwriting the `license` MongoDB's collection as part of fresh Syracuse installation procedure.

    I am currently testing and see if mongorestore the `license` collection would work.

  • Perfect! Now I can really see the benefit ! Excellent!

  • Hi

    Sorry, perhaps I was not detailed in my comment above.

    We expect the backup folder and subsequent backup files to be much larger as mongodump tool output the data into uncompressed BSON file, so it is expected the folder and the files to be much larger than compressed on disk as shown in “show dbs”.

    To reduce the space of the backup BASON files we could use –gzip option in mongodump tool.

    For instance,

    When I include –gzip in my syntax

    mongodump.exe --host W25-SQL22-X3V12 --port 27017 --ssl --sslPEMKeyFile "X:\Sage\WebComponents\MongoDB\certs\client.pem" --sslPEMKeyPassword " " --sslCAFile "X:\Sage\WebComponents\MongoDB\certs\ca.cacrt" --db syracuse --out X:\mongoback\%DTF% --gzip

    My previous date backup without compression is 36.2 MB for where my todays backup with g-zip compression 3.63 MB

    As indicated by Carl, after backup, the folder is compressed using 7Zip.

    I am interested to verify that if any specific file (collection(s) is exceptionally large in zipped format.

  • I understand that the "database can get quite big"
    For example, in a fresh installation with only the solution's setup, if you run a mongodump, you'll get no less than 300 MB of files. That's quite different from the 13 MB shown by the command you demonstrated