1DB_HOTBACKUP(1) BerkeleyDB Utilities DB_HOTBACKUP(1)
2
3
4
6 db_hotbackup - Create "hot backup" or "hot failover" snapshots
7
9 db_hotbackup [-cDEguVv] [-d data_dir ...] [-h home] [-l log_dir] [-P
10 password] -b backup_dir
11
13 The db_hotbackup utility creates "hot backup" or "hot failover" snap‐
14 shots of Berkeley DB database environments.
15
16 The db_hotbackup utility performs the following steps:
17
18 1. Sets the DB_HOTBACKUP_IN_PROGRESS flag in the home database
19 environment.
20
21 2. If the -c option is specified, checkpoint the source home
22 database environment, and remove any unnecessary log files.
23
24 3. If the target directory for the backup does not exist, it is
25 created with mode read-write-execute for the owner.
26
27 If the target directory for the backup does exist and the -u
28 option was specified, all log files in the target directory
29 are removed; if the -u option was not specified, all files in
30 the target directory are removed.
31
32 4. If the -u option was not specified, copy application-specific
33 files found in the database environment home directory, or
34 any directory specified using the -d option, into the target
35 directory for the backup.
36
37 5. Copy all log files found in the directory specified by the -l
38 option (or in the database environment home directory, if no
39 -l option was specified), into the target directory for the
40 backup.
41
42 6. Perform catastrophic recovery on the hot backup.
43
44 7. Remove any unnecessary log files from the hot backup.
45
46 8. Reset the DB_HOTBACKUP_IN_PROGRESS flag in the environment.
47
48 The db_hotbackup utility does not resolve pending transactions that are
49 in the prepared state. Applications that use DB_TXN->prepare should
50 specify DB_RECOVER_FATAL when opening the environment, and run
51 DB_ENV->txn_recover to resolve any pending transactions, when failing
52 over to the hot backup.
53
55 -b backup_dir
56 Specify the target directory for the backup.
57
58 -c Before performing the snapshot, checkpoint the source database
59 environment and remove any log files that are no longer required
60 in that environment. To avoid making catastrophic failure
61 impossible, log file removal must be integrated with log file
62 archival.
63
64 -D Use the data and log directories listed in a DB_CONFIG configu‐
65 ration file in the source directory. This option has four
66 effects:
67
68 1. The specified data and log directories will be created rela‐
69 tive to the target directory, with mode read-write-execute
70 owner, if they do not already exist.
71
72 2. In step #3 above, all files in any source data directories
73 specified in the DB_CONFIG file will be copied to the target
74 data directories.
75
76 3. In step #4 above, log files will be copied from any log
77 directory specified in the DB_CONFIG file, instead of from
78 the default locations.
79
80 4. The DB_CONFIG configuration file will be copied from the
81 source directory to the target directory, and subsequently
82 used for configuration if recovery is run in the target
83 directory.
84
85 Care should be taken with the -D option where data and log
86 directories are named relative to the source directory but are
87 not subdirectories (that is, the name includes the element "..")
88 Specifically, the constructed target directory names must be
89 meaningful and distinct from the source directory names, other‐
90 wise running recovery in the target directory might corrupt the
91 source data files.
92
93 It is an error to use absolute pathnames for data or log direc‐
94 tories in this mode, as the DB_CONFIG configuration file copied
95 into the target directory would then point at the source direc‐
96 tories and running recovery would corrupt the source data files.
97
98 -d data_dir
99 Specify one or more source directories that contain databases;
100 if none is specified, the database environment home directory
101 will be searched for database files. As database files are
102 copied into a single backup directory, files named the same,
103 stored in different source directories, could overwrite each
104 other when copied into the backup directory.
105
106 -F Directly copy from the filesystem. This option can CORRUPT the
107 backup if used while the environment is active and the operating
108 system does not support atomic file system reads. This option
109 is known to be safe only on UNIX systems, not Linux or Windows
110 systems.
111
112 -h home
113 Specify the source directory for the backup, that is, the data‐
114 base environment home directory.
115
116 -l log_dir
117 Specify a source directory that contains log files; if none is
118 specified, the database environment home directory will be
119 searched for log files.
120
121 -P password
122 Specify an environment password. Although Berkeley DB utilities
123 overwrite password strings as soon as possible, be aware there
124 may be a window of vulnerability on systems where unprivileged
125 users can see command-line arguments or where utilities are not
126 able to overwrite the memory containing the command-line argu‐
127 ments.
128
129 -u Update a pre-existing hot backup snapshot by copying in new log
130 files. If the -u option is specified, no databases will be
131 copied into the target directory.
132
133 -V Write the library version number to the standard output, and
134 exit.
135
136 -v Run in verbose mode, listing operations as they are done.
137
138 -D Use the data directories listed in the DB_CONFIG configuration
139 file in the source directory. This option has three effects:
140 First, if they do not already exist, the specified data directo‐
141 ries will be created relative to the target directory (with mode
142 read-write-execute owner). Second, all files in the source data
143 directories will be copied to the target data directories. If
144 the DB_CONFIG file specifies one or more absolute pathnames,
145 files in those source directories will be copied to the top-
146 level target directory. Third, the DB_CONFIG configuration file
147 will be copied from the +source directory to the target direc‐
148 tory, and subsequently used for configuration if recovery is run
149 in the target directory.
150
151 Care should be taken with the -D option and data directories which are
152 named relative to the source directory but are not subdirectories (that
153 is, the name includes the element "..") Specifically, the constructed
154 target directory names must be meaningful and distinct from the source
155 directory names, otherwise running recovery in the target directory
156 might corrupt the source data files.
157
158 It is an error to use absolute pathnames for data directories or the
159 log directory in this mode, as the DB_CONFIG configuration file copied
160 into the target directory would then point at the source directories
161 and running recovery would corrupt the source data files.
162
163 The db_hotbackup utility uses a Berkeley DB environment (as described
164 for the -h option, the environment variable DB_HOME, or because the
165 utility was run in a directory containing a Berkeley DB environment).
166 In order to avoid environment corruption when using a Berkeley DB envi‐
167 ronment, db_hotbackup should always be given the chance to detach from
168 the environment and exit gracefully. To cause db_hotbackup to release
169 all environment resources and exit cleanly, send it an interrupt signal
170 (SIGINT).
171
173 The db_hotbackup utility exits 0 on success, and >0 if an error occurs.
174
176 DB_HOME
177 If the -h option is not specified and the environment variable
178 DB_HOME is set, it is used as the path of the database home, as
179 described in DB_ENV->open.
180
182 db_archive(1) db_checkpoint(1) db_deadlock(1) db_dump(1) db_log_ver‐
183 ify(1) db_load(1) db_printlog(1) db_recover(1) db_replicate(1)
184 db_stat(1) db_tuner(1) db_upgrade(1) db_verify(1)
185
186
187
188BerkeleyDB 5.3.28 06 December 2016 DB_HOTBACKUP(1)