MAN page from Fedora 25 libdb-utils-5.3.28-24.fc25.x86_64.rpm
DB_LOAD
Section: BerkeleyDB Utilities (1)
Updated: 06 December 2016
Index NAME
db_load - Read and load data from standard input
SYNOPSIS
db_load[-nTV] [-b
blob-dir] [-c
name=
value] [-f
input][-h
home] [-P
password] [-o
blob-threshold][-t btree | hash | queue | recno]
filedb_load[-r lsn | fileid] [-h home] [-P password] file
DESCRIPTION
The
db_load utility reads from the standard input and loads it into thedatabase file. The database file is created if it does not already exist.
The input to db_load must be in the output format specified by the db_dumputility, or as specified for the -T below.
OPTIONS
- -b blob-dir
- Identifies the directory where BLOB data is stored. If this option is not specified,then BLOB data is placed in a subdirectory within the DB's environment.See also the -o option.
- -c name=value
- Specify configuration options ignoring any value they may have based onthe input. The command-line format is name=value. See theSupported Keywords section below for a list of keywords supported bythe -c option.
- -f input
- Read from the specified input file instead of from the standardinput.
- -h home
- Specify a home directory for the database environment.
If a home directory is specified, the database environment is openedusing the DB_INIT_LOCK, DB_INIT_LOG, DB_INIT_MPOOL, DB_INIT_TXN, andDB_USE_ENVIRON flags to DB_ENV->open. (This means that db_load can beused to load data into databases while they are in use by otherprocesses.) If the DB_ENV->open call fails, or if no homedirectory is specified, the database is still updated, but theenvironment is ignored; for example, no locking is done.
- -n
- Do not overwrite existing keys in the database when loading into analready existing database. If a key/data pair cannot be loaded into thedatabase for this reason, a warning message is displayed on the standarderror output, and the key/data pair are skipped.
- -o blob-threshold
- Identifies the BLOB threshold in bytes. This threshold determines whena data item will be stored as a BLOB. Data items sized less than this thresholdare stored as normal data within the database. Data items larger than this sizeare stored on-disk in a subdirectory set aside for the purpose.Use the -b command line option to identify where BLOB data is stored.
- -P password
- Specify an environment password. Although Berkeley DB utilities overwritepassword strings as soon as possible, be aware there may be a window ofvulnerability on systems where unprivileged users can see command-linearguments or where utilities are not able to overwrite the memorycontaining the command-line arguments.
- -r
- Reset the database's file ID or log sequence numbers (LSNs).
All database pages in transactional environments contain references tothe environment's log records. In order to copy a database into adifferent database environment, database page references to the oldenvironment's log records must be reset, otherwise data corruption canoccur when the database is modified in the new environment. The-r lsn option resets a database's log sequencenumbers.
All databases contain an ID string used to identify the database in thedatabase environment cache. If a database is copied, and used in thesame environment as another file with the same ID string, corruption canoccur. The -r fileid option resets a database's fileID to a new value.
In both cases, the physical file specified by the file argumentis modified in-place.
- -T
- The -T option allows non-Berkeley DB applications to easily load textfiles into databases.
If the database to be created is of type Btree or Hash, or the keywordkeys is specified as set, the input must be paired lines of text,where the first line of the pair is the key item, and the second line ofthe pair is its corresponding data item. If the database to be createdis of type Queue or Recno and the keyword keys is not set, theinput must be lines of text, where each line is a new data item for thedatabase.
A simple escape mechanism, where newline and backslash (\)characters are special, is applied to the text input. Newline charactersare interpreted as record separators. Backslash characters in the textwill be interpreted in one of two ways: If the backslash characterprecedes another backslash character, the pair will be interpreted as aliteral backslash. If the backslash character precedes any othercharacter, the two characters following the backslash will be interpretedas a hexadecimal specification of a single character; for example,\0a is a newline character in the ASCII character set.
For this reason, any backslash or newline characters that naturallyoccur in the text input must be escaped to avoid misinterpretation bydb_load.
If the -T option is specified, the underlying access method typemust be specified using the -t option.
- -t
- Specify the underlying access method. If no -t option isspecified, the database will be loaded into a database of the same typeas was dumped; for example, a Hash database will be created if a Hashdatabase was dumped.
Btree and Hash databases may be converted from one to the other. Queueand Recno databases may be converted from one to the other. If the-k option was specified on the call to db_dump then Queueand Recno databases may be converted to Btree or Hash, with the key beingthe integer record number.
- -V
- Write the library version number to the standard output, and exit.
The db_load utility may be used with a Berkeley DB environment (as described for the-h option, the environment variable DB_HOME, orbecause the utility was run in a directory containing a Berkeley DBenvironment). In order to avoid environment corruption when using aBerkeley DB environment, db_load should always be given the chance todetach from the environment and exit gracefully. To cause db_loadto release all environment resources and exit cleanly, send it aninterrupt signal (SIGINT).
EXIT STATUS
The
db_load utility exits 0 on success, 1 if one or more key/datapairs were not loaded into the database because the key already existed,and >1 if an error occurs.
ENVIRONMENT
- DB_HOME
- If the -h option is not specified and the environment variableDB_HOME is set, it is used as the path of the database home, as describedin DB_ENV->open.
EXAMPLES
The
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 thekey item and the entire password entry as the data item:
- awk -F: '{print $1; print $0}' < /etc/passwd |
- sed 's/\\/\\\\/g' | db_load -T -t hash passwd.db
Note that backslash characters naturally occurring in the text are escapedto avoid interpretation as escape characters by db_load.
SUPPORTED KEYWORDS
The following keywords are supported for the
-c command-lineption to the
db_load utility. See
DB->open for furtherdiscussion of these keywords and what values should be specified.
The parenthetical listing specifies how the value part of thename=valuepair is interpreted. Items listed as (boolean)expect value to be 1 (set) or 0 (unset). Items listedas (number) convert value to a number. Items listed as (string) usethe string value without modification.
- bt_minkey (number)
- The minimum number of keys per page.
- chksum (boolean)
- Enable page checksums.
- database (string)
- The database to load.
- db_lorder (number)
- The byte order for integers in the stored database metadata.
- db_pagesize (number)
- The size of database pages, in bytes.
- duplicates (boolean)
- The value of the DB_DUP flag.
- dupsort (boolean)
- The value of the DB_DUPSORT flag.
- extentsize (number)
- The size of database extents, in pages, for Queue databases configuredto use extents.
- h_ffactor (number)
- The density within the Hash database.
- h_nelem (number)
- The size of the Hash database.
- keys (boolean)
- Specify whether keys are present for Queue or Recno databases.
- re_len (number)
- Specify fixed-length records of the specified length.
- re_pad (string)
- Specify the fixed-length record pad character.
- recnum (boolean)
- The value of the DB_RECNUM flag.
- renumber (boolean)
- The value of the DB_RENUMBER flag.
- subdatabase (string)
- The subdatabase to load.
SEE ALSO
db_archive(1)
db_checkpoint(1)
db_deadlock(1)
db_dump(1)
db_hotbackup(1)
db_log_verify(1)
db_printlog(1)
db_recover(1)
db_replicate(1)
db_stat(1)
db_tuner(1)
db_upgrade(1)
db_verify(1)
Index
- NAME
- SYNOPSIS
- DESCRIPTION
- OPTIONS
- EXIT STATUS
- ENVIRONMENT
- EXAMPLES
- SUPPORTED KEYWORDS
- SEE ALSO
This document was created byman2html,using the manual pages.