DB_HOTBACKUP(1)
β¨ NAME β¨
db_hotbackup β makes "hot backup" or "hot failover" snapshots πΎπ (it's a Berkeley DB utility, section 1, bestie)
πΈ SYNOPSIS πΈ
db_hotbackup [-cDEguVv] [-d data_dir ...] [-h home] [-l log_dir] [-P
password] -b backup_dir
π DESCRIPTION π
okay so db_hotbackup creates "hot backup" or "hot failover" snapshots of Berkeley DB database environments. no cap, that's the whole vibe.
here's the tea β db_hotbackup does these steps, in this order, every single time:
- Sets the
DB_HOTBACKUP_IN_PROGRESSflag in the home database environment. π© - If the
-coption is specified, checkpoint the source home database environment, and remove any unnecessary log files. - 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. π (yes, ALL of them, be careful bestie)
- If the
-uoption was not specified, copy application-specific files found in the database environment home directory, or any directory specified using the-doption, into the target directory for the backup. - Copy all log files found in the directory specified by the
-loption (or in the database environment home directory, if no-loption was specified), into the target 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_PROGRESSflag in the environment. π
and a lil heads up: the db_hotbackup utility does not resolve pending transactions that are in the prepared state. applications that use DB_TXN->prepare should specify DB_RECOVER_FATAL when opening the environment, and run DB_ENV->txn_recover to resolve any pending transactions, when failing over to the hot backup. iykyk π«Ά
π OPTIONS π
-b backup_dirβ Specify the target directory for the backup. this one's the whole point, it's required, it's the main character.-cβ Before performing the snapshot, checkpoint the source database environment and remove any log files that are no longer required in that environment. To avoid making catastrophic failure impossible, log file removal must be integrated with log file archival. β οΈ like, that part is not optional, fr.-Dβ Use the data and log directories listed in aDB_CONFIGconfiguration file in 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 in the
DB_CONFIGfile, instead of from the default locations. - The
DB_CONFIGconfiguration file will be copied from the source directory to 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 relative to 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 then point 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 none is specified, the database environment home directory will be searched for database files. As database files are copied into a single backup directory, files named the same, stored in different source directories, could overwrite each other when copied into the backup directory. π¬ (name collisions are NOT the vibe)-Fβ Directly copy from the filesystem. This option can CORRUPT the backup if 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. ππ do not play with this one unless you know exactly what you're doing.-h homeβ Specify the source directory for the backup, that is, the database environment 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 overwrite password strings as soon as possible, be aware there may be a window of vulnerability on systems where unprivileged users can see command-line arguments or where utilities are not able to overwrite the memory containing the command-line arguments. π (yes, that's a real risk, ngl)-uβ Update a pre-existing hot backup snapshot by copying in new log files. If the-uoption is specified, no databases will be copied into the target directory.-Vβ Write the library version number to the standard output, and exit. ποΈ bye-vβ Run in verbose mode, listing operations as they are done. she's chatty and we love that β¨-Dβ Use the data directories listed in theDB_CONFIGconfiguration file in the source directory. This option has three effects: First, if they do not already exist, the specified data directories will be created relative to the target directory (with mode read-write-execute owner). Second, all files in the source data directories will be copied to the target data directories. If theDB_CONFIGfile specifies one or more absolute pathnames, files in those source directories will be copied to the top-level target directory. Third, theDB_CONFIGconfiguration file will be copied from the source directory to the target directory, and subsequently used for configuration if recovery is run in the target directory.
Care should be taken with the -D option and data directories which are named relative to 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 directories or the log directory in this mode, as the DB_CONFIG configuration file copied into the target directory would then point at the source directories 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, 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). π«Ά let her leave the party politely.
π EXIT STATUS π
The db_hotbackup utility exits 0 on success, and >0 if an error occurs.
π¦ ENVIRONMENT π¦
DB_HOMEβ If the-hoption is not specified and the environment variableDB_HOMEis set, it is used as the path of the database home, as described inDB_ENV->open.
π SEE ALSO π
db_archive(1) db_checkpoint(1) db_deadlock(1) db_dump(1) db_log_verify(1) db_load(1) db_printlog(1) db_recover(1) db_replicate(1) db_stat(1) db_tuner(1) db_upgrade(1) db_verify(1)
and that's the whole page, bestie π this was BerkeleyDB 5.3.28, dated 06 December 2016 β go forth and back up responsibly, periodt β¨ππ«Ά
π¦ where this page comes from
- centos-stream 9: libdb-utils 5.3.28-57.el9 Β· BSD and LGPLv2 and Sleepycat and MIT
- epel 10: libdb-utils 5.3.28-64.el10_0 Β· BSD-3-Clause AND LGPL-2.1-only AND Sleepycat
- fedora 43: libdb-utils 5.3.28-66.fc43 Β· BSD-3-Clause AND LGPL-2.1-only AND Sleepycat
- fedora 44: libdb-utils 5.3.28-67.fc44 Β· BSD-3-Clause AND LGPL-2.1-only AND Sleepycat
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms