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]  [-c name=value] [-f input] [-h home] [-P password] [-t
10       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 by the -T option below.
21

OPTIONS

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

EXIT STATUS

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

ENVIRONMENT

136       DB_HOME
137              If the -h option is not specified and the  environment  variable
138              DB_HOME  is set, it is used as the path of the database home, as
139              described in DB_ENV->open.
140

EXAMPLES

142       The db_load utility can be used to load text files into databases.  For
143       example, the following command loads the standard UNIX /etc/passwd file
144       into a database, with the login name as the key  item  and  the  entire
145       password entry as the data item:
146
147       awk -F: '{print $1; print $0}' < /etc/passwd |
148               sed 's/\\/\\\\/g' | db_load -T -t hash passwd.db
149
150       Note  that  backslash  characters  naturally  occurring in the text are
151       escaped to avoid interpretation as escape characters by db_load.
152

SUPPORTED KEYWORDS

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

SEE ALSO

214       db_archive(1)   db_checkpoint(1)   db_deadlock(1)   db_dump(1)  db_hot‐
215       backup(1) db_log_verify(1) db_printlog(1) db_recover(1) db_replicate(1)
216       db_stat(1) db_tuner(1) db_upgrade(1) db_verify(1)
217
218
219
220BerkeleyDB 5.3.21              06 December 2016                     DB_LOAD(1)
Impressum