1DB_LOAD(1)                   BerkeleyDB Utilities                   DB_LOAD(1)
2
3
4

NAME

6       db_load - Read and load data from standard input
7

SYNOPSIS

9       db_load  [-nTV]  [-b blob-dir] [-c name=value] [-f input] [-h home] [-P
10       password] [-o blob-threshold] [-t btree | hash | queue | recno] file
11
12       db_load [-r lsn | fileid] [-h home] [-P password] file
13

DESCRIPTION

15       The db_load utility reads from the standard input and loads it into the
16       database  file.  The  database  file  is created if it does not already
17       exist.
18
19       The input to db_load must be in the  output  format  specified  by  the
20       db_dump utility, or as specified for the -T below.
21

OPTIONS

23       -b blob-dir
24              Identifies  the  directory  where  BLOB  data is stored. If this
25              option is not specified, then BLOB data is placed in a subdirec‐
26              tory within the DB's environment.  See also the -o option.
27
28       -c name=value
29              Specify  configuration  options ignoring any value they may have
30              based on the input.  The command-line format is name=value.  See
31              the Supported Keywords section below for a list of keywords sup‐
32              ported by the -c option.
33
34       -f input
35              Read from the specified input file instead of from the  standard
36              input.
37
38       -h home
39              Specify a home directory for the database environment.
40
41              If  a  home  directory is specified, the database environment is
42              opened  using  the  DB_INIT_LOCK,  DB_INIT_LOG,   DB_INIT_MPOOL,
43              DB_INIT_TXN,  and  DB_USE_ENVIRON  flags to DB_ENV->open.  (This
44              means that db_load can be used to load data into databases while
45              they  are  in  use by other processes.) If the DB_ENV->open call
46              fails, or if no home directory is  specified,  the  database  is
47              still  updated,  but the environment is ignored; for example, no
48              locking is done.
49
50       -n     Do not overwrite existing keys in the database when loading into
51              an  already  existing  database.   If  a key/data pair cannot be
52              loaded into the database for this reason, a warning  message  is
53              displayed  on  the  standard error output, and the key/data pair
54              are skipped.
55
56       -o blob-threshold
57              Identifies the BLOB threshold in bytes.  This  threshold  deter‐
58              mines  when  a  data  item  will be stored as a BLOB. Data items
59              sized less than this threshold are stored as normal data  within
60              the  database.  Data  items larger than this size are stored on-
61              disk in a subdirectory set aside for the purpose.   Use  the  -b
62              command line option to identify where BLOB data is stored.
63
64       -P password
65              Specify an environment password.  Although Berkeley DB utilities
66              overwrite password strings as soon as possible, be  aware  there
67              may  be  a window of vulnerability on systems where unprivileged
68              users can see command-line arguments or where utilities are  not
69              able  to  overwrite the memory containing the command-line argu‐
70              ments.
71
72       -r     Reset the database's file ID or log sequence numbers (LSNs).
73
74              All database pages in transactional environments contain  refer‐
75              ences  to  the  environment's  log  records.  In order to copy a
76              database into a different database  environment,  database  page
77              references  to  the old environment's log records must be reset,
78              otherwise data corruption can occur when the database  is  modi‐
79              fied  in  the new environment.  The -r lsn option resets a data‐
80              base's log sequence numbers.
81
82              All databases contain an ID string used to identify the database
83              in the database environment cache.  If a database is copied, and
84              used in the same environment as another file with  the  same  ID
85              string,  corruption  can  occur.  The -r fileid  option resets a
86              database's file ID to a new value.
87
88              In both cases, the physical file specified by the file  argument
89              is modified in-place.
90
91       -T     The -T option allows non-Berkeley DB applications to easily load
92              text files into databases.
93
94              If the database to be created is of type Btree or Hash,  or  the
95              keyword keys is specified as set, the input must be paired lines
96              of text, where the first line of the pair is the key  item,  and
97              the  second line of the pair is its corresponding data item.  If
98              the database to be created is of type Queue  or  Recno  and  the
99              keyword  keys is not set, the input must be lines of text, where
100              each line is a new data item for the database.
101
102              A simple escape mechanism, where newline and backslash (\) char‐
103              acters are special, is applied to the text input.  Newline char‐
104              acters are interpreted as record separators.  Backslash  charac‐
105              ters  in the text will be interpreted in one of two ways: If the
106              backslash character precedes another  backslash  character,  the
107              pair  will  be interpreted as a literal backslash.  If the back‐
108              slash character precedes any other character, the two characters
109              following  the  backslash  will  be interpreted as a hexadecimal
110              specification of a single character; for example, \0a is a  new‐
111              line character in the ASCII character set.
112
113              For  this reason, any backslash or newline characters that natu‐
114              rally occur in the text input must be escaped to avoid misinter‐
115              pretation by db_load.
116
117              If the -T option is specified, the underlying access method type
118              must be specified using the -t option.
119
120       -t     Specify the underlying access method.  If no -t option is speci‐
121              fied,  the  database  will be loaded into a database of the same
122              type as was dumped; for example, a Hash database will be created
123              if a Hash database was dumped.
124
125              Btree and Hash databases may be converted from one to the other.
126              Queue and Recno databases may  be  converted  from  one  to  the
127              other.   If  the  -k option was specified on the call to db_dump
128              then Queue and Recno databases may  be  converted  to  Btree  or
129              Hash, with the key being the integer record number.
130
131       -V     Write  the  library  version  number to the standard output, and
132              exit.
133
134       The db_load utility may be used with  a  Berkeley  DB  environment  (as
135       described  for  the  -h  option,  the  environment variable DB_HOME, or
136       because the utility was run in a directory  containing  a  Berkeley  DB
137       environment).   In  order  to avoid environment corruption when using a
138       Berkeley DB environment, db_load should always be given the  chance  to
139       detach  from  the environment and exit gracefully.  To cause db_load to
140       release all environment resources and exit cleanly, send it  an  inter‐
141       rupt signal (SIGINT).
142

EXIT STATUS

144       The db_load utility exits 0 on success, 1 if one or more key/data pairs
145       were not loaded into the database because the key already existed,  and
146       >1 if an error occurs.
147

ENVIRONMENT

149       DB_HOME
150              If  the  -h option is not specified and the environment variable
151              DB_HOME is set, it is used as the path of the database home,  as
152              described in DB_ENV->open.
153

EXAMPLES

155       The db_load utility can be used to load text files into databases.  For
156       example, the following command loads the standard UNIX /etc/passwd file
157       into  a  database,  with  the login name as the key item and the entire
158       password entry as the data item:
159
160       awk -F: '{print $1; print $0}' < /etc/passwd |
161               sed 's/\\/\\\\/g' | db_load -T -t hash passwd.db
162
163       Note that backslash characters naturally  occurring  in  the  text  are
164       escaped to avoid interpretation as escape characters by db_load.
165

SUPPORTED KEYWORDS

167       The  following  keywords are supported for the -c command-line ption to
168       the db_load utility.  See DB->open for further discussion of these key‐
169       words and what values should be specified.
170
171       The   parenthetical  listing  specifies  how  the  value  part  of  the
172       name=value pair is interpreted.  Items listed as (boolean) expect value
173       to  be 1 (set) or 0 (unset).  Items listed as (number) convert value to
174       a number.  Items listed as (string) use the string value without  modi‐
175       fication.
176
177       bt_minkey (number)
178              The minimum number of keys per page.
179
180       chksum (boolean)
181              Enable page checksums.
182
183       database (string)
184              The database to load.
185
186       db_lorder (number)
187              The byte order for integers in the stored database metadata.
188
189       db_pagesize (number)
190              The size of database pages, in bytes.
191
192       duplicates (boolean)
193              The value of the DB_DUP flag.
194
195       dupsort (boolean)
196              The value of the DB_DUPSORT flag.
197
198       extentsize (number)
199              The size of database extents, in pages, for Queue databases con‐
200              figured to use extents.
201
202       h_ffactor (number)
203              The density within the Hash database.
204
205       h_nelem (number)
206              The size of the Hash database.
207
208       keys (boolean)
209              Specify whether keys are present for Queue or Recno databases.
210
211       re_len (number)
212              Specify fixed-length records of the specified length.
213
214       re_pad (string)
215              Specify the fixed-length record pad character.
216
217       recnum (boolean)
218              The value of the DB_RECNUM flag.
219
220       renumber (boolean)
221              The value of the DB_RENUMBER flag.
222
223       subdatabase (string)
224              The subdatabase to load.
225

SEE ALSO

227       db_archive(1)  db_checkpoint(1)   db_deadlock(1)   db_dump(1)   db_hot‐
228       backup(1) db_log_verify(1) db_printlog(1) db_recover(1) db_replicate(1)
229       db_stat(1) db_tuner(1) db_upgrade(1) db_verify(1)
230
231
232
233BerkeleyDB 5.3.28              06 December 2016                     DB_LOAD(1)
Impressum