Wiki Spaces

Documentation
Projects
Resources

Get Help from Others

Q&A: Ask OpenMRS
Discussion: OpenMRS Talk
Real-Time: IRC Chat | Slack

Documentation

Page tree
Skip to end of metadata
Go to start of metadata

Overview

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)!

[edit]

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.

[edit]

Backup settings

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

[edit]

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.

[edit]

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.

[edit]

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.

[edit]

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: http://openmrs.org/wiki/Quartz_Scheduler_User_Guide

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).

[edit]

Source Code

The source code is available at http://svn.openmrs.org/openmrs-modules/databasebackup/

[edit]

Release log

v0.8:

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

v0.7:

  • 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)

[edit]

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.

[edit]

Troubleshooting

If you have any problems or find a bug, please report to Mathias Lin via E-Mail mailto:mathias.lin@metahealthcare.com

3 Comments

  1. user-a471a

    Have any of the items on the To Do list been accomplished? This page would benefit from a technical explanation.

  2. IT would be a good thing to let this same module provide support for restoring from a previously saved backup

  3. user-a471a The tasks on the ToDo list are not yet accomplished. I see that some of the images on the wiki page aren't displayed properly anymore, maybe that's why it makes the documentation harder to understand. I wasn't able to follow the project over the past two years due to time constraints, not sure if there is meanwhile any built-in backup mechanism planned for OMRS 2.0 by default.