# Database Backup and Restore Periodically backing up the database is very essential, as it helps you restore OpUtils' service back during planned maintenance as well as unplanned mishaps. ## Backup - Open command prompt with administrative privileges and go to `/bin/backup` directory. - Execute `BackupDB.bat` (use `BackupDB.sh` for Linux) from the command prompt as shown: `/bin/backup>BackupDB.bat` - Enter the password as per the given instructions (backup passwords will not be stored anywhere, so users must ensure they remember the passwords). - Provide the password hint (optional). - The backup process will begin. - The backup file created will be stored in `\backup` directory. - To store in a different destination use the command given here: `BackupDB.bat -destination ""` (Eg: `BackupDB.bat -destination "C:\Backup"`). - Please ensure to store the backup file in a different directory and not in OpUtils' home or sub directories. However, you can use `/backup` directory to store the backup file. **Note:** This utility does a backup of the complete database. ## Restoration Please note that starting from version 12.8.510, the supported backup file extension has been **changed from .zip to .7z**. To restore the backed up data: 1. Open command prompt with administrative privileges and go to `/bin/backup` directory. 2. Execute `RestoreDB.bat` (use `RestoreDB.sh` for Linux) with the backup file name as argument from the command prompt as shown below: - `/bin/backup>RestoreDB.bat ""` (Eg: `RestoreDB.bat "C:\backup\Backup_Pgsql_Mar8_125128_123313.7z"`) 3. Enter the password for the backup 7z file. 4. The restoration process will begin. **Note:** 1. **Steps to restore data for MSSQL database:** - **In Windows:** Find the files `bcp.exe` and `bcp.rll` in MSSQL server and ensure to copy it to `OpUtilsHome\bin` folder. If the MSSQL server is installed on a 64-bit OS, and OpUtils is installed on a 32-bit server, the `bcp.exe` and `bcp.rll` copied from the MSSQL server will not work on the OpUtils machine. You'll need a 32-bit `bcp.exe` and `bcp.rll`. - **In Linux:** Copy the `bcp` and `bcp.rll` files from the subfolders of `/opt/mssql-tools/` directory. If the files are missing in the `mssql-tools` folder, or the folder itself is missing, please refer to [this link](https://www.manageengine.com/products/oputils/help/system-requirements.html#bcp-linux) for more details. 2. The backup files taken during the upgrade process cannot be restored.