Berkeley DB Reference Guide:
Environment

PrevRefNext

Database 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 Environment OperationsDescription
db_env_createCreate an environment handle
DB_ENV->closeClose an environment
DB_ENV->dbremoveRemove a database
DB_ENV->dbrenameRename a database
DB_ENV->err, DB_ENV->errxError message
DB_ENV->get_homeReturn environment's home directory
DB_ENV->get_open_flagsReturn the flags with which the environment was opened
DB_ENV->openOpen an environment
DB_ENV->removeRemove an environment
DB_ENV->stat_printEnvironment statistics
db_strerrorError strings
db_versionReturn version information
Environment Configuration
DB_ENV->set_allocSet local space allocation functions
DB_ENV->set_app_dispatchConfigure application recovery
DB_ENV->set_cachesizeSet the environment cache size
DB_ENV->set_data_dirSet the environment data directory
DB_ENV->set_encryptSet the environment cryptographic key
DB_ENV->set_errcall, DB_ENV->set_msgcallSet error and informational message callbacks
DB_ENV->set_errfile, DB_ENV->set_msgfileSet error and informational message FILE
DB_ENV->set_errpfxSet error message prefix
DB_ENV->set_feedbackSet feedback callback
DB_ENV->set_flagsEnvironment configuration
DB_ENV->set_paniccallSet panic callback
DB_ENV->set_rpc_serverEstablish an RPC server connection
DB_ENV->set_shm_keySet system memory shared segment ID
DB_ENV->set_tas_spinsSet the number of test-and-set spins
DB_ENV->set_timeoutSet lock and transaction timeout
DB_ENV->set_tmp_dirSet the environment temporary file directory
DB_ENV->set_verboseSet verbose messages

PrevRefNext

Copyright (c) 1996-2004 Sleepycat Software, Inc. - All rights reserved.