Debian Codegraph @

docs/api_reference/C/db_hotbackup.html

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