Debian Codegraph @

docs/api_reference/CXX/envbackup.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>DbEnv::backup()</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="env.html" title="Chapter 5.  The DbEnv Handle" />
11 <link rel="prev" href="envadd_data_dir.html" title="DbEnv::add_data_dir()" />
12 <link rel="next" href="envclose.html" title="DbEnv::close()" />
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">DbEnv::backup()</th>
22 </tr>
23 <tr>
24 <td width="20%" align="left"><a accesskey="p" href="envadd_data_dir.html">Prev</a> </td>
25 <th width="60%" align="center">Chapter 5. 
26 The DbEnv Handle
27 </th>
28 <td width="20%" align="right"> <a accesskey="n" href="envclose.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="envbackup"></a>DbEnv::backup()</h2>
38 </div>
39 </div>
40 </div>
41 <pre class="programlisting">#include &lt;db_cxx.h&gt;
42
43 int
44 DbEnv::backup(const char *target, u_int32_t flags);</pre>
45 <p>
46 The <code class="methodname">DbEnv::backup()</code> method performs a hot
47 backup of the open environment. All files used by the environment
48 are backed up, so long as the normal rules for file placement are
49 followed. For information on how files are normally placed relative
50 to the environment directory, see
51 <a href="../../programmer_reference/env_naming.html" class="olink">Berkeley DB File Naming</a> in the <em class="citetitle">Berkeley DB Programmer's Reference Guide</em>.
52 </p>
53 <p>
54 By default, data directories and the log directory specified
55 relative to the home directory will be recreated relative to the
56 target directory. If absolute path names are used, then specify
57 <code class="literal">DB_BACKUP_SINGLE_DIR</code> to the <code class="literal">flags</code>
58 parameter.
59 </p>
60 <p>
61 This method provides the same functionality as the
62 <a class="xref" href="db_hotbackup.html" title="db_hotbackup">db_hotbackup</a>
63 utility. However, this method does not perform the housekeeping
64 actions performed by the <code class="literal">db_hotbackup</code> utility.
65 In particular, you may want to run a checkpoint before calling this
66 method. To run a checkpoint, use the
67 <a class="xref" href="txncheckpoint.html" title="DbEnv::txn_checkpoint()">DbEnv::txn_checkpoint()</a>
68 method. For more information on checkpoints, see
69 <a href="../../programmer_reference/transapp_checkpoint.html" class="olink">Checkpoints</a> in the <em class="citetitle">Berkeley DB Programmer's Reference Guide</em>.
70 </p>
71 <p>
72 To back up a single database file contained within the environment,
73 use the
74 <a class="xref" href="envdbbackup.html" title="DbEnv::dbbackup()">DbEnv::dbbackup()</a>
75 method.
76 </p>
77 <p>
78 This method's default behavior can be changed by setting backup
79 callbacks. See
80 <a class="xref" href="envset_backup_callbacks.html" title="DbEnv::set_backup_callbacks()">DbEnv::set_backup_callbacks()</a>
81 for more information. Additional tuning parameters can also be set
82 using the
83 <a class="xref" href="envset_backup_config.html" title="DbEnv::set_backup_config()">DbEnv::set_backup_config()</a> method.
84 </p>
85 <p>
86 The <code class="methodname">DbEnv::backup()</code> method may only be
87 called after the environment handle has been opened.
88 </p>
89 <p>
90 The <code class="methodname">DbEnv::backup()</code> <span>
91
92 <span>
93 method either returns a non-zero error value or throws an
94 exception that encapsulates a non-zero error value on
95 failure, and returns 0 on success.
96 </span>
97 </span>
98 </p>
99 <div class="sect2" lang="en" xml:lang="en">
100 <div class="titlepage">
101 <div>
102 <div>
103 <h3 class="title"><a id="idp6593792"></a>Parameters</h3>
104 </div>
105 </div>
106 </div>
107 <div class="sect3" lang="en" xml:lang="en">
108 <div class="titlepage">
109 <div>
110 <div>
111 <h4 class="title"><a id="idp6593640"></a>target</h4>
112 </div>
113 </div>
114 </div>
115 <p>
116 Identifies the directory in which the back up will be
117 placed. Any subdirectories required to contain the backup
118 must be placed relative to this directory. Note that if
119 the backup callbacks are set, then the value specified to
120 this parameter is passed on to the <code class="literal">open_func()</code>
121 callback. If this parameter is NULL, then the target must
122 be specified to the <code class="literal">open_func()</code>
123 callback.
124 </p>
125 <p>
126 This directory, and any required subdirectories, will be
127 created for you if you specify the
128 <code class="literal">DB_CREATE</code> flag on the call to this
129 method. Otherwise, if the target does not exist, this
130 method exits with an <code class="literal">ENOENT</code>
131 error return.
132 </p>
133 </div>
134 <div class="sect3" lang="en" xml:lang="en">
135 <div class="titlepage">
136 <div>
137 <div>
138 <h4 class="title"><a id="idp6570040"></a>flags</h4>
139 </div>
140 </div>
141 </div>
142 <p>
143 The <span class="bold"><strong>flags</strong></span> parameter must
144 be set to 0 or by bitwise inclusively
145 <span class="bold"><strong>OR</strong></span>'ing together one or more of
146 the values:
147 </p>
148 <div class="itemizedlist">
149 <ul type="disc">
150 <li>
151 <p>
152 <code class="literal">DB_BACKUP_CLEAN</code>
153 </p>
154 <p>
155 Before performing the backup, first remove all
156 files from the target backup directory tree.
157 </p>
158 </li>
159 <li>
160 <p>
161 <code class="literal">DB_BACKUP_FILES</code>
162 </p>
163 <p>
164 Back up all ordinary files that might exist in the
165 environment, and the environment's subdirectories.
166 </p>
167 </li>
168 <li>
169 <p>
170 <code class="literal">DB_BACKUP_NO_LOGS</code>
171 </p>
172 <p>
173 Back up only the <code class="literal">*.db</code>
174 files. Do not backup the log files.
175 </p>
176 </li>
177 <li>
178 <p>
179 <code class="literal">DB_BACKUP_SINGLE_DIR</code>
180 </p>
181 <p>
182 Regardless of the directory structure used by the
183 source environment, place all back up files in the
184 single directory identified by the
185 <code class="literal">target</code> parameter. Use this
186 option if absolute path names to your environment
187 directory and the files within that directory are
188 required by your application.
189 </p>
190 </li>
191 <li>
192 <p>
193 <code class="literal">DB_BACKUP_UPDATE</code>
194 </p>
195 <p>
196 Perform an incremental back up, instead of a full
197 back up. When this option is specified, only log
198 files are copied to the target directory.
199 </p>
200 </li>
201 <li>
202 <p>
203 <code class="literal">DB_CREATE</code>
204 </p>
205 <p>
206 If the target directory does not exist, create it
207 and any required subdirectories.
208 </p>
209 </li>
210 <li>
211 <p>
212 <code class="literal">DB_EXCL</code>
213 </p>
214 <p>
215 Return an <code class="literal">EEXIST</code> error if a
216 target backup file already exists.
217 </p>
218 </li>
219 <li>
220 <p>
221 <code class="literal">DB_VERB_BACKUP</code>
222 </p>
223 <p>
224 Run in verbose mode, listing operations as they are
225 completed.
226 </p>
227 </li>
228 </ul>
229 </div>
230 </div>
231 </div>
232 <div class="sect2" lang="en" xml:lang="en">
233 <div class="titlepage">
234 <div>
235 <div>
236 <h3 class="title"><a id="idp6615256"></a>Errors</h3>
237 </div>
238 </div>
239 </div>
240 <p>
241 The <code class="methodname">DbEnv::backup()</code> <span>
242
243 <span>
244 method may fail and throw a <a class="link" href="dbexception.html" title="Chapter 6. The DbException Class">DbException</a>
245 exception, encapsulating one of the following non-zero errors, or return one
246 of the following non-zero errors:
247 </span>
248 </span>
249 </p>
250 <div class="sect3" lang="en" xml:lang="en">
251 <div class="titlepage">
252 <div>
253 <div>
254 <h4 class="title"><a id="idp6612320"></a>EEXIST</h4>
255 </div>
256 </div>
257 </div>
258 <p>
259 <code class="literal">DB_EXCL</code> was specified for the
260 <code class="literal">flags</code> parameter, and an existing target
261 file was discovered when attempting to back up a source
262 file.
263 </p>
264 </div>
265 <div class="sect3" lang="en" xml:lang="en">
266 <div class="titlepage">
267 <div>
268 <div>
269 <h4 class="title"><a id="idp6613312"></a>ENOENT</h4>
270 </div>
271 </div>
272 </div>
273 <p>
274 The target directory does not exist and <code class="literal">DB_CREATE</code>
275 was not specified for the <code class="literal">flags</code>
276 parameter.
277 </p>
278 </div>
279 <div class="sect3" lang="en" xml:lang="en">
280 <div class="titlepage">
281 <div>
282 <div>
283 <h4 class="title"><a id="idp6603448"></a>EINVAL</h4>
284 </div>
285 </div>
286 </div>
287 <p>
288 An invalid flag value or parameter was specified.
289 </p>
290 </div>
291 </div>
292 <div class="sect2" lang="en" xml:lang="en">
293 <div class="titlepage">
294 <div>
295 <div>
296 <h3 class="title"><a id="idp6605608"></a>Class</h3>
297 </div>
298 </div>
299 </div>
300 <p>
301 <a class="link" href="env.html" title="Chapter 5.  The DbEnv Handle">DbEnv</a>
302 </p>
303 </div>
304 <div class="sect2" lang="en" xml:lang="en">
305 <div class="titlepage">
306 <div>
307 <div>
308 <h3 class="title"><a id="idp6598984"></a>See Also</h3>
309 </div>
310 </div>
311 </div>
312 <p>
313 <a class="xref" href="env.html#envlist" title="Database Environments and Related Methods">Database Environments and Related Methods</a>
314 </p>
315 </div>
316 </div>
317 <div class="navfooter">
318 <hr />
319 <table width="100%" summary="Navigation footer">
320 <tr>
321 <td width="40%" align="left"><a accesskey="p" href="envadd_data_dir.html">Prev</a> </td>
322 <td width="20%" align="center">
323 <a accesskey="u" href="env.html">Up</a>
324 </td>
325 <td width="40%" align="right"> <a accesskey="n" href="envclose.html">Next</a></td>
326 </tr>
327 <tr>
328 <td width="40%" align="left" valign="top">DbEnv::add_data_dir() </td>
329 <td width="20%" align="center">
330 <a accesskey="h" href="index.html">Home</a>
331 </td>
332 <td width="40%" align="right" valign="top"> DbEnv::close()</td>
333 </tr>
334 </table>
335 </div>
336 </body>
337 </html>