• Home
  • History
  • Annotate
  • Line#
  • Navigate
  • Raw
  • Download
  • only in /asuswrt-rt-n18u-9.0.0.4.380.2695/release/src-rt-6.x.4708/router/db-4.8.30/docs/api_reference/TCL/
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>berkdb env</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 TCL API Reference" />
10    <link rel="up" href="tclapi.html" title="Chapter��1.�� Berkeley DB Tcl APIs" />
11    <link rel="prev" href="env_dbrename.html" title="env dbrename" />
12    <link rel="next" href="env_remove.html" title="berkdb envremove" />
13  </head>
14  <body>
15    <div class="navheader">
16      <table width="100%" summary="Navigation header">
17        <tr>
18          <th colspan="3" align="center">berkdb env</th>
19        </tr>
20        <tr>
21          <td width="20%" align="left"><a accesskey="p" href="env_dbrename.html">Prev</a>��</td>
22          <th width="60%" align="center">Chapter��1.��
23                Berkeley DB Tcl APIs
24        </th>
25          <td width="20%" align="right">��<a accesskey="n" href="env_remove.html">Next</a></td>
26        </tr>
27      </table>
28      <hr />
29    </div>
30    <div class="sect1" lang="en" xml:lang="en">
31      <div class="titlepage">
32        <div>
33          <div>
34            <h2 class="title" style="clear: both"><a id="env_open"></a>berkdb env</h2>
35          </div>
36        </div>
37      </div>
38      <pre class="programlisting">berkdb env
39	[-cachesize {gbytes bytes ncache}]
40	[-create]
41	[-data_dir dirname]
42	[-encryptaes passwd]
43	[-encryptany passwd]
44	[-errfile filename]
45	[-home directory]
46	[-log_dir dirname]
47	[-mode mode]
48	[-private]
49	[-recover]
50	[-recover_fatal]
51	[-shm_key shmid]
52	[-system_mem]
53	[-tmp_dir dirname]
54	[-txn [nosync]]
55	[-txn_max max]
56	[-use_environ]
57	[-use_environ_root]  </pre>
58      <p>
59         The <span class="bold"><strong>berkdb env</strong></span> command opens and
60         optionally creates a database environment.  The returned environment
61         handle is bound to a Tcl command of the form <span class="bold"><strong>envN</strong></span>, where N is an integer starting at 0 (for
62         example, env0 and env1).  It is through this Tcl command that the
63         script accesses the environment methods.  The command automatically
64         initializes the Shared Memory Buffer Pool subsystem.  This subsystem
65         is used whenever the application is using any Berkeley DB access
66         method.
67    </p>
68      <p>
69        The options are as follows:
70    </p>
71      <div class="itemizedlist">
72        <ul type="disc">
73          <li>
74            <p>
75                 <span class="bold"><strong>-cachesize {gbytes bytes ncache}</strong></span> 
76            </p>
77            <p>
78                 Set the size of the database's shared memory buffer pool (that is, the
79                 cache), to <span class="bold"><strong>gbytes</strong></span> gigabytes plus
80                 <span class="bold"><strong>bytes</strong></span>.  The cache should be the size
81                 of the normal working data set of the application, with some small
82                 amount of additional memory for unusual situations. (Note: The working
83                 set is not the same as the number of simultaneously referenced pages,
84                 and should be quite a bit larger!)     
85             </p>
86            <p>
87                 The default cache size is 256KB, and may not be specified as less than
88                 20KB.  Any cache size less than 500MB is automatically increased by
89                 25% to account for buffer pool overhead; cache sizes larger than 500MB
90                 are used as specified.
91            </p>
92            <p>
93                 It is possible to specify caches to Berkeley DB that are large enough
94                 so that they cannot be allocated contiguously on some architectures;
95                 for example, some releases of Solaris limit the amount of memory that
96                 may be allocated contiguously by a process.  If <span class="bold"><strong>ncache</strong></span> is 0 or 1, the cache will be allocated
97                 contiguously in memory.  If it is greater than 1, the cache will be
98                 broken up into <span class="bold"><strong>ncache</strong></span> equally sized
99                 separate pieces of memory.
100            </p>
101            <p>
102                 For information on tuning the Berkeley DB cache size, see 
103                 <a href="../../programmer_reference/general_am_conf.html#am_conf_cachesize" class="olink">Selecting a Cache Size</a>
104                 in the <em class="citetitle">Berkeley DB Programmer's Reference Guide</em>.
105            </p>
106          </li>
107          <li>
108            <p>
109                  <span class="bold"><strong>-create</strong></span> 
110            </p>
111            <p>
112                 Cause Berkeley DB subsystems to create any underlying files, as
113                 necessary.
114            </p>
115          </li>
116          <li>
117            <p>
118                  <span class="bold"><strong>-data_dir dirname</strong></span> 
119            </p>
120            <p>
121                 Specify the environment's data directory as described in 
122                 <a href="../../programmer_reference/env_naming.html" class="olink">Berkeley DB File Naming</a>
123                 in the <em class="citetitle">Berkeley DB Programmer's Reference Guide</em>.
124            </p>
125          </li>
126          <li>
127            <p>
128                  <span class="bold"><strong>-encryptaes passwd</strong></span> 
129            </p>
130            <p>
131                 Specify the database should be encrypted with the given password using
132                 the Rijndael/AES (also known as the Advanced Encryption Standard and
133                 Federal Information Processing Standard (FIPS) 197) algorithm.
134            </p>
135          </li>
136          <li>
137            <p>
138                  <span class="bold"><strong>-encryptany passwd</strong></span> 
139            </p>
140            <p>
141                 Specify the already existing environment should be opened with the
142                 given password.  This option is used if the environment is known to be
143                 encrypted, but the specific algorithm used is not known.
144            </p>
145          </li>
146          <li>
147            <p>
148                  <span class="bold"><strong>-errfile filename</strong></span> 
149            </p>
150            <p>
151                 When an error occurs in the Berkeley DB library, a Berkeley DB error
152                 or an error return value is returned by the function. In some cases,
153                 however, the errno value may be insufficient to completely describe
154                 the cause of the error especially during initial application
155                 debugging.
156            </p>
157            <p>
158                 The <span class="bold"><strong>-errfile</strong></span> argument is used to
159                 enhance the mechanism for reporting error messages to the application
160                 by specifying a file to be used for displaying additional Berkeley DB
161                 error messages. In some cases, when an error occurs, Berkeley DB will
162                 output an additional error message to the specified file reference.
163            </p>
164            <p>
165                 consist of the environment command name (for example, env0) and a
166                 colon (":"), an error string, and a trailing &lt;newline&gt;
167                 character.
168            </p>
169            <p>
170                 This error-logging enhancement does not slow performance or
171                 significantly increase application size, and may be run during normal
172                 operation as well as during application debugging.
173            </p>
174          </li>
175          <li>
176            <p>
177                  <span class="bold"><strong>-home directory</strong></span> 
178            </p>
179            <p>
180                 The <span class="bold"><strong>-home</strong></span> argument is described in
181                 <a href="../../programmer_reference/env_naming.html" class="olink">Berkeley DB File Naming</a>
182                 in the <em class="citetitle">Berkeley DB Programmer's Reference Guide</em>.
183            </p>
184          </li>
185          <li>
186            <p>
187                  <span class="bold"><strong>-log_dir dirname</strong></span> 
188            </p>
189            <p>
190                 Specify the environment's logging file directory as described in
191                 <a href="../../programmer_reference/env_naming.html" class="olink">Berkeley DB File Naming</a>
192                 in the <em class="citetitle">Berkeley DB Programmer's Reference Guide</em>.
193            </p>
194          </li>
195          <li>
196            <p>
197                  <span class="bold"><strong>-mode mode</strong></span> 
198            </p>
199            <p>
200                 On UNIX systems, or in IEEE/ANSI Std 1003.1 (POSIX) environments, all
201                 files created by Berkeley DB are created with mode <span class="bold"><strong>mode</strong></span> (as described in <span class="bold"><strong>chmod</strong></span>(2)) and modified by the process' umask
202                 value at the time of creation (see <span class="bold"><strong>umask</strong></span>(2)).  The group ownership of created
203                 files is based on the system and directory defaults, and is not
204                 further specified by Berkeley DB. If <span class="bold"><strong>mode</strong></span> is 0, files are created readable and
205                 writable by both owner and group.  On Windows systems, the mode
206                 argument is ignored.
207            </p>
208          </li>
209          <li>
210            <p>
211                  <span class="bold"><strong>-private</strong></span> 
212            </p>
213            <p>
214                 Specify that the environment will only be accessed by a single process
215                 (although that process may be multithreaded).  This flag has two
216                 effects on the Berkeley DB environment.  First, all underlying data
217                 structures are allocated from per-process memory instead of from
218                 shared memory that is potentially accessible to more than a single
219                 process.  Second, mutexes are only configured to work between threads.
220             </p>
221            <p>
222                 This flag should not be specified if more than a single process is
223                 accessing the environment, as it is likely to cause database
224                 corruption and unpredictable behavior.  For example, if both a server
225                 application and the Berkeley DB utility 
226                 <a href="../C/db_stat.html" class="olink">db_stat</a>
227                 will access the environment, the <span class="bold"><strong>-private</strong></span> option
228                 should not be specified.
229            </p>
230          </li>
231          <li>
232            <p>
233                  <span class="bold"><strong>-recover</strong></span> 
234            </p>
235            <p>
236                 Run normal recovery on this environment before opening it for normal
237                 use. If this flag is set, the <span class="bold"><strong>-create</strong></span>
238                 option must also be set because the regions will be removed and
239                 re-created.
240            </p>
241          </li>
242          <li>
243            <p>
244                  <span class="bold"><strong>-recover_fatal</strong></span> 
245            </p>
246            <p>
247                 Run catastrophic recovery on this environment before opening it for
248                 normal use.  If this flag is set, the <span class="bold"><strong>-create</strong></span> option must also be set since the
249                 regions will be removed and re-created.
250            </p>
251          </li>
252          <li>
253            <p>
254                  <span class="bold"><strong>-shm_key key</strong></span> 
255            </p>
256            <p>
257                 Specify a base segment ID for Berkeley DB environment shared memory
258                 regions created in system memory on systems supporting X/Open-style
259                 shared memory interfaces, for example, UNIX systems supporting
260                 shmget(2) and related System V IPC interfaces.  See 
261                 <a href="../../programmer_reference/env_region.html" class="olink">Shared Memory Regions</a>
262                 in the <em class="citetitle">Berkeley DB Programmer's Reference Guide</em> for more information.
263            </p>
264          </li>
265          <li>
266            <p>
267                  <span class="bold"><strong>-system_mem</strong></span> 
268            </p>
269            <p>
270                 Allocate memory from system shared memory instead of memory backed by
271                 the filesystem.  See 
272                 <a href="../../programmer_reference/env_region.html" class="olink">Shared Memory Regions</a>
273                 in the <em class="citetitle">Berkeley DB Programmer's Reference Guide</em> for more information.
274            </p>
275          </li>
276          <li>
277            <p>
278                  <span class="bold"><strong>-tmp_dir dirname</strong></span> 
279            </p>
280            <p>
281                 Specify the environment's tmp directory, as described in 
282                 <a href="../../programmer_reference/env_naming.html" class="olink">Berkeley DB File Naming</a>
283                 in the <em class="citetitle">Berkeley DB Programmer's Reference Guide</em>.
284            </p>
285          </li>
286          <li>
287            <p>
288                  <span class="bold"><strong>-txn [nosync]</strong></span> 
289            </p>
290            <p>
291                 Initialize the Transaction subsystem.  This subsystem is used when
292                 recovery and atomicity of multiple operations and recovery are
293                 important. The <span class="bold"><strong>-txn</strong></span> option implies
294                 the initialization of the logging and locking subsystems as well.    
295             </p>
296            <p>
297                 If the optional <span class="bold"><strong>nosync</strong></span> argument is
298                 specified, the log will not be synchronously flushed on transaction
299                 commit.  This means that transactions exhibit the ACI (atomicity,
300                 consistency, and isolation) properties, but not D (durability); that
301                 is, database integrity will be maintained, but it is possible that
302                 some number of the most recently committed transactions may be undone
303                 during recovery instead of being redone.
304            </p>
305            <p>
306                 The number of transactions that are potentially at risk is governed by
307                 how often the log is checkpointed (see 
308                 <a href="../C/db_checkpoint.html" class="olink">db_checkpoint</a>
309                 in the <em class="citetitle">Berkeley DB C API</em> guide for more information) and how many 
310                 log updates can fit on a single log page.
311            </p>
312          </li>
313          <li>
314            <p>
315                  <span class="bold"><strong>-txn_max max</strong></span> 
316            </p>
317            <p>
318                 Set the maximum number of simultaneous transactions that are supported
319                 by the environment, which bounds the size of backing files.  When
320                 there are more than the specified number of concurrent transactions,
321                 calls to <span class="emphasis"><em>env</em></span> <span class="bold"><strong>txn</strong></span>
322                 will fail (until some active transactions complete).
323            </p>
324          </li>
325          <li>
326            <p>
327                  <span class="bold"><strong>-use_environ</strong></span> 
328            </p>
329            <p>
330                 The Berkeley DB process' environment may be permitted to specify
331                 information to be used when naming files; see 
332                 <a href="../../programmer_reference/env_naming.html" class="olink">Berkeley DB File Naming</a>
333                 in the <em class="citetitle">Berkeley DB Programmer's Reference Guide</em>.  Because
334                 permitting users to specify which files are used can create security
335                 problems, environment information will be used in file naming for all
336                 users only if the <span class="bold"><strong>-use_environ</strong></span> flag
337                 is set.
338            </p>
339          </li>
340          <li>
341            <p>
342                  <span class="bold"><strong>-use_environ_root</strong></span> 
343            </p>
344            <p>
345                 The Berkeley DB process' environment may be permitted to specify
346                 information to be used when naming files; see 
347                 <a href="../../programmer_reference/env_naming.html" class="olink">Berkeley DB File Naming</a>
348                 in the <em class="citetitle">Berkeley DB Programmer's Reference Guide</em>.  As
349                 permitting users to specify which files are used can create security
350                 problems, if the <span class="bold"><strong>-use_environ_root</strong></span>
351                 flag is set, environment information will be used for file naming only
352                 for users with appropriate permissions (for example, users with a
353                 user-ID of 0 on IEEE/ANSI Std 1003.1 (POSIX) systems).
354            </p>
355          </li>
356        </ul>
357      </div>
358      <p>
359         The <span class="bold"><strong>berkdb env</strong></span> command returns an
360         environment handle on success.
361    </p>
362      <p>
363        In the case of error, a Tcl error is thrown.
364    </p>
365    </div>
366    <div class="navfooter">
367      <hr />
368      <table width="100%" summary="Navigation footer">
369        <tr>
370          <td width="40%" align="left"><a accesskey="p" href="env_dbrename.html">Prev</a>��</td>
371          <td width="20%" align="center">
372            <a accesskey="u" href="tclapi.html">Up</a>
373          </td>
374          <td width="40%" align="right">��<a accesskey="n" href="env_remove.html">Next</a></td>
375        </tr>
376        <tr>
377          <td width="40%" align="left" valign="top"><span class="emphasis"><em>env</em></span> dbrename��</td>
378          <td width="20%" align="center">
379            <a accesskey="h" href="index.html">Home</a>
380          </td>
381          <td width="40%" align="right" valign="top">��berkdb envremove</td>
382        </tr>
383      </table>
384    </div>
385  </body>
386</html>
387