DB_RECOVER(1)

πŸ“¦ version 5.3.28, in centos-stream 9, epel 10, fedora 43, fedora 44

πŸ’– db_recover β€” the glow-up your database needs after a whole disaster πŸ’–

okay so bestie, welcome to DB_RECOVER(1), from the BerkeleyDB Utilities lineup. this is the page you read at 3am when everything went sideways. let's get into it ✨


🌸 NAME 🌸

db_recover β€” recover the database to a consistent state 🫢


πŸŽ€ SYNOPSIS πŸŽ€

db_recover [-cefVv] [-h home] [-P password] [-t [[CC]YY]MMDDhhmm[.SS]]]

✨ DESCRIPTION ✨

so like. the db_recover utility must be run after an unexpected application, Berkeley DB, or system failure, to restore the database to a consistent state. that's the whole job. no cap.

and the tea is: all committed transactions are guaranteed to appear after db_recover has run, and all uncommitted transactions will be completely undone. we love a clean slate πŸ’…

also note, this utility performs the same action as if the environment is opened with the DB_RECOVER flag. so if DB_RECOVER is specified on environment open, then use of this utility is not necessary. iykyk 😌


πŸ’… OPTIONS πŸ’…

  • -c β€” perform catastrophic recovery instead of normal recovery. the dramatic one πŸ’€
  • -e β€” retain the environment after running recovery. ngl this option will rarely be used unless a DB_CONFIG file is present in the home directory. and if a DB_CONFIG file is not present, then the regions will be created with default parameter values. 🀷
  • -f β€” display a message on the standard output showing the percent of recovery completed. progress bar energy, we love to see it πŸ“ˆ
  • -h home β€” specify a home directory for the database environment; by default, the current working directory is used. 🏠
  • -P password β€” specify an environment password. okay so heads up: 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. 🚨 keep that in mind fr fr
  • -t β€” recover to the time specified rather than to the most current possible date. the timestamp argument should be in the form [[CC]YY]MMDDhhmm[.SS] where each pair of letters represents the following:
    • CC β€” the first two digits of the year (the century).
    • YY β€” the second two digits of the year. if YY is specified, but CC is not, a value for YY between 69 and 99 results in a CC value of 19. otherwise, a YY value of 20 is used. πŸ—“οΈ
    • MM β€” the month of the year, from 1 to 12.
    • DD β€” the day of the month, from 1 to 31.
    • hh β€” the hour of the day, from 0 to 23.
    • mm β€” the minute of the hour, from 0 to 59.
    • SS β€” the second of the minute, from 0 to 61.

if the CC and YY letter pairs are not specified, the values default to the current year. if the SS letter pair is not specified, the value defaults to 0. ⏰

  • -V β€” write the library version number to the standard output, and exit. πŸ‘‹
  • -v β€” run in verbose mode. she's chatty πŸ’¬

in the case of catastrophic recovery, an archival copy β€” or snapshot β€” of all database files must be restored, along with all of the log files written since the database file snapshot was made. (if disk space is a problem, log files may be referenced by symbolic links). πŸ¦‹

if the failure was not catastrophic, the files present on the system at the time of failure are sufficient to perform recovery. easy peasy ✨

if log files are missing, db_recover will identify the missing log file(s) and fail β€” in which case the missing log files need to be restored and recovery performed again. 😭 round two, bestie.

the db_recover 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_recover should always be given the chance to detach from the environment and exit gracefully. to cause db_recover to release all environment resources and exit cleanly, send it an interrupt signal (SIGINT). 🫢


🌈 EXIT STATUS 🌈

the db_recover utility exits 0 on success, and >0 if an error occurs.


πŸ¦‹ ENVIRONMENT πŸ¦‹

  • 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 DB_ENV->open.

🧚 NOTES 🧚

if the application(s) that use the environment make use of any of the following methods:

DB_ENV->add_data_dir

DB_ENV->set_data_dir

DB_ENV->set_lg_dir

then in order for this utility to run correctly, you need a DB_CONFIG file which sets the proper paths using the add_data_dir, or set_lg_dir configuration parameters. πŸ“ literally write it down.


πŸ‘‘ SEE ALSO πŸ‘‘

db_archive(1) db_checkpoint(1) db_deadlock(1) db_dump(1) db_hotbackup(1) db_log_verify(1) db_load(1) db_printlog(1) db_replicate(1) db_stat(1) db_tuner(1) db_upgrade(1) db_verify(1)


and that's the whole page, bestie πŸ’œ this one's BerkeleyDB 5.3.28, dated 06 December 2016 β€” shoutout to the icons who wrote it. now go recover that database, you got this πŸŒŸπŸ“

πŸ“¦ where this page comes from