###

Berkeley DB Reference Guide:
  Environment

# Introduction

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.

The simplest way to administer a Berkeley DB application environment is to create a single home 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.

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.

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 must share an environment if consistency is to be maintained between them.

Database Environments and Related Methods | Description
--- | ---
DB_ENV->close | Close an environment
DB_ENV->dbremove | Remove a database
DB_ENV->dbrename | Rename a database
DB_ENV->err | Error message with error string
DB_ENV->errx | Error message
DB_ENV->lock_detect | Perform deadlock detection
DB_ENV->lock_get | Acquire a lock
DB_ENV->lock_id | Acquire a locker ID
DB_ENV->lock_id_free | Release a locker ID
DB_ENV->lock_put | Release a lock
DB_ENV->lock_stat | Return lock subsystem statistics
DB_ENV->lock_vec | Acquire/release locks
DB_ENV->log_archive | List log and database files
DB_ENV->log_file | Map Log Sequence Numbers to log files
DB_ENV->log_flush | Flush log records
DB_ENV->log_put | Write a log record
DB_ENV->log_stat | Return log subsystem statistics
DB_ENV->memp_register | Register input/output functions for a file in a memory pool
DB_ENV->memp_stat | Return memory pool statistics
DB_ENV->memp_sync | Flush pages from a memory pool
DB_ENV->memp_trickle | Trickle flush pages from a memory pool
DB_ENV->open | Open an environment
DB_ENV->remove | Remove an environment
DB_ENV->rep_elect | Hold a replication election
DB_ENV->rep_process_message | Process a replication message
DB_ENV->rep_start | Configure an environment for replication
DB_ENV->rep_stat | Replication statistics
DB_ENV->set_alloc | Set local space allocation functions
DB_ENV->set_app_dispatch | Configure application recovery interface
DB_ENV->set_cachesize | Set the environment cache size
DB_ENV->set_data_dir | Set the environment data directory
DB_ENV->set_encrypt | Set the environment cryptographic key
DB_ENV->set_errcall | Set error message callback
DB_ENV->set_errfile | Set error message FILE
DbEnv::set_error_stream | Set error message output stream
DB_ENV->set_errpfx | Set error message prefix
DB_ENV->set_feedback | Set feedback callback
DB_ENV->set_flags | Environment configuration
DB_ENV->set_lg_bsize | Set log buffer size
DB_ENV->set_lg_dir | Set the environment logging directory
DB_ENV->set_lg_max | Set log file size
DB_ENV->set_lg_regionmax | Set logging region size
DB_ENV->set_lk_conflicts | Set lock conflicts matrix
DB_ENV->set_lk_detect | Set automatic deadlock detection
DB_ENV->set_lk_max_lockers | Set maximum number of lockers
DB_ENV->set_lk_max_locks | Set maximum number of locks
DB_ENV->set_lk_max_objects | Set maximum number of lock objects
DB_ENV->set_mp_mmapsize | Set maximum mapped-in database file size
DB_ENV->set_paniccall | Set panic callback
DB_ENV->set_rep_limit | Limit data sent in response to a single message
DB_ENV->set_rep_transport | Configure replication transport
DB_ENV->set_rpc_server | Establish an RPC server connection
DB_ENV->set_shm_key | Set system memory shared segment ID
DB_ENV->set_tas_spins | Set the number of test-and-set spins
DB_ENV->set_timeout | Set lock and transaction timeout
DB_ENV->set_tmp_dir | Set the environment temporary file directory
DB_ENV->set_tx_max | Set maximum number of transactions
DB_ENV->set_tx_timestamp | Set recovery timestamp
DB_ENV->set_verbose | Set verbose messages
DB_ENV->txn_begin | Begin a transaction
DB_ENV->txn_checkpoint | Checkpoint the transaction subsystem
DB_ENV->txn_recover | Distributed transaction recovery
DB_ENV->txn_stat | Return transaction subsystem statistics

Copyright Sleepycat Software