db_load
TLDR
Load data into a Berkeley DB database
SYNOPSIS
db_load [options] database.db
DESCRIPTION
db_load imports data into a Berkeley DB database. It reads key-value pairs from standard input or a file and creates or populates a BDB database file.
The tool supports different database types: btree for sorted access, hash for fast lookups, queue for FIFO operations, and recno for record number access. Configuration options control page size, caching, and duplicate handling.
Input can be flat text (with -T) where alternating lines are keys and values, or the binary-safe format produced by db_dump. The dump format handles binary data and preserves database metadata.
PARAMETERS
-T
Input is flat text (key/value pairs, alternating lines).-t type
Database type: btree, hash, queue, recno.-c name=value
Set database configuration option.-f file
Input file (default: stdin).-n
Don't overwrite existing database.-r lsn
Reset log sequence numbers.-V
Display version.
INPUT FORMAT
With -T flag (flat text):
value1
key2
value2
format=bytevalue
type=btree
HEADER=END
6b657931
76616c756531
DATA=END
CAVEATS
Berkeley DB is being phased out in favor of newer solutions (SQLite, LMDB). License changed to AGPL in version 6.x, affecting commercial use. Large imports may require tuning cache size. Database type must match existing database if not creating new.
HISTORY
Berkeley DB was developed at UC Berkeley starting in 1991 as a replacement for older Unix dbm libraries. The db_load utility has been part of BDB since early versions. Oracle acquired Sleepycat Software (BDB's commercial maintainer) in 2006. Despite being legacy technology, BDB remains in use in many systems including OpenLDAP and older versions of package managers.


