db_hotbackup

db_hotbackup [-cDEguVv] [-d data_dir ...] [-h home] 
        [-l log_dir] [-P password] -b backup_dir  

The db_hotbackup utility creates "hot backup" or "hot failover" snapshots of Berkeley DB database environments. Hot backups can also be performed using the DbEnv::backup() or DbEnv::dbbackup() methods.

The db_hotbackup utility performs the following steps:

  1. Sets the DB_HOTBACKUP_IN_PROGRESS flag in the home database environment.

  2. If the -c option is specified, checkpoint the source home database environment, and remove any unnecessary log files.

  3. If the target directory for the backup does not exist, it is created with mode read-write-execute for the owner.

    If the target directory for the backup does exist and the -u option was specified, all log files in the target directory are removed; if the -u option was not specified, all files in the target directory are removed.

  4. If the -u option was not specified, copy application-specific files found in the database environment home directory, and any directories specified using the -d option, into the target directory for the backup.

  5. Copy all log files found in the directory specified by the -l option (or in the database environment home directory, if no -l option was specified), into the target directory for the backup.

  6. Perform catastrophic recovery in the target directory for the backup.

  7. Remove any unnecessary log files from the target directory for the backup.

  8. Reset the DB_HOTBACKUP_IN_PROGRESS flag in the environment.

The db_hotbackup utility does not resolve pending transactions that are in the prepared state. Applications that use DbTxn::prepare() must specify DB_RECOVER_FATAL when opening the environment, and run DbEnv::txn_recover() to resolve any pending transactions, when failing over to the backup.

The options are as follows:

The db_hotbackup utility uses a Berkeley DB environment (as described for the -h option, the environment variable DB_HOME, or because the utility was run in a directory containing a Berkeley DB environment). In order to avoid environment corruption when using a Berkeley DB environment, db_hotbackup should always be given the chance to detach from the environment and exit gracefully. To cause db_hotbackup to release all environment resources and exit cleanly, send it an interrupt signal (SIGINT).

The db_hotbackup utility exits 0 on success, and >0 if an error occurs.

Environment Variables

DB_HOME

If the -h option is not specified and the environment variable DB_HOME is set, it is used as the path of the database home, as described in the DbEnv::open() method.