Creating Backups

When you store important information in a Freeze database environment, you should consider regularly backing up the database environment.

There are two forms of backups: cold backups, where you just copy your database environment directory while no application is using these files (very straightforward), and hot backups, where you backup a database environment while an application is actively reading and writing data.

In order to perform a hot backup on a Freeze environment, you need to configure this Freeze environment with two non-default settings:

  • Freeze.DbEnv.envName.OldLogsAutoDelete=0
    This instructs Freeze to keep old log files instead of periodically deleting them. This setting is necessary for proper hot backups; it implies that you will need to take care of deleting old files yourself (typically as part of your periodic backup procedure).
  • Freeze.DbEnv.envName.DbPrivate=0
    By default, Freeze is configured with DbPrivate set to 1, which means only one process at a time can safely access the database environment. When performing hot backups, you need to access this database environment concurrently from various Berkeley DB utilities (such as db_archive or db_hotbackup), so you need to set this property to 0.

The Freeze/backup C++ demo shows one way to perform such backups and recovery. Please consult the Berkeley DB documentation for further details.

See Also