mirror of
				https://github.com/MariaDB/server.git
				synced 2025-10-30 04:26:45 +03:00 
			
		
		
		
	
		
			
				
	
	
		
			355 lines
		
	
	
		
			14 KiB
		
	
	
	
		
			HTML
		
	
	
	
	
	
			
		
		
	
	
			355 lines
		
	
	
		
			14 KiB
		
	
	
	
		
			HTML
		
	
	
	
	
	
| <!--Copyright 1999-2002 by Sleepycat Software, Inc.-->
 | |
| <!--All rights reserved.-->
 | |
| <html>
 | |
| <head>
 | |
|    <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
 | |
|    <meta name="GENERATOR" content="Mozilla/4.75 [en] (X11; U; Linux 2.2.16-22 i686) [Netscape]">
 | |
| </head>
 | |
| <body>
 | |
| 
 | |
| <h2>
 | |
| Environment Commands</h2>
 | |
| Environments provide a structure for creating a consistent environment
 | |
| for processes using one or more of the features of Berkeley DB.  Unlike
 | |
| some of the database commands, the environment commands are very low level.
 | |
| <br>
 | |
| <hr WIDTH="100%">
 | |
| <p>The user may create and open a new DB environment  by invoking:
 | |
| <p><b>> berkdb env</b>
 | |
| <br><b>    [-cdb] [-cdb_alldb] [-lock] [-log] [-txn [nosync]]</b>
 | |
| <br><b>    [-create] [-home<i> directory</i>] [-mode <i>mode</i>]</b>
 | |
| <br><b>    [-data_dir <i>directory</i>] [-log_dir <i>directory</i>]
 | |
| [-tmp_dir <i>directory</i>]</b>
 | |
| <br><b>    [-nommap] [-private] [-recover] [-recover_fatal]
 | |
| [-system_mem] [-errfile <i>filename</i>]</b>
 | |
| <br><b>    [-use_environ] [-use_environ_root] [-verbose
 | |
| {<i>which </i>on|off}]</b>
 | |
| <br><b>    [-region_init]</b>
 | |
| <br><b>    [-cachesize {<i>gbytes bytes ncaches</i>}]</b>
 | |
| <br><b>    [-mmapsize<i> size</i>]</b>
 | |
| <br><b>    [-log_max <i>max</i>]</b>
 | |
| <br><b>    [-log_buffer <i>size</i>]</b>
 | |
| <br><b>    [-lock_conflict {<i>nmodes </i>{<i>matrix</i>}}]</b>
 | |
| <br><b>    [-lock_detect default|oldest|random|youngest]</b>
 | |
| <br><b>    [-lock_max <i>max</i>]</b>
 | |
| <br><b>    [-lock_max_locks <i>max</i>]</b>
 | |
| <br><b>    [-lock_max_lockers <i>max</i>]</b>
 | |
| <br><b>    [-lock_max_objects <i>max</i>]</b>
 | |
| <br><b>    [-lock_timeout <i>timeout</i>]</b>
 | |
| <br><b>    [-overwrite]</b>
 | |
| <br><b>    [-txn_max <i>max</i>]</b>
 | |
| <br><b>    [-txn_timeout <i>timeout</i>]</b>
 | |
| <br><b>    [-client_timeout <i>seconds</i>]</b>
 | |
| <br><b>    [-server_timeout <i>seconds</i>]</b>
 | |
| <br><b>    [-server <i>hostname</i>]</b>
 | |
| <br><b>    [-rep_master] [-rep_client]</b>
 | |
| <br><b>    [-rep_transport <i>{ machineid sendproc }</i>]</b>
 | |
| <br> 
 | |
| <p>This command opens up an environment.   We automatically set
 | |
| the DB_THREAD and the DB_INIT_MPOOL flags.  The arguments are:
 | |
| <ul>
 | |
| <li>
 | |
| <b>-cdb</b> selects the DB_INIT_CDB flag for Concurrent Data Store</li>
 | |
| 
 | |
| <li>
 | |
| <b>-cdb_alldb</b> selects the DB_CDB_ALLDB flag for Concurrent Data Store</li>
 | |
| 
 | |
| <li>
 | |
| <b>-lock</b> selects the DB_INIT_LOCK flag for the locking subsystem</li>
 | |
| 
 | |
| <li>
 | |
| <b>-log</b> selects the DB_INIT_LOG flag for the logging subsystem</li>
 | |
| 
 | |
| <li>
 | |
| <b>-txn</b> selects the DB_INIT_TXN, DB_INIT_LOCK and DB_INIT_LOG flags
 | |
| for the transaction subsystem.  If <b>nosync</b> is specified, then
 | |
| it will also select DB_TXN_NOSYNC to indicate no flushes of log on commits</li>
 | |
| 
 | |
| <li>
 | |
| <b>-create </b>selects the DB_CREATE flag to create underlying files</li>
 | |
| 
 | |
| <li>
 | |
| <b>-home <i>directory </i></b>selects the home directory of the environment</li>
 | |
| 
 | |
| <li>
 | |
| <b>-data_dir <i>directory </i></b>selects the data file directory of the
 | |
| environment by calling <a href="../../docs/api_c/env_set_data_dir.html">DBENV->set_data_dir</a>.</li>
 | |
| 
 | |
| <li>
 | |
| <b>-log_dir <i>directory </i></b>selects the log file directory of the
 | |
| environment  by calling <a href="../../docs/api_c/env_set_lg_dir.html">DBENV->set_lg_dir</a>.</li>
 | |
| 
 | |
| <li>
 | |
| <b>-tmp_dir <i>directory </i></b>selects the temporary file directory of
 | |
| the environment  by calling <a href="../../docs/api_c/env_set_tmp_dir.so">DBENV->set_tmp_dir</a>.</li>
 | |
| 
 | |
| <li>
 | |
| <b>-mode <i>mode </i></b>sets the permissions of created files to <b><i>mode</i></b></li>
 | |
| 
 | |
| <li>
 | |
| <b>-nommap</b> selects the DB_NOMMAP flag to disallow using mmap'ed files</li>
 | |
| 
 | |
| <li>
 | |
| <b>-private</b> selects the DB_PRIVATE flag for a private environment</li>
 | |
| 
 | |
| <li>
 | |
| <b>-recover</b> selects the DB_RECOVER flag for recovery</li>
 | |
| 
 | |
| <li>
 | |
| <b>-recover_fatal</b> selects the DB_RECOVER_FATAL flag for catastrophic
 | |
| recovery</li>
 | |
| 
 | |
| <li>
 | |
| <b>-system_mem</b> selects the DB_SYSTEM_MEM flag to use system memory</li>
 | |
| 
 | |
| <li>
 | |
| <b>-errfile </b>specifies the error file to use for this environment to
 | |
| <b><i>filename</i></b>
 | |
| by calling <a href="../../docs/api_c/env_set_errfile.html">DBENV->set_errfile</a><b><i>.
 | |
| </i></b>If
 | |
| the file already exists then we will append to the end of the file</li>
 | |
| 
 | |
| <li>
 | |
| <b>-use_environ</b> selects the DB_USE_ENVIRON flag to affect file naming</li>
 | |
| 
 | |
| <li>
 | |
| <b>-use_environ_root</b> selects the DB_USE_ENVIRON_ROOT flag to have the
 | |
| root environment affect file naming</li>
 | |
| 
 | |
| <li>
 | |
| <b>-verbose</b> produces verbose error output for the given which subsystem,
 | |
| using the <a href="../../docs/api_c/dbenv_set_verbose.html">DBENV->set_verbose</a>
 | |
| method.   See the description of <a href="#> <env> verbose which on|off">verbose</a>
 | |
| below for valid <b><i>which </i></b>values</li>
 | |
| 
 | |
| <li>
 | |
| <b>-region_init </b>specifies that the user wants to page fault the region
 | |
| in on startup using the <a href="../../docs/api_c/env_set_region_init.html">DBENV->set_region_init</a>
 | |
| method call</li>
 | |
| 
 | |
| <li>
 | |
| <b>-cachesize </b>sets the size of the database cache to the size 
 | |
| specified by <b><i>gbytes </i></b>and <b><i>bytes, </i></b>broken up into
 | |
| <b><i>ncaches</i></b>
 | |
| number of caches using the <a href="../../docs/api_c/env_set_cachesize.html">DBENV->set_cachesize</a>
 | |
| method</li>
 | |
| 
 | |
| <li>
 | |
| <b>-mmapsize </b>sets the size of the database page to <b><i>size </i></b>using
 | |
| the <a href="../../docs/api_c/env_set_mp_mmapsize.html">DBENV->set_mp_mmapsize</a>
 | |
| method</li>
 | |
| 
 | |
| <li>
 | |
| <b>-log_max </b>sets the maximum size of the log file to <b><i>max</i></b>
 | |
| using the <a href="../../docs/api_c/env_set_lg_max.html">DBENV->set_lg_max</a>
 | |
| call</li>
 | |
| 
 | |
| <li>
 | |
| <b>-log_regionmax </b>sets the size of the log region to <b><i>max</i></b>
 | |
| using the <a href="../../docs/api_c/env_set_lg_regionmax.html">DBENV->set_lg_regionmax</a>
 | |
| call</li>
 | |
| 
 | |
| <li>
 | |
| <b>-log_buffer </b>sets the size of the log file in bytes to <b><i>size</i></b>
 | |
| using the <a href="../../docs/api_c/env_set_lg_bsize.html">DBENV->set_lg_bsize</a>
 | |
| call</li>
 | |
| 
 | |
| <li>
 | |
| <b>-lock_conflict </b>sets the number of lock modes to <b><i>nmodes</i></b>
 | |
| and sets the locking policy for those modes to the <b><i>conflict_matrix</i></b>
 | |
| given using the <a href="../../docs/api_c/env_set_lk_conflict.html">DBENV->set_lk_conflict</a>
 | |
| method call</li>
 | |
| 
 | |
| <li>
 | |
| <b>-lock_detect </b>sets the deadlock detection policy to the given policy
 | |
| using the <a href="../../docs/env_set_lk_detect.html">DBENV->set_lk_detect</a>
 | |
| method call.  The policy choices are:</li>
 | |
| 
 | |
| <ul>
 | |
| <li>
 | |
| <b>default</b> selects the DB_LOCK_DEFAULT policy for default detection</li>
 | |
| 
 | |
| <li>
 | |
| <b>oldest </b>selects DB_LOCK_OLDEST to abort the oldest locker on a deadlock</li>
 | |
| 
 | |
| <li>
 | |
| <b>random</b> selects DB_LOCK_RANDOM to abort a random locker on a deadlock</li>
 | |
| 
 | |
| <li>
 | |
| <b>youngest</b> selects DB_LOCK_YOUNGEST to abort the youngest locker on
 | |
| a deadlock</li>
 | |
| </ul>
 | |
| 
 | |
| <li>
 | |
| <b>-lock_max </b>sets the maximum size of the lock table to <b><i>max </i></b>using
 | |
| the <a href="../../docs/api_c/env_set_lk_max.html">DBENV->set_lk_max</a>
 | |
| method call</li>
 | |
| 
 | |
| <li>
 | |
| <b>-lock_max_locks </b>sets the maximum number of locks to <b><i>max </i></b>using
 | |
| the <a href="../../docs/api_c/env_set_lk_max_locks.html">DBENV->set_lk_max_locks</a>
 | |
| method call</li>
 | |
| 
 | |
| <li>
 | |
| <b>-lock_max_lockers </b>sets the maximum number of locking entities to
 | |
| <b><i>max
 | |
| </i></b>using the <a href="../../docs/api_c/env_set_lk_max_lockers.html">DBENV->set_lk_max_lockers</a>
 | |
| method call</li>
 | |
| 
 | |
| <li>
 | |
| <b>-lock_max_objects </b>sets the maximum number of simultaneously locked
 | |
| objects to <b><i>max </i></b>using the <a href="../../docs/api_c/env_set_lk_max_objects.html">DBENV->set_lk_max_objects</a>
 | |
| method call</li>
 | |
| 
 | |
| <li>
 | |
| <b>-lock_timeout </b>sets the timeout for locks in the environment</li>
 | |
| 
 | |
| <li>
 | |
| <b>-overwrite </b>sets DB_OVERWRITE flag</li>
 | |
| 
 | |
| <li>
 | |
| <b>-txn_max </b>sets the maximum size of the transaction table to <b><i>max</i></b>
 | |
| using the <a href="../../docs/api_c/env_set_txn_max.html">DBENV->set_txn_max</a>
 | |
| method call</li>
 | |
| 
 | |
| <li>
 | |
| <b>-txn_timeout </b>sets the timeout for transactions in the environment</li>
 | |
| 
 | |
| <li>
 | |
| <b>-client_timeout</b> sets the timeout value for the client waiting for
 | |
| a reply from the server for RPC operations to <b><i>seconds</i></b>.</li>
 | |
| 
 | |
| <li>
 | |
| <b>-server_timeout</b> sets the timeout value for the server to determine
 | |
| an idle client is gone to <b><i>seconds</i></b>.</li>
 | |
| 
 | |
| <li>
 | |
| <b>-server </b>specifies the <b><i>hostname</i></b> of the server
 | |
| to connect to in the <a href="../../docs/api_c/env_set_server.html">DBENV->set_server</a>
 | |
| call.</li>
 | |
| 
 | |
| <li>
 | |
| <b>-rep_client </b>sets the newly created environment to be a
 | |
| replication client, using the <a href="../../docs/api_c/rep_client.html">
 | |
| DBENV->rep_client</a> call.</li>
 | |
| 
 | |
| <li>
 | |
| <b>-rep_master </b>sets the newly created environment to be a
 | |
| replication master, using the <a href="../../docs/api_c/rep_master.html">
 | |
| DBENV->rep_master</a> call.</li>
 | |
| 
 | |
| <li>
 | |
| <b>-rep_transport </b>specifies the replication transport function,
 | |
| using the
 | |
| <a href="../../docs/api_c/rep_transport.html">DBENV->set_rep_transport</a>
 | |
| call.  This site's machine ID is set to <b><i>machineid</i></b> and
 | |
| the send function, a Tcl proc, is set to <b><i>sendproc</i></b>.</li>
 | |
| 
 | |
| </ul>
 | |
| 
 | |
| This command will invoke the <a href="../../docs/api_c/env_create.html">db_env_create</a>
 | |
| function.  After it successfully gets a handle to an environment,
 | |
| we bind it to a new Tcl command of the form <b><i>envX</i></b>, where X
 | |
| is an integer starting at  0 (e.g. <b>env0, env1, </b>etc). 
 | |
| We use the <i>Tcl_CreateObjCommand()</i> to create the top level environment
 | |
| command function.  It is through this handle that the user can access
 | |
| all the commands described in the <a href="#Environment Commands">Environment
 | |
| Commands</a> section.  Internally, the handle we get back from DB
 | |
| will be stored as the <i>ClientData</i> portion of the new command set
 | |
| so that all future environment calls will have that handle readily available. 
 | |
| Then we call the <a href="../../docs/api_c/env_open.html">DBENV->open</a>
 | |
| method call and possibly some number of setup calls as described above.
 | |
| <p>
 | |
| <hr WIDTH="100%">
 | |
| <br><a NAME="> <env> verbose which on|off"></a><b>> <env> verbose <i>which</i>
 | |
| on|off</b>
 | |
| <p>This command controls the use of debugging output for the environment. 
 | |
| This command directly translates to a call to the <a href="../../docs/api_c/dbenv_set_verbose.html">DBENV->set_verbose</a>
 | |
| method call.  It returns either a 0 (for success), a DB error message
 | |
| or it throws a Tcl error with a system message.  The user specifies
 | |
| <b><i>which</i></b>
 | |
| subsystem to control, and indicates whether debug messages should be turned
 | |
| <b>on</b>
 | |
| or <b>off</b> for that subsystem.  The value of <b><i>which</i></b>
 | |
| must be one of the following:
 | |
| <ul>
 | |
| <li>
 | |
| <b>chkpt</b> - Chooses the checkpointing code by using the DB_VERB_CHKPOINT
 | |
| value</li>
 | |
| 
 | |
| <li>
 | |
| <b>deadlock </b>- Chooses the deadlocking code by using the DB_VERB_DEADLOCK
 | |
| value</li>
 | |
| 
 | |
| <li>
 | |
| <b>recovery </b>- Chooses the recovery code by using the DB_VERB_RECOVERY
 | |
| value</li>
 | |
| 
 | |
| <li>
 | |
| <b>wait </b>- Chooses the waitsfor code by using the DB_VERB_WAITSFOR value</li>
 | |
| </ul>
 | |
| 
 | |
| <hr WIDTH="100%">
 | |
| <p><a NAME="> <env> close"></a><b>> <env> close</b>
 | |
| <p>This command closes an environment and deletes the handle.  This
 | |
| command directly translates to a call to the <a href="../../docs/api_c/env_close.html">DBENV->close</a>
 | |
| method call.  It returns either a 0 (for success), a DB error message
 | |
| or it throws a Tcl error with a system message.
 | |
| <p>Additionally, since the handle is no longer valid, we will call <i>Tcl_DeleteCommand()
 | |
| </i>so
 | |
| that further uses of the handle will be dealt with properly by Tcl itself.
 | |
| <p>Also, the close command will automatically abort any <a href="txn.html">transactions</a>
 | |
| and close any <a href="mpool.html">mpool</a> memory files.  As such
 | |
| we must maintain a list of open transaction and mpool handles so that we
 | |
| can call <i>Tcl_DeleteCommand</i> on those as well.
 | |
| <p>
 | |
| <hr WIDTH="100%">
 | |
| 
 | |
| <b>> berkdb envremove<br>
 | |
| [-data_dir <i>directory</i>]<br>
 | |
| [-force]<br>
 | |
| [-home <i>directory</i>]<br>
 | |
| [-log_dir <i>directory</i>]<br>
 | |
| [-overwrite]<br>
 | |
| [-tmp_dir <i>directory</i>]<br>
 | |
| [-use_environ]<br>
 | |
| [-use_environ_root]</b>
 | |
| 
 | |
| <p>This command removes the environment if it is not in use and deletes
 | |
| the handle.  This command directly translates to a call to the <a href="../../docs/api_c/env_remove.html">DBENV->remove</a>
 | |
| method call.  It returns either a 0 (for success), a DB error message
 | |
| or it throws a Tcl error with a system message.  The arguments are:
 | |
| <ul>
 | |
| <li>
 | |
| <b>-force</b> selects the DB_FORCE flag to remove even if other processes
 | |
| have the environment open</li>
 | |
| 
 | |
| <li>
 | |
| <b>-home <i>directory</i> </b>specifies the home directory of the environment</li>
 | |
| 
 | |
| <li>
 | |
| <b>-data_dir <i>directory </i></b>selects the data file directory of the
 | |
| environment by calling <a href="../../docs/api_c/env_set_data_dir.html">DBENV->set_data_dir</a>.</li>
 | |
| 
 | |
| <li>
 | |
| <b>-log_dir <i>directory </i></b>selects the log file directory of the
 | |
| environment  by calling <a href="../../docs/api_c/env_set_lg_dir.html">DBENV->set_lg_dir</a>.</li>
 | |
| 
 | |
| <li>
 | |
| <b>-overwrite </b>sets DB_OVERWRITE flag</li>
 | |
| 
 | |
| <li>
 | |
| <b>-tmp_dir <i>directory </i></b>selects the temporary file directory of
 | |
| the environment  by calling <a href="../../docs/api_c/env_set_tmp_dir.so">DBENV->set_tmp_dir</a>.</li>
 | |
| 
 | |
| <li>
 | |
| <b>-use_environ </b>selects the DB_USE_ENVIRON flag to affect file naming</li>
 | |
| 
 | |
| <li>
 | |
| <b>-use_environ_root</b> selects the DB_USE_ENVIRON_ROOT flag to affect
 | |
| file naming</li>
 | |
| </ul>
 | |
| 
 | |
| </body>
 | |
| </html>
 | 
