File: env.html

package info (click to toggle)
db4.8 4.8.30-2
  • links: PTS, VCS
  • area: main
  • in suites: squeeze
  • size: 112,668 kB
  • ctags: 53,848
  • sloc: ansic: 177,324; java: 66,060; tcl: 61,580; cs: 27,778; cpp: 24,761; sh: 15,649; perl: 14,013; xml: 8,309; makefile: 2,303; awk: 1,749; sql: 390; python: 26; php: 22; asm: 14
file content (415 lines) | stat: -rw-r--r-- 16,592 bytes parent folder | download | duplicates (2)
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
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
<?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>Chapter 9.  The Berkeley DB Environment</title>
    <link rel="stylesheet" href="gettingStarted.css" type="text/css" />
    <meta name="generator" content="DocBook XSL Stylesheets V1.73.2" />
    <link rel="start" href="index.html" title="Berkeley DB Programmer's Reference Guide" />
    <link rel="up" href="index.html" title="Berkeley DB Programmer's Reference Guide" />
    <link rel="prev" href="arch_utilities.html" title="Supporting utilities" />
    <link rel="next" href="env_create.html" title="Creating a database environment" />
  </head>
  <body>
    <div class="navheader">
      <table width="100%" summary="Navigation header">
        <tr>
          <th colspan="3" align="center">Chapter 9. 
		The Berkeley DB Environment
        </th>
        </tr>
        <tr>
          <td width="20%" align="left"><a accesskey="p" href="arch_utilities.html">Prev</a> </td>
          <th width="60%" align="center"> </th>
          <td width="20%" align="right"> <a accesskey="n" href="env_create.html">Next</a></td>
        </tr>
      </table>
      <hr />
    </div>
    <div class="chapter" lang="en" xml:lang="en">
      <div class="titlepage">
        <div>
          <div>
            <h2 class="title"><a id="env"></a>Chapter 9. 
		The Berkeley DB Environment
        </h2>
          </div>
        </div>
      </div>
      <div class="toc">
        <p>
          <b>Table of Contents</b>
        </p>
        <dl>
          <dt>
            <span class="sect1">
              <a href="env.html#env_intro">Database environment introduction</a>
            </span>
          </dt>
          <dt>
            <span class="sect1">
              <a href="env_create.html">Creating a database environment</a>
            </span>
          </dt>
          <dt>
            <span class="sect1">
              <a href="env_open.html">Opening databases within the environment</a>
            </span>
          </dt>
          <dt>
            <span class="sect1">
              <a href="env_error.html">Error support</a>
            </span>
          </dt>
          <dt>
            <span class="sect1">
              <a href="env_db_config.html">DB_CONFIG configuration file</a>
            </span>
          </dt>
          <dt>
            <span class="sect1">
              <a href="env_naming.html">File naming</a>
            </span>
          </dt>
          <dd>
            <dl>
              <dt>
                <span class="sect2">
                  <a href="env_naming.html#id1605342">Specifying file naming to Berkeley DB</a>
                </span>
              </dt>
              <dt>
                <span class="sect2">
                  <a href="env_naming.html#id1605560">Filename resolution in Berkeley DB</a>
                </span>
              </dt>
              <dt>
                <span class="sect2">
                  <a href="env_naming.html#id1605734">Examples</a>
                </span>
              </dt>
            </dl>
          </dd>
          <dt>
            <span class="sect1">
              <a href="env_region.html">Shared memory regions</a>
            </span>
          </dt>
          <dt>
            <span class="sect1">
              <a href="env_security.html">Security</a>
            </span>
          </dt>
          <dt>
            <span class="sect1">
              <a href="env_encrypt.html">Encryption</a>
            </span>
          </dt>
          <dt>
            <span class="sect1">
              <a href="env_remote.html">Remote filesystems</a>
            </span>
          </dt>
          <dt>
            <span class="sect1">
              <a href="env_faq.html">Environment FAQ</a>
            </span>
          </dt>
        </dl>
      </div>
      <div class="sect1" lang="en" xml:lang="en">
        <div class="titlepage">
          <div>
            <div>
              <h2 class="title" style="clear: both"><a id="env_intro"></a>Database environment introduction</h2>
            </div>
          </div>
        </div>
        <p>A Berkeley DB environment is an encapsulation of one or more databases, log
files and region files.  Region files are the shared memory areas that
contain information about the database environment such as memory pool
cache pages.  Only databases are byte-order independent and only
database files can be moved between machines of different byte orders.
Log files can be moved between machines of the same byte order.  Region
files are usually unique to a specific machine and potentially to a
specific operating system release.</p>
        <p>The simplest way to administer a Berkeley DB application environment is to
create a single <span class="bold"><strong>home</strong></span> directory that stores the files for the
applications that will share the environment.  The environment home
directory must be created before any Berkeley DB applications are run.  Berkeley DB
itself never creates the environment home directory.  The environment can
then be identified by the name of that directory.</p>
        <p>An environment may be shared by any number of processes, as well as by
any number of threads within those processes.  It is possible for an
environment to include resources from other directories on the system,
and applications often choose to distribute resources to other
directories or disks for performance or other reasons.  However, by
default, the databases, shared regions (the locking, logging, memory
pool, and transaction shared memory areas) and log files will be stored
in a single directory hierarchy.</p>
        <p>It is important to realize that all applications sharing a database
environment implicitly trust each other.  They have access to each
other's data as it resides in the shared regions, and they will share
resources such as buffer space and locks.  At the same time, any
applications using the same databases <span class="bold"><strong>must</strong></span> share an environment
if consistency is to be maintained between them.</p>
        <div class="informaltable">
          <table border="1" width="80%">
            <colgroup>
              <col />
              <col />
            </colgroup>
            <thead>
              <tr>
                <th>Database Environment Operations</th>
                <th>Description</th>
              </tr>
            </thead>
            <tbody>
              <tr>
                <td>
                  <a href="../api_reference/C/envcreate.html" class="olink">db_env_create()</a>
                </td>
                <td>Create an environment handle</td>
              </tr>
              <tr>
                <td><a href="../api_reference/C/dbgetenv.html" class="olink">DB-&gt;getenv()</a> handle</td>
                <td>Return <a href="../api_reference/C/db.html" class="olink">DB</a>'s underlying <a href="../api_reference/C/env.html" class="olink">DB_ENV</a> handle</td>
              </tr>
              <tr>
                <td>
                  <a href="../api_reference/C/envclose.html" class="olink">DB_ENV-&gt;close()</a>
                </td>
                <td>Close an environment</td>
              </tr>
              <tr>
                <td>
                  <a href="../api_reference/C/envdbremove.html" class="olink">DB_ENV-&gt;dbremove()</a>
                </td>
                <td>Remove a database</td>
              </tr>
              <tr>
                <td>
                  <a href="../api_reference/C/envdbrename.html" class="olink">DB_ENV-&gt;dbrename()</a>
                </td>
                <td>Rename a database</td>
              </tr>
              <tr>
                <td>
                  <a href="../api_reference/C/enverr.html" class="olink">DB_ENV-&gt;err()</a>
                </td>
                <td>Error message</td>
              </tr>
              <tr>
                <td>
                  <a href="../api_reference/C/envfailchk.html" class="olink">DB_ENV-&gt;failchk()</a>
                </td>
                <td>Check for thread failure</td>
              </tr>
              <tr>
                <td>
                  <a href="../api_reference/C/envfileid_reset.html" class="olink">DB_ENV-&gt;fileid_reset()</a>
                </td>
                <td>Reset database file IDs</td>
              </tr>
              <tr>
                <td>
                  <a href="../api_reference/C/envopen.html" class="olink">DB_ENV-&gt;open()</a>
                </td>
                <td>Return environment's home directory</td>
              </tr>
              <tr>
                <td>
                  <a href="../api_reference/C/envopen.html" class="olink">DB_ENV-&gt;open()</a>
                </td>
                <td>Return flags with which the environment was opened</td>
              </tr>
              <tr>
                <td>
                  <a href="../api_reference/C/envlsn_reset.html" class="olink">DB_ENV-&gt;lsn_reset()</a>
                </td>
                <td>Reset database file LSNs</td>
              </tr>
              <tr>
                <td>
                  <a href="../api_reference/C/envopen.html" class="olink">DB_ENV-&gt;open()</a>
                </td>
                <td>Open an environment</td>
              </tr>
              <tr>
                <td>
                  <a href="../api_reference/C/envremove.html" class="olink">DB_ENV-&gt;remove()</a>
                </td>
                <td>Remove an environment</td>
              </tr>
              <tr>
                <td>
                  <a href="../api_reference/C/envstat.html" class="olink">DB_ENV-&gt;stat()</a>
                </td>
                <td>Environment statistics</td>
              </tr>
              <tr>
                <td>
                  <a href="../api_reference/C/envstrerror.html" class="olink">db_strerror()</a>
                </td>
                <td>Error strings</td>
              </tr>
              <tr>
                <td>
                  <a href="../api_reference/C/envversion.html" class="olink">DB_ENV-&gt;version()</a>
                </td>
                <td>Return version information</td>
              </tr>
              <tr>
                <td>
                  <span class="emphasis">
                    <em>Environment Configuration</em>
                  </span>
                </td>
                <td> </td>
              </tr>
              <tr>
                <td>
                  <a href="../api_reference/C/envset_alloc.html" class="olink">DB_ENV-&gt;set_alloc()</a>
                </td>
                <td>Set local space allocation functions</td>
              </tr>
              <tr>
                <td>
                  <a href="../api_reference/C/envset_app_dispatch.html" class="olink">DB_ENV-&gt;set_app_dispatch()</a>
                </td>
                <td>Configure application recovery</td>
              </tr>
              <tr>
                <td>
                  <a href="../api_reference/C/envset_cachesize.html" class="olink">DB_ENV-&gt;set_cachesize()</a>
                </td>
                <td>Set the environment cache size</td>
              </tr>
              <tr>
                <td>
                  <a href="../api_reference/C/envset_data_dir.html" class="olink">DB_ENV-&gt;set_data_dir()</a>
                </td>
                <td>Set the environment data directory</td>
              </tr>
              <tr>
                <td>
                  <a href="../api_reference/C/envset_encrypt.html" class="olink">DB_ENV-&gt;set_encrypt()</a>
                </td>
                <td>Set the environment cryptographic key</td>
              </tr>
              <tr>
                <td>
                  <a href="../api_reference/C/envset_errcall.html" class="olink">DB_ENV-&gt;set_errcall()</a>
                </td>
                <td>Set error and informational message callbacks</td>
              </tr>
              <tr>
                <td>
                  <a href="../api_reference/C/envset_errfile.html" class="olink">DB_ENV-&gt;set_errfile()</a>
                </td>
                <td>Set error and informational message FILE</td>
              </tr>
              <tr>
                <td>
                  <a href="../api_reference/C/envset_errpfx.html" class="olink">DB_ENV-&gt;set_errpfx()</a>
                </td>
                <td>Set error message prefix</td>
              </tr>
              <tr>
                <td>
                  <a href="../api_reference/C/envevent_notify.html" class="olink">DB_ENV-&gt;set_event_notify()</a>
                </td>
                <td>Set event notification callback</td>
              </tr>
              <tr>
                <td>
                  <a href="../api_reference/C/envset_feedback.html" class="olink">DB_ENV-&gt;set_feedback()</a>
                </td>
                <td>Set feedback callback</td>
              </tr>
              <tr>
                <td>
                  <a href="../api_reference/C/envset_flags.html" class="olink">DB_ENV-&gt;set_flags()</a>
                </td>
                <td>Environment configuration</td>
              </tr>
              <tr>
                <td>
                  <a href="../api_reference/C/envset_isalive.html" class="olink">DB_ENV-&gt;set_isalive()</a>
                </td>
                <td>Set thread is-alive callback</td>
              </tr>
              <tr>
                <td>
                  <a href="../api_reference/C/envset_intermediate_dir_mode.html" class="olink">DB_ENV-&gt;set_intermediate_dir_mode()</a>
                </td>
                <td>Set intermediate directory creation mode</td>
              </tr>
              <tr>
                <td>
                  <a href="../api_reference/C/envset_shm_key.html" class="olink">DB_ENV-&gt;set_shm_key()</a>
                </td>
                <td>Set system memory shared segment ID</td>
              </tr>
              <tr>
                <td>
                  <a href="../api_reference/C/envset_thread_id.html" class="olink">DB_ENV-&gt;set_thread_id()</a>
                </td>
                <td>Set thread of control ID function</td>
              </tr>
              <tr>
                <td>
                  <a href="../api_reference/C/envset_thread_count.html" class="olink">DB_ENV-&gt;set_thread_count()</a>
                </td>
                <td>Set approximate thread count</td>
              </tr>
              <tr>
                <td>
                  <a href="../api_reference/C/envset_thread_id_string.html" class="olink">DB_ENV-&gt;set_thread_id_string()</a>
                </td>
                <td>Set thread of control ID format function</td>
              </tr>
              <tr>
                <td>
                  <a href="../api_reference/C/envset_timeout.html" class="olink">DB_ENV-&gt;set_timeout()</a>
                </td>
                <td>Set lock and transaction timeout</td>
              </tr>
              <tr>
                <td>
                  <a href="../api_reference/C/envset_tmp_dir.html" class="olink">DB_ENV-&gt;set_tmp_dir()</a>
                </td>
                <td>Set the environment temporary file directory</td>
              </tr>
              <tr>
                <td>
                  <a href="../api_reference/C/envset_verbose.html" class="olink">DB_ENV-&gt;set_verbose()</a>
                </td>
                <td>Set verbose messages</td>
              </tr>
            </tbody>
          </table>
        </div>
      </div>
    </div>
    <div class="navfooter">
      <hr />
      <table width="100%" summary="Navigation footer">
        <tr>
          <td width="40%" align="left"><a accesskey="p" href="arch_utilities.html">Prev</a> </td>
          <td width="20%" align="center"> </td>
          <td width="40%" align="right"> <a accesskey="n" href="env_create.html">Next</a></td>
        </tr>
        <tr>
          <td width="40%" align="left" valign="top">Supporting utilities </td>
          <td width="20%" align="center">
            <a accesskey="h" href="index.html">Home</a>
          </td>
          <td width="40%" align="right" valign="top"> Creating a database environment</td>
        </tr>
      </table>
    </div>
  </body>
</html>