Debian Codegraph @

docs/api_reference/C/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>DB_ENV-&gt;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 DB_ENV Handle" />
11 <link rel="prev" href="envadd_data_dir.html" title="DB_ENV-&gt;add_data_dir()" />
12 <link rel="next" href="envclose.html" title="DB_ENV-&gt;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">DB_ENV-&gt;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 DB_ENV 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>DB_ENV-&gt;backup()</h2>
38 </div>
39 </div>
40 </div>
41 <pre class="programlisting">#include &lt;db.h&gt;
42
43 int
44 DB_ENV-&gt;backup(DB_ENV *dbenv, const char *target, u_int32_t flags); </pre>
45 <p>
46 The <code class="methodname">DB_ENV-&gt;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="DB_ENV-&gt;txn_checkpoint()">DB_ENV-&gt;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="DB_ENV-&gt;dbbackup()">DB_ENV-&gt;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="DB_ENV-&gt;set_backup_callbacks()">DB_ENV-&gt;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="DB_ENV-&gt;set_backup_config()">DB_ENV-&gt;set_backup_config()</a> method.
84 </p>
85 <p>
86 The <code class="methodname">DB_ENV-&gt;backup()</code> method may only be
87 called after the environment handle has been opened.
88 </p>
89 <p>
90 The <code class="methodname">DB_ENV-&gt;backup()</code> <span>
91 <span>
92 method returns a non-zero error value on failure and 0 on success.
93 </span>
94
95 </span>
96 </p>
97 <div class="sect2" lang="en" xml:lang="en">
98 <div class="titlepage">
99 <div>
100 <div>
101 <h3 class="title"><a id="idp51230112"></a>Parameters</h3>
102 </div>
103 </div>
104 </div>
105 <div class="sect3" lang="en" xml:lang="en">
106 <div class="titlepage">
107 <div>
108 <div>
109 <h4 class="title"><a id="idp51243928"></a>target</h4>
110 </div>
111 </div>
112 </div>
113 <p>
114 Identifies the directory in which the back up will be
115 placed. Any subdirectories required to contain the backup
116 must be placed relative to this directory. Note that if
117 the backup callbacks are set, then the value specified to
118 this parameter is passed on to the <code class="literal">open_func()</code>
119 callback. If this parameter is NULL, then the target must
120 be specified to the <code class="literal">open_func()</code>
121 callback.
122 </p>
123 <p>
124 This directory, and any required subdirectories, will be
125 created for you if you specify the
126 <code class="literal">DB_CREATE</code> flag on the call to this
127 method. Otherwise, if the target does not exist, this
128 method exits with an <code class="literal">ENOENT</code>
129 error return.
130 </p>
131 </div>
132 <div class="sect3" lang="en" xml:lang="en">
133 <div class="titlepage">
134 <div>
135 <div>
136 <h4 class="title"><a id="idp51252240"></a>flags</h4>
137 </div>
138 </div>
139 </div>
140 <p>
141 The <span class="bold"><strong>flags</strong></span> parameter must
142 be set to 0 or by bitwise inclusively
143 <span class="bold"><strong>OR</strong></span>'ing together one or more of
144 the values:
145 </p>
146 <div class="itemizedlist">
147 <ul type="disc">
148 <li>
149 <p>
150 <code class="literal">DB_BACKUP_CLEAN</code>
151 </p>
152 <p>
153 Before performing the backup, first remove all
154 files from the target backup directory tree.
155 </p>
156 </li>
157 <li>
158 <p>
159 <code class="literal">DB_BACKUP_FILES</code>
160 </p>
161 <p>
162 Back up all ordinary files that might exist in the
163 environment, and the environment's subdirectories.
164 </p>
165 </li>
166 <li>
167 <p>
168 <code class="literal">DB_BACKUP_NO_LOGS</code>
169 </p>
170 <p>
171 Back up only the <code class="literal">*.db</code>
172 files. Do not backup the log files.
173 </p>
174 </li>
175 <li>
176 <p>
177 <code class="literal">DB_BACKUP_SINGLE_DIR</code>
178 </p>
179 <p>
180 Regardless of the directory structure used by the
181 source environment, place all back up files in the
182 single directory identified by the
183 <code class="literal">target</code> parameter. Use this
184 option if absolute path names to your environment
185 directory and the files within that directory are
186 required by your application.
187 </p>
188 </li>
189 <li>
190 <p>
191 <code class="literal">DB_BACKUP_UPDATE</code>
192 </p>
193 <p>
194 Perform an incremental back up, instead of a full
195 back up. When this option is specified, only log
196 files are copied to the target directory.
197 </p>
198 </li>
199 <li>
200 <p>
201 <code class="literal">DB_CREATE</code>
202 </p>
203 <p>
204 If the target directory does not exist, create it
205 and any required subdirectories.
206 </p>
207 </li>
208 <li>
209 <p>
210 <code class="literal">DB_EXCL</code>
211 </p>
212 <p>
213 Return an <code class="literal">EEXIST</code> error if a
214 target backup file already exists.
215 </p>
216 </li>
217 <li>
218 <p>
219 <code class="literal">DB_VERB_BACKUP</code>
220 </p>
221 <p>
222 Run in verbose mode, listing operations as they are
223 completed.
224 </p>
225 </li>
226 </ul>
227 </div>
228 </div>
229 </div>
230 <div class="sect2" lang="en" xml:lang="en">
231 <div class="titlepage">
232 <div>
233 <div>
234 <h3 class="title"><a id="idp51283200"></a>Errors</h3>
235 </div>
236 </div>
237 </div>
238 <p>
239 The <code class="methodname">DB_ENV-&gt;backup()</code> <span>
240 <span>
241 method may fail and return one of the following non-zero errors:
242 </span>
243
244 </span>
245 </p>
246 <div class="sect3" lang="en" xml:lang="en">
247 <div class="titlepage">
248 <div>
249 <div>
250 <h4 class="title"><a id="idp51268432"></a>EEXIST</h4>
251 </div>
252 </div>
253 </div>
254 <p>
255 <code class="literal">DB_EXCL</code> was specified for the
256 <code class="literal">flags</code> parameter, and an existing target
257 file was discovered when attempting to back up a source
258 file.
259 </p>
260 </div>
261 <div class="sect3" lang="en" xml:lang="en">
262 <div class="titlepage">
263 <div>
264 <div>
265 <h4 class="title"><a id="idp51269320"></a>ENOENT</h4>
266 </div>
267 </div>
268 </div>
269 <p>
270 The target directory does not exist and <code class="literal">DB_CREATE</code>
271 was not specified for the <code class="literal">flags</code>
272 parameter.
273 </p>
274 </div>
275 <div class="sect3" lang="en" xml:lang="en">
276 <div class="titlepage">
277 <div>
278 <div>
279 <h4 class="title"><a id="idp51278968"></a>EINVAL</h4>
280 </div>
281 </div>
282 </div>
283 <p>
284 An invalid flag value or parameter was specified.
285 </p>
286 </div>
287 </div>
288 <div class="sect2" lang="en" xml:lang="en">
289 <div class="titlepage">
290 <div>
291 <div>
292 <h3 class="title"><a id="idp51273504"></a>Class</h3>
293 </div>
294 </div>
295 </div>
296 <p>
297 <a class="link" href="env.html" title="Chapter 5.  The DB_ENV Handle">DB_ENV</a>
298 </p>
299 </div>
300 <div class="sect2" lang="en" xml:lang="en">
301 <div class="titlepage">
302 <div>
303 <div>
304 <h3 class="title"><a id="idp51280048"></a>See Also</h3>
305 </div>
306 </div>
307 </div>
308 <p>
309 <a class="xref" href="env.html#envlist" title="Database Environments and Related Methods">Database Environments and Related Methods</a>
310 </p>
311 </div>
312 </div>
313 <div class="navfooter">
314 <hr />
315 <table width="100%" summary="Navigation footer">
316 <tr>
317 <td width="40%" align="left"><a accesskey="p" href="envadd_data_dir.html">Prev</a> </td>
318 <td width="20%" align="center">
319 <a accesskey="u" href="env.html">Up</a>
320 </td>
321 <td width="40%" align="right"> <a accesskey="n" href="envclose.html">Next</a></td>
322 </tr>
323 <tr>
324 <td width="40%" align="left" valign="top">DB_ENV-&gt;add_data_dir() </td>
325 <td width="20%" align="center">
326 <a accesskey="h" href="index.html">Home</a>
327 </td>
328 <td width="40%" align="right" valign="top"> DB_ENV-&gt;close()</td>
329 </tr>
330 </table>
331 </div>
332 </body>
333 </html>