MAN page from CentOS 8 libdb-utils-5.3.28-42.el8_4.x86_64.rpm
Section: BerkeleyDB Utilities (1)
Updated: 06 December 2016Index
db_hotbackup - Create "hot backup" or "hot failover" snapshots
[-cDEguVv] [-d data_dir
...] [-h home
] [-l log_dir
] -b backup_dir
utility creates "hot backup" or "hot failover" snapshots of Berkeley DB database environments.
The db_hotbackup utility performs the following steps:
- Sets the DB_HOTBACKUP_IN_PROGRESS flag in the home database environment.
- If the -c option is specified, checkpoint the source home databaseenvironment, and remove any unnecessary log files.
- If the target directory for the backup does not exist, it is created with moderead-write-execute for the owner.
If the target directory for the backup does exist and the -u option wasspecified, all log files in the target directory are removed; if the -u optionwas not specified, all files in the target directory are removed.
- If the -u option was not specified, copy application-specific files found inthe database environment home directory, or any directory specified using the-d option, into the target directory for the backup.
- Copy all log files found in the directory specified by the -l option (or in thedatabase environment home directory, if no -l option was specified), into thetarget directory for the backup.
- Perform catastrophic recovery on the hot backup.
- Remove any unnecessary log files from the hot backup.
- Reset the DB_HOTBACKUP_IN_PROGRESS flag in the environment.
The db_hotbackup utility does not resolve pending transactions that are in theprepared state. Applications that use DB_TXN->prepare should specifyDB_RECOVER_FATAL when opening the environment, and run DB_ENV->txn_recover toresolve any pending transactions, when failing over to the hot backup.
- -b backup_dir
- Specify the target directory for the backup.
- Before performing the snapshot, checkpoint the source database environmentand remove any log files that are no longer required in that environment.To avoid making catastrophic failure impossible, log file removalmust be integrated with log file archival.
- Use the data and log directories listed in a DB_CONFIG configuration filein the source directory. This option has four effects:
- The specified data and log directories will be created relative to the target directory,with mode read-write-execute owner, if they do not already exist.
- In step #3 above, all files in any source data directories specified in the DB_CONFIGfile will be copied to the target data directories.
- In step #4 above, log files will be copied from any log directory specified inthe DB_CONFIG file, instead of from the default locations.
- The DB_CONFIG configuration file will be copied from the source directoryto the target directory, and subsequently used for configuration if recovery is run in the target directory.
Care should be taken with the -D option where data and log directories are named relativeto the source directory but are not subdirectories (that is, the name includes the element "..")Specifically, the constructed target directory names must be meaningful and distinct from the source directory names,otherwise running recovery in the target directory might corrupt the source data files.
It is an error to use absolute pathnames for data or log directories in this mode,as the DB_CONFIG configuration file copied into the target directory would thenpoint at the source directories and running recovery would corrupt the source data files.
- -d data_dir
- Specify one or more source directories that contain databases; if noneis specified, the database environment home directory will be searchedfor database files. As database files are copied into a single backupdirectory, files named the same, stored in different source directories,could overwrite each other when copied into the backup directory.
- Directly copy from the filesystem. This option can CORRUPT the backupif used while the environment is active and the operating system does not support atomic file system reads.This option is known to be safe only on UNIX systems, not Linux or Windows systems.
- -h home
- Specify the source directory for the backup, that is, the databaseenvironment home directory.
- -l log_dir
- Specify a source directory that contains log files; if none is specified,the database environment home directory will be searched for log files.
- -P password
- Specify an environment password. Although Berkeley DB utilities overwritepassword strings as soon as possible, be aware there may be a window ofvulnerability on systems where unprivileged users can see command-linearguments or where utilities are not able to overwrite the memorycontaining the command-line arguments.
- Update a pre-existing hot backup snapshot by copying in new log files.If the -u option is specified, no databases will be copiedinto the target directory.
- Write the library version number to the standard output, and exit.
- Run in verbose mode, listing operations as they are done.
- Use the data directories listed in the DB_CONFIG configurationfile in the source directory. This option has three effects:First, if they do not already exist, the specified data directorieswill be created relative to the target directory (with mode read-write-executeowner). Second, all files in the source data directories will be copied tothe target data directories. If the DB_CONFIG file specifies oneor more absolute pathnames, files in those source directories will becopied to the top-level target directory. Third, the DB_CONFIG configurationfile will be copied from the +source directory to the target directory, andsubsequently used for configuration if recovery is run in the target directory.
Care should be taken with the -D option and data directorieswhich are named relative to the source directory but are notsubdirectories (that is, the name includes the element "..")Specifically, the constructed target directory names must be meaningfuland distinct from the source directory names, otherwise running recoveryin the target directory might corrupt the source data files.
It is an error to use absolute pathnames for data directoriesor the log directory in this mode, as the DB_CONFIG configurationfile copied into the target directory would then point at the sourcedirectories and running recovery would corrupt the source data files.
The db_hotbackup utility uses a Berkeley DB environment (as described for the-h option, the environment variable DB_HOME, orbecause the utility was run in a directory containing a Berkeley DBenvironment). In order to avoid environment corruption when using aBerkeley DB environment, db_hotbackup should always be given the chance todetach from the environment and exit gracefully. To cause db_hotbackupto release all environment resources and exit cleanly, send it aninterrupt signal (SIGINT).
utility exits 0 on success, and >0 if an error occurs.
- If the -h option is not specified and the environment variableDB_HOME is set, it is used as the path of the database home, as describedin DB_ENV->open.
- EXIT STATUS
- SEE ALSO
This document was created byman2html,using the manual pages.