Here there are the commands for copying and restoring the database of an OpenMRS Standalone 2.10.0 server.
All this procedure can also be done remotely following same steps.
First of all, do a dump of the MySQL database:
- [user] --> The user name of the embedded MySQL server (by default it is openmrs)
- [port] --> The port used by the MySQL server
- [@IP] --> The @IP of the server. If you are on a local installation, use loopback address (127.0.0.1)
For more info referring to the backup process, please check MySQL backup page.
Now copy the /appdata directory:
More info about appdata directory can be found in Application Data Directory page.
And that’s all! There is a script which automatizes all this procedure.
In this script, there is also a log of the back up routine, which is sent to another machine via scp.
Making backups periodically
For making new backups periodically we use cron.
Execute crontab -e
A sample command to execute the script file at 5:00 am once a week would be:
For the restoration procedure follow thse steps:
Start the server:
Import the last backup database into the MySQL server installation:
Stop the server.
- Restore the appdata directory. Remove the current one and replace it with the 'backupped' one.
- Start the server again. It will be started in maintenance mode:
Log in with your user and password (by default, User: admin Password:Admin123). Now, a new screen will be opened. In this screen there will be the concepts and databases to be updated. Just click in the green arrow at the bottom on the page and wait for it to finish.
That is all you need to make periodically backups and database restorations.
Backup and Restoration of the Shared Health Record