5.16. History database backup


To mitigate the risk of losing email history and quarantine data, Email Gateway Security automatically takes backup of the email history database.


The backup is taken in the beginning of the database optimization process that is executed at the time configured by the scheduled_db_optimization_time registry option.

For registry configuration details see 4.1. Registry configuration.

Backup folder and file




Backup folder

<installation directory>\data\backup

C:\Program Files\OPSWAT\MetaDefender Email Security\data\backup

Backup file name




A full path to a default email history database file is:
C:\Program Files\OPSWAT\MetaDefender Email Security\data\backup\mdemailsecurity.db.sqlite.bak

Backup retention

Only the last successful backup file is kept in the backup folder.


To restore the email history database backup, perform the following steps:

  1. Stop the MetaDefender Email Gateway Security Database Server service

    net stop mdemailsecurity-database
  2. Overwrite the current email history database file with the email history database backup file

    copy /y <path to backup file> <installation directory>\data\mdemailsecurity.db.sqlite
    1. Example with default values:

      copy /y "C:\Program Files\OPSWAT\MetaDefender Email Security\data\backup\mdemailsecurity.db.sqlite.bak" "C:\Program Files\OPSWAT\MetaDefender Email Security\data\mdemailsecurity.db.sqlite"
  3. Start the MetaDefender Email Gateway Security Database Server service and the MetaDefender Email Gateway Security service

    net start mdemailsecurity-database
    net start mdemailsecurity