Database Backup Module


The Database Backup module allows to backup the database through the OpenMRS administration interface. You can choose which tables to include or exclude from the backup.

Note: It's currently only working with MySql database server (which is usually the default for OpenMRS)!


Download and Installation

After the installation is completed, you will find a new section named "Database Backup" in the Administration panel. From here you can access the backup settings and the backup execution page.


Backup settings

In the settings, you define which tables to include into the backup and where to store the backup.


Tables included/excluded

Enter the tables to be included into the backup comma separated (i.e.: cohort, concept) into field 'databasebackup.tablesIncluded' or use 'all' (default) to include all.

Enter the tables to be excluded from the backup comma separated (i.e.: hl7_in_archive, hl7_in_error) into field 'databasebackup.tablesExcluded' or use 'all' (default) to exclude all. If you don't want to exclude any tables, you could also leave it to the default value 'none'.

Explicitly entered table names overrule any eventual 'all' or 'none' entries in the opposite settings field.


Backup folder path

In field 'databasebackup.folderPath', you set the path to the backup folder. You can either enter an absolute path (i.e. 'C:/backup') or a relative path (i.e. like the default value 'backup') which is relative to the OpenMRS application data directory.


Backup execution

Hit the 'Execute database backup now' button to start the backup process. It will run as a background thread and might take a few seconds or minutes, depending on the size of your database. Meanwhile you can continue to work with OpenMRS.

The backup file will be generated as a zipped sql dump, placed into a subfolder named 'backup' under the OpenMRS app data folder on the server.

You will automatically be informed once the backup is finished and at which server path you can find it.


Scheduled Task

With the Quartz Scheduler module you can setup a scheduled task for the database backup. The 'task class' to select is org.openmrs.module.databasebackup.DatabaseBackupTask. Please follow the general guidelines how to setup a scheduled task from here:

You can set two optional user properties:

  • tablesIncluded: all, none, or <table_names> comma separated
  • tablesExcluded: all, none, or <table_names> comma separated

These two properties are optional, and if set, they override the settings of in the Database Backup module settings (which act as fallback in case you don't set user properties for the scheduled task).


Source Code

The source code is available at


Release log


  • added ability to setup the database backup as a scheduled task (via Quartz Scheduled Task module)


  • added missing information such as indexes, autoincrement values and constraints.
  • backup module is currently only available/working with MySql server
  • fixed encoding issue (export file is now UTF8 encoded)


ToDo list

  • enable download of backup files
  • make settings page / way to choose table easier (enhance GUI), i.e. w/ check boxes for all available tables or similar)
  • the tables are not being locked all in once during the backup process, therefore it's best to run the backup outside the regular working hours
  • allow incremental backup only for tables that have changed since the last update.



If you have any problems or find a bug, please report to Mathias Lin via E-Mail