.\" Man page for BerkeleyDB utilities. Created from upstream
.\" documentation for Fedora by Petr Kubat <pkubat@redhat.com>
.\" The the text of this page is licensed under the Sleepycat Public License.
.TH DB_DUMP 1 "06 December 2016" "BerkeleyDB 5.3.28" "BerkeleyDB Utilities"
.SH NAME
db_dump \- Write database file using flat-text format
.SH SYNOPSIS
.B db_dump
[\-klNpRrV] [-b \fIblob-dir\fR] [-d ahr]
[-f \fIoutput\fR] [-h \fIhome\fR] [-P \fIpassword\fR] [-s \fIdatabase\fR] [-D \fIbytes\fR] \fIfile\fR
.sp
.B db_dump
[-kNpV] [-d ahr] [-f \fIoutput\fR] [-h \fIhome\fR] -m \fIdatabase\fR
.sp
.B db_dump185
[-p] [-f output] file
.SH DESCRIPTION
The \fBdb_dump\fR utility reads the database \fIfile\fR and writes it to the standard
output using a portable flat-text format understood by the \fIdb_load\fR utility.
The \fIfile\fR argument must be a file produced using the Berkeley DB library
functions.
The \fBdb_dump185\fR utility is similar to the db_dump utility, except that it reads
databases in the format used by Berkeley DB versions 1.85 and 1.86.
.SH OPTIONS
.TP
\fB\-b\fR \fIblob-dir\fR
Specifies the directory where BLOB data is stored for the database you are dumping.
.TP
\fB\-d\fR
Dump the specified database in a format helpful for debugging the Berkeley DB
library routines.
.RS
.IP a
Display all information.
.IP h
Display only page headers.
.IP r
Do not display the free-list or pages on the free list.  This
mode is used by the recovery tests.
.RE
.IP
\fBThe output format of the -d option is not standard and may change,
without notice, between releases of the Berkeley DB library.\fR
.TP
\fB\-D\fR \fIbytes\fR
Specifies the maximum number of bytes to dump for each key/data item found in the specified database.
This option is only valid when -da is also specified. This option overrides the value set for
the "set_data_len" parameter in your \fBDB_CONFIG\fR file, if any.
.TP
\fB\-f\fR \fIoutput\fR
Write to the specified \fIoutput\fR file instead of to the standard output.
.TP
\fB\-h\fR \fIhome\fR
Specify a home directory for the database environment; by
default, the current working directory is used.
.TP
\fB\-k\fR
Dump record numbers from Queue and Recno databases as keys.
.TP
\fB\-l\fR
List the databases stored in the file.
.TP
\fB\-N\fR
Do not acquire shared region mutexes while running.  Other problems,
such as potentially fatal errors in Berkeley DB, will be ignored as well.
This option is intended only for debugging errors, and should not be
used under any other circumstances.
.TP
\fB\-P\fR \fIpassword\fR
Specify an environment password.  Although Berkeley DB utilities overwrite
password strings as soon as possible, be aware there may be a window of
vulnerability on systems where unprivileged users can see command-line
arguments or where utilities are not able to overwrite the memory
containing the command-line arguments.
.TP
\fB\-p\fR
If characters in either the key or data items are printing characters (as
defined by \fBisprint\fR(3)), use printing characters in \fIfile\fR
to represent them.  This option permits users to use standard text editors
and tools to modify the contents of databases.
.sp
Note: different systems may have different notions about what characters
are considered printing characters, and databases dumped in
this manner may be less portable to external systems.
.TP
\fB\-R\fR
Aggressively salvage data from a possibly corrupt file.  The \fB-R\fR
flag differs from the \fB-r\fR option in that it will return all
possible data from the file at the risk of also returning already deleted
or otherwise nonsensical items.  Data dumped in this fashion will almost
certainly have to be edited by hand or other means before the data is
ready for reload into another database
.TP
\fB\-r\fR
Salvage data from a possibly corrupt file.  When used on a uncorrupted
database, this option should return equivalent data to a normal dump, but
most likely in a different order.
.TP
\fB\-s\fR \fIdatabase\fR
Specify a single database to dump.  If no database is specified, all
databases in the database file are dumped.
.TP
\fB\-V\fR
Write the library version number to the standard output, and exit.
.PP
Dumping and reloading Hash databases that use user-defined hash
functions will result in new databases that use the default hash
function.  Although using the default hash function may not be optimal
for the new database, it will continue to work correctly.
.PP
Dumping and reloading Btree databases that use user-defined prefix or
comparison functions will result in new databases that use the default
prefix and comparison functions.
\fBIn this case, it is quite likely that the database will be damaged
beyond repair permitting neither record storage or retrieval.\fR
.PP
The only available workaround for either case is to modify the sources
for the \fIdb_load\fR utility to load the database using the correct
hash, prefix, and comparison functions.
.PP
The \fBdb_dump\fR utility output format is documented in the
Dump Output Formats section of the Berkeley DB Reference Guide.
.PP
The \fBdb_dump\fR utility may be used with a Berkeley DB environment (as described for the
\fB-h\fR option, the environment variable \fBDB_HOME\fR, or
because the utility was run in a directory containing a Berkeley DB
environment).  In order to avoid environment corruption when using a
Berkeley DB environment, \fBdb_dump\fR should always be given the chance to
detach from the environment and exit gracefully.  To cause \fBdb_dump\fR
to release all environment resources and exit cleanly, send it an
interrupt signal (\fBSIGINT\fR).
.PP
Even when using a Berkeley DB database environment, the \fBdb_dump\fR
utility does not use any kind of database locking if it is invoked with
the \fB-d\fR, \fB-R\fR, or \fB-r\fR arguments.   If used with
one of these arguments, the \fBdb_dump\fR utility may only be safely
run on databases that are not being modified by any other process;
otherwise, the output may be corrupt.
.SH EXIT STATUS
The \fBdb_dump\fR utility exits 0 on success, and >0 if an error occurs.
.SH ENVIRONMENT
.TP
\fBDB_HOME\fR
If the \fB-h\fR option is not specified and the environment variable
\fBDB_HOME\fR is set, it is used as the path of the database home, as described
in \fIDB_ENV->open\fR.
.SH SEE ALSO
.BR db_archive (1)
.BR db_checkpoint (1)
.BR db_deadlock (1)
.BR db_hotbackup (1)
.BR db_log_verify (1)
.BR db_load (1)
.BR db_printlog (1)
.BR db_recover (1)
.BR db_replicate (1)
.BR db_stat (1)
.BR db_tuner (1)
.BR db_upgrade (1)
.BR db_verify (1)
