.I#Berkeley DB: db_load[P

db_load





+db_load [-nT] [-c name=value]N    [-f file] [-h home] [-t btree | hash | recno] db_file




Description



CThe db_load utility reads from the standard input and loads it intothe database db_file.DThe database db_file is created if it does not already exist.

BThe input to db_load must be in the output format specified by thecdb_dump utility, utilities, or as specified for the -Tbelow.

The options are as follows:

W

-c
Specify configuration options for the DB_INFO structure provided to`db_open ignoring any value they may have based on the input.-The command-line format is name=value.HSee Supported Keywords for a list of)supported words for the -c option.

-f
Read fromCthe specified input file instead of from the standard input.>

-h
Specify a home directory for the database.

DIf a home directory is specified, the database environment is openedCusing the DB_INIT_LOCK, DB_INIT_LOG, DB_INIT_MPOOL, DB_INIT_TXN andMDB_USE_ENVIRON flags to db_appinit.@(This means that db_load can be used to load data into databases*while they are in use by other processes.)mIf the db_appinit call fails, or if no home directory is specified,Gthe database is still updated, but the environment is ignored, e.g., nolocking is done.W

-n
Do not overwrite existing keys in the database when loading into analready existing database.FIf a key/data pair cannot be loaded into the database for this reason,Ca warning message is displayed on the standard error output and thekey/data pair are skipped.!

-T
The -TToption allows non-Berkeley DB applications to easily load text files into databases.

IIf the database to be created is of type btree or hash, the input must beGpaired lines of text, where the first line of the pair is the key item,?and the second line of the pair is its corresponding data item.JIf the database to be created is of type recno, the input must be lines of:text, where each line is a new data item for the database.

:A simple escape mechanism, where newline and backslash (\)5characters are special, is applied to the text input.8Newline characters are interpreted as record separators.HBackslash characters in the text will be interpreted in one of two ways:Iif the backslash character precedes another backslash character, the pair+will be interpreted as a literal backslash.KIf the backslash character precedes any other character, the two charactersKfollowing the backslash will be interpreted as hexadecimal specification ofAa single character, e.g., \0a is a newline character in the ASCIIcharacter set.

CFor this reason, any backslash or newline characters that naturallyEoccur in the text input must be escaped to avoid misinterpretation bydb_load.

GIf the -T option is specified, the underlying access method type-must be specified using the -t option.9

-t
Specify the underlying access method.GIf no -t option is specified, the database will be loaded into aFdatabase of the same type as was dumped, e.g., a hash database will be&created if a hash database was dumped.

@Btree and hash databases may be converted from one to the other.?Recno databases may not be converted to any other database type or from any other database type.



xThe db_archive utility attaches to one or more of the Berkeley DB shared memoryHregions. In order to avoid region corruption, it should always be givensthe chance to detach and exit gracefully. To cause db_archive to clean up<after itself and exit, send it an interrupt signal (SIGINT).

'The db_load utility exits 0 on success,1 if one or moreHkey/data pairs were not loaded into the database because the key already#existed, and >1 if an error occurs.



Examples

BThe db_load utility can be used to load text files into databases.:For example, the following command loads the standard UNIX?/etc/passwd file into a database, with the login name as<the key item and the entire password entry as the data item:



JNote that backslash characters naturally occurring in the text are escaped8to avoid interpretation as escape characters by db_load.



Environment Variables





DB_HOME
EIf the -h option is not specified and the environment variableIDB_HOME is set, it is used as the path of the database home, as described8in db_appinit.




Supported Keywords

JThe following keywords are supported for the -c command-line optionto the db_load utility.hSee db_open for further discussion of these keywords and what valuesshould be specified.

=The parenthetical listing specifies how the value part of the&name=value pair is interpreted.GItems listed as (boolean) expect value to be 1 (set) or 0(unset).3Items listed as (number) convert value to a number.>Items listed as (string) use the characters of value directly.

>
bt_minkey (number)
The minimum number of keys per page.V
db_lorder (number)
The byte order for integers in the stored database metadata.S
db_pagesize (number)
The size of pages used for nodes in the tree, in bytes.9
duplicates (boolean)
The value of the DB_DUP flag.<
h_ffactor (number)
The density within the hash table.3
h_nelem (number)
The size of the hash table.L
re_len (number)
Specify fixed-length records of the specified length.E
re_pad (string)
Specify the fixed-length record pad character.8
recnum (boolean)
The value of the DB_RECNUM flag.<
renumber (boolean)
The value of the DB_RENUMBER flag.




See Also

4db_archive,:db_checkpoint,6db_deadlock,.db_dump,db_load,4db_recover,and.db_stat.
ÿÿ