Data backup and recovery is the process of backing up your data in the event of a data loss and setting up secure systems that allow you to recover your data as a result. Having a backup and recovery plan is important because unexpected events may occur that can compromise data.
OrangeHRM recommends that you back up your server on a regular basis. The ideal retention period is 4 weeks.
It is recommended that file-level backups and MariaDB/MySQL backups be performed separately as this will make the data recovery process easier. Please contact the OrangeHRM support team to obtain the backup script and restore any backups as needed.
How to check the OrangeHRM database name?
- Go to the OrangeHRM installation directory
- Database information consists in the below location inside the codebase
How to get a Backup from the Command-Line with mysqldump command?
- mysqldump -u[user] -p -h localhost --triggers --routines --hex-blob [database_name] | sed 's/`prod_orangehrm`\.//g'>>[filename].sql
- mysqldump -u root -p -h localhost --triggers --routines --hex-blob prod_orangehrm | sed 's/`prod_orangehrm`\.//g'>> prod_orangehrm_bkp_20220802.sql
The OrangeHRM system, like any other computer system, is subject to failures but the data stored in them must be available as and when required. When a database fails it must possess the facilities for fast recovery. Below are some examples of system failures.
OrangeHRM recommends checking the backup files every six months in the UAT environment. If something goes wrong with the production system. Please make sure to contact the OrangeHRM support team.
How to restore the backup on the UAT environment?
Please test this in the UAT environment
1. Check the size of the database backup file and make sure the backup is successfully completed
- Go to the command line
- Locate the backup directory
- User the below command to check the file size : ls -ltr finame.sql
2. Move the backup file to the UAT environment using the SCP or file transfer software
scp source_file_name username@destination_host:destination_folder
3. log in to the UAT server
4. Go to the backup location
5. Check the OrangeHRM database name (Refer #2 in How to check the OrangeHRM database name? section)
6. Login to the mysql/MariaDB database command-line
mysql -u root -p
7. Drop the existing database
drop database db-name;
*db-name - UAT database name should be added to the above command
8. Create an empty database with same name in Step 7
create database db-name;
9. Source the backup database to the empty database created on the previous step
10. Login to the UAT system and make sure the system is working properly