1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
|
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<title>db_hotbackup</title>
<link rel="stylesheet" href="apiReference.css" type="text/css" />
<meta name="generator" content="DocBook XSL Stylesheets V1.73.2" />
<link rel="start" href="index.html" title="Berkeley DB C API Reference" />
<link rel="up" href="utilities.html" title="Appendix A. Berkeley DB Command Line Utilities" />
<link rel="prev" href="db_dump.html" title="db_dump" />
<link rel="next" href="db_load.html" title="db_load" />
</head>
<body>
<div xmlns="" class="navheader">
<div class="libver">
<p>Library Version 12.1.6.1</p>
</div>
<table width="100%" summary="Navigation header">
<tr>
<th colspan="3" align="center">db_hotbackup</th>
</tr>
<tr>
<td width="20%" align="left"><a accesskey="p" href="db_dump.html">Prev</a> </td>
<th width="60%" align="center">Appendix A.
Berkeley DB Command Line Utilities
</th>
<td width="20%" align="right"> <a accesskey="n" href="db_load.html">Next</a></td>
</tr>
</table>
<hr />
</div>
<div class="sect1" lang="en" xml:lang="en">
<div class="titlepage">
<div>
<div>
<h2 class="title" style="clear: both"><a id="db_hotbackup"></a>db_hotbackup</h2>
</div>
</div>
</div>
<pre class="programlisting">db_hotbackup [-cDEguVv] [-d data_dir ...] [-h home]
[-l log_dir] [-P password] -b backup_dir </pre>
<p>
The <span class="command"><strong>db_hotbackup</strong></span> utility creates "hot backup" or "hot failover"
snapshots of Berkeley DB database environments. Hot backups can
also be performed using the
<a class="xref" href="envbackup.html" title="DB_ENV->backup()">DB_ENV->backup()</a>
or
<a class="xref" href="envdbbackup.html" title="DB_ENV->dbbackup()">DB_ENV->dbbackup()</a>
methods.
</p>
<p>
The <span class="command"><strong>db_hotbackup</strong></span> utility performs the following steps:
</p>
<div class="orderedlist">
<ol type="1">
<li>
<p>
Sets the
<a class="xref" href="envset_flags.html#set_flags_DB_HOTBACKUP_IN_PROGRESS">
<code class="literal">DB_HOTBACKUP_IN_PROGRESS</code>
</a>
flag in the home database environment.
</p>
</li>
<li>
<p>
If the <span class="bold"><strong>-c</strong></span> option is specified,
checkpoint the source home database environment, and remove any
unnecessary log files.
</p>
</li>
<li>
<p>
If the target directory for the backup does not exist, it is created
with mode read-write-execute for the owner.
</p>
<p>
If the target directory for the backup does exist and the <span class="bold"><strong>-u</strong></span> option was specified, all log files in the
target directory are removed; if the <span class="bold"><strong>-u</strong></span> option was not specified, all files in the
target directory are removed.
</p>
</li>
<li>
<p>
If the <span class="bold"><strong>-u</strong></span> option was not specified,
copy application-specific files found in the database environment home
directory, and any directories specified using the <span class="bold"><strong>-d</strong></span> option, into the target directory for the
backup.
</p>
</li>
<li>
<p>
Copy all log files found in the directory specified by the <span class="bold"><strong>-l</strong></span> option (or in the database environment home
directory, if no <span class="bold"><strong>-l</strong></span> option was
specified), into the target directory for the backup.
</p>
</li>
<li>
<p>
Perform catastrophic recovery in the target directory for the backup.
</p>
</li>
<li>
<p>
Remove any unnecessary log files from the target directory for the
backup.
</p>
</li>
<li>
<p>
Reset the
<a class="xref" href="envset_flags.html#set_flags_DB_HOTBACKUP_IN_PROGRESS">
<code class="literal">DB_HOTBACKUP_IN_PROGRESS</code>
</a>
flag in the environment.
</p>
</li>
</ol>
</div>
<p>
The <span class="command"><strong>db_hotbackup</strong></span> utility does not resolve pending transactions that
are in the prepared state.
<span>
Applications that use
<a class="xref" href="txnprepare.html" title="DB_TXN->prepare()">DB_TXN->prepare()</a> must specify
<a class="link" href="envopen.html#envopen_DB_RECOVER_FATAL">DB_RECOVER_FATAL</a>
when opening the environment, and run
<a class="xref" href="txnrecover.html" title="DB_ENV->txn_recover()">DB_ENV->txn_recover()</a> to
resolve any pending transactions, when failing over to the backup.
</span>
</p>
<p>
The options are as follows:
</p>
<div class="itemizedlist">
<ul type="disc">
<li>
<p>
<span class="bold"><strong>-b</strong></span>
</p>
<p>
Specify the target directory for the backup.
</p>
</li>
<li>
<p>
<span class="bold"><strong>-c</strong></span>
</p>
<p>
Before performing the backup, checkpoint the source database
environment and remove any log files that are no longer required in
that environment. <span class="bold"><strong>To avoid making catastrophic
recovery impossible, log file removal must be integrated with log file
archival.</strong></span>
</p>
</li>
<li>
<p>
<span class="bold"><strong>-D</strong></span>
</p>
<p>
Use the data and log directories listed in a <a href="../../programmer_reference/env_db_config.html#env_db_config.DB_CONFIG" class="olink">DB_CONFIG</a>
configuration file in the source directory. This option
has four effects:
</p>
<div class="itemizedlist">
<ul type="circle">
<li>
<p>
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.
</p>
</li>
<li>
<p>
In step #3 above, all files in any source data
directories specified in the <a href="../../programmer_reference/env_db_config.html#env_db_config.DB_CONFIG" class="olink">DB_CONFIG</a> file will
be copied to the target data directories.
</p>
</li>
<li>
<p>
In step #4 above, log files will be copied from
any log directory specified in the <a href="../../programmer_reference/env_db_config.html#env_db_config.DB_CONFIG" class="olink">DB_CONFIG</a>
file, instead of from the default locations.
</p>
</li>
<li>
<p>
The <a href="../../programmer_reference/env_db_config.html#env_db_config.DB_CONFIG" class="olink">DB_CONFIG</a> configuration 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.
</p>
</li>
</ul>
</div>
<p>
Care should be taken with the <span class="bold"><strong>-D</strong></span>
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.
</p>
<p>
<span class="bold"><strong>It is an error to use absolute pathnames for
data or log directories in this mode, as the <a href="../../programmer_reference/env_db_config.html#env_db_config.DB_CONFIG" class="olink">DB_CONFIG</a>
configuration file copied into the target directory would
then point at the source directories and running recovery
would corrupt the source data files.</strong></span>
</p>
</li>
<li>
<p>
<span class="bold"><strong>-d</strong></span>
</p>
<p>
Specify one or more directories that contain data files to be copied
to the target directory.
</p>
<p>
<span class="bold"><strong>As all database files are copied into a single
target directory, files named the same, stored in different source
directories, would overwrite each other when copied to the target
directory.</strong></span>
</p>
<p>
Please note the database environment recovery log references database
files as they are named by the application program. <span class="bold"><strong>If the application uses absolute or relative pathnames to
name database files, (rather than filenames and the
<a class="xref" href="envadd_data_dir.html" title="DB_ENV->add_data_dir()">DB_ENV->add_data_dir()</a>
method or the <a href="../../programmer_reference/env_db_config.html#env_db_config.DB_CONFIG" class="olink">DB_CONFIG</a> configuration file to specify
filenames), running recovery in the target directory may
not properly find the copies of the files or might even
find the source files, potentially resulting in
corruption.</strong></span>
</p>
</li>
<li>
<p>
<span class="bold"><strong>-F</strong></span>
</p>
<p>
Directly copy from the filesystem. This option can
<span class="bold"><strong>CORRUPT</strong></span> 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.
</p>
</li>
<li>
<p>
<span class="bold"><strong>-g</strong></span>
</p>
<p>
Turn on debugging options. In particular this will leave the
log files in the backup directory after running recovery.
</p>
</li>
<li>
<p>
<span class="bold"><strong>-h</strong></span>
</p>
<p>
Specify the source directory for the backup. That is, the
database environment home directory.
</p>
</li>
<li>
<p>
<span class="bold"><strong>-l</strong></span>
</p>
<p>
Specify a source directory that contains log files; if none is
specified, the database environment home directory will be searched
for log files. If a relative path is specified, the path
is evaluated relative to the home directory.
</p>
</li>
<li>
<p>
<span class="bold"><strong>-P</strong></span>
</p>
<p>
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.
</p>
</li>
<li>
<p>
<span class="bold"><strong>-u</strong></span>
</p>
<p>
Update a pre-existing hot backup snapshot by copying in new log files.
If the <span class="bold"><strong>-u</strong></span> option is specified, no
databases will be copied into the target directory. If applications
that update the environment are using the transactional bulk insert
optimization, this option must be used with special care.
For more information, see the
section on Hot Backup in the <span class="emphasis"><em>Getting Started
With Transaction Processing Guide</em></span>.
</p>
</li>
<li>
<p>
<span class="bold"><strong>-V</strong></span>
</p>
<p>
Write the library version number to the standard output, and exit.
</p>
</li>
<li>
<p>
<span class="bold"><strong>-v</strong></span>
</p>
<p>
Run in verbose mode, listing operations as they are done.
</p>
</li>
</ul>
</div>
<p>
The <span class="command"><strong>db_hotbackup</strong></span> utility uses a Berkeley DB
environment (as described for the <span class="bold"><strong>-h</strong></span> option, the environment variable
<span class="bold"><strong>DB_HOME</strong></span>, 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, <span class="command"><strong>db_hotbackup</strong></span> should always be given the chance to detach
from the environment and exit gracefully. To cause <span class="command"><strong>db_hotbackup</strong></span> to
release all environment resources and exit cleanly, send it an
interrupt signal (SIGINT).
</p>
<p>
The <span class="command"><strong>db_hotbackup</strong></span> utility exits 0 on success, and >0 if an error
occurs.
</p>
<div class="sect2" lang="en" xml:lang="en">
<div class="titlepage">
<div>
<div>
<h3 class="title"><a id="idp4993160"></a>Environment Variables</h3>
</div>
</div>
</div>
<div class="sect3" lang="en" xml:lang="en">
<div class="titlepage">
<div>
<div>
<h4 class="title"><a id="idp5040120"></a>DB_HOME</h4>
</div>
</div>
</div>
<p>
If the <span class="bold"><strong>-h</strong></span> 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
<a class="xref" href="envopen.html" title="DB_ENV->open()">DB_ENV->open()</a> method.
</p>
</div>
</div>
</div>
<div class="navfooter">
<hr />
<table width="100%" summary="Navigation footer">
<tr>
<td width="40%" align="left"><a accesskey="p" href="db_dump.html">Prev</a> </td>
<td width="20%" align="center">
<a accesskey="u" href="utilities.html">Up</a>
</td>
<td width="40%" align="right"> <a accesskey="n" href="db_load.html">Next</a></td>
</tr>
<tr>
<td width="40%" align="left" valign="top">db_dump </td>
<td width="20%" align="center">
<a accesskey="h" href="index.html">Home</a>
</td>
<td width="40%" align="right" valign="top"> db_load</td>
</tr>
</table>
</div>
</body>
</html>
|