You can configure most aspects of your Berkeley DB environment by
using the DB_CONFIG
file. This file must be
placed in your environment directory. When using the BDB SQL interface, this is
the directory created alongside of your database. It has
the same name as your database, followed by a
-journal
extension. For example, if your
database is named mydb.db
, then your
environment directory is created next to the
mydb.db
file, and it
is called mydb.db-journal
.
If a DB_CONFIG
file exists in your
environment directory, it will be read for lines of the
format NAME VALUE when
your environment is opened. This happens when your
application starts up and creates its first connection to
the database.
One or more whitespace characters are used to delimit the two parts of the line, and trailing whitespace characters are discarded. All empty lines or lines whose first character is a whitespace or hash (#) character are ignored. Each line must specify both the NAME and the VALUE of the pair. The specific NAME VALUE pairs you can use with the BDB SQL interface are documented in the Berkeley DB C API .
In some cases, you must either specify a configuration option before the environment is created, or the environment must be re-created before the configuration option will take effect. The documentation for each configuration option will indicate where this is true.
In order to provide the DB_CONFIG
file before
the environment is first created, physically make the
environment directory in the correct location in your
filesystem (this is wherever you want to place your
database file), and put the DB_CONFIG
file there before you create your database.
Some DB_CONFIG
parameters require you to
re-create your environment before they take effect.
The DB_CONFIG
parameter descriptions
indicates where this is the case.
To re-create your environment:
Make sure the DB_CONFIG
file
contains the following line:
add_data_dir ..
(This line should already be in the
DB_CONFIG
file.)
Run the db_recover command line utility. If
you run it from within your environment
(-journal
) directory, no
command line arguments are required. If you run
it from outside your environment directory, use
the -h
parameter to identify
the location of the environment:
db_recover -h /some/path/to/mydb.db-journal