2
<!--Copyright 1997-2002 by Sleepycat Software, Inc.-->
3
<!--All rights reserved.-->
4
<!--See the file LICENSE for redistribution information.-->
7
<title>Berkeley DB: db_dump</title>
8
<meta name="description" content="Berkeley DB: An embedded database programmatic toolkit.">
9
<meta name="keywords" content="embedded,database,programmatic,toolkit,b+tree,btree,hash,hashing,transaction,transactions,locking,logging,access method,access methods,java,C,C++">
12
<a name="2"><!--meow--></a>
13
<table width="100%"><tr valign=top>
18
<a href="../api_c/c_index.html"><img src="../images/api.gif" alt="API"></a><a href="../reftoc.html"><img src="../images/ref.gif" alt="Ref"></a>
22
<h3><pre>db_dump [<b>-klNpRrV</b>] [<b>-d ahr</b>]
23
[<b>-f output</b>] [<b>-h home</b>] [<b>-P password</b>] [<b>-s database</b>] file
24
db_dump185 [<b>-p</b>] [<b>-f output</b>] file</pre></h3>
26
<a name="3"><!--meow--></a>
27
<p>The db_dump utility reads the database file <b>file</b> and
28
writes it to the standard output using a portable flat-text format
29
understood by the <a href="../utility/db_load.html">db_load</a> utility. The argument <b>file</b>
30
must be a file produced using the Berkeley DB library functions.
31
<p>The <a href="../utility/db_dump.html">db_dump185</a> utility is similar to the db_dump utility,
32
except that it reads databases in the format used by Berkeley DB versions 1.85
34
<p>The options are as follows:
36
<p><dt><b>-d</b><dd>Dump the specified database in a format helpful for debugging the Berkeley DB
39
<p><dt>a<dd>Display all information.
40
<dt>h<dd>Display only page headers.
41
<dt>r<dd>Do not display the free-list or pages on the free list. This
42
mode is used by the recovery tests.
44
<p><b>The output format of the <b>-d</b> option is not standard and may change,
45
without notice, between releases of the Berkeley DB library.</b>
46
<p><dt><b>-f</b><dd>Write to the specified <b>file</b> instead of to the standard output.
47
<p><dt><b>-h</b><dd>Specify a home directory for the database environment; by
48
default, the current working directory is used.
49
<p><dt><b>-k</b><dd>Dump record numbers from Queue and Recno databases as keys.
50
<p><dt><b>-l</b><dd>List the databases stored in the file.
51
<p><dt><b>-N</b><dd>Do not acquire shared region mutexes while running. Other problems,
52
such as potentially fatal errors in Berkeley DB, will be ignored as well.
53
This option is intended only for debugging errors, and should not be
54
used under any other circumstances.
55
<p><dt><b>-P</b><dd>Specify an environment password. Although Berkeley DB utilities overwrite
56
password strings as soon as possible, be aware there may be a window of
57
vulnerability on systems where unprivileged users can see command-line
58
arguments or where utilities are not able to overwrite the memory
59
containing the command-line arguments.
60
<p><dt><b>-p</b><dd>If characters in either the key or data items are printing characters (as
61
defined by <b>isprint</b>(3)), use printing characters in <b>file</b>
62
to represent them. This option permits users to use standard text editors
63
and tools to modify the contents of databases.
64
<p>Note: different systems may have different notions about what characters
65
are considered <i>printing characters</i>, and databases dumped in
66
this manner may be less portable to external systems.
67
<p><dt><b>-R</b><dd>Aggressively salvage data from a possibly corrupt file. The <b>-R</b>
68
flag differs from the <b>-r</b> option in that it will return all
69
possible data from the file at the risk of also returning already deleted
70
or otherwise nonsensical items. Data dumped in this fashion will almost
71
certainly have to be edited by hand or other means before the data is
72
ready for reload into another database
73
<p><dt><b>-r</b><dd>Salvage data from a possibly corrupt file. When used on a uncorrupted
74
database, this option should return equivalent data to a normal dump, but
75
most likely in a different order.
76
<p><dt><b>-s</b><dd>Specify a single database to dump. If no database is specified, all
77
databases in the database file are dumped.
78
<p><dt><b>-V</b><dd>Write the library version number to the standard output, and exit.
80
<p>Dumping and reloading Hash databases that use user-defined hash
81
functions will result in new databases that use the default hash
82
function. Although using the default hash function may not be optimal
83
for the new database, it will continue to work correctly.
84
<p>Dumping and reloading Btree databases that use user-defined prefix or
85
comparison functions will result in new databases that use the default
86
prefix and comparison functions.
87
<b>In this case, it is quite likely that the database will be damaged
88
beyond repair permitting neither record storage or retrieval.</b>
89
<p>The only available workaround for either case is to modify the sources
90
for the <a href="../utility/db_load.html">db_load</a> utility to load the database using the correct
91
hash, prefix, and comparison functions.
92
<p>The <a href="../utility/db_dump.html">db_dump185</a> utility may not be available on your system
93
because it is not always built when the Berkeley DB libraries and utilities
94
are installed. If you are unable to find it, see your system
95
administrator for further information.
96
<p>The db_dump and <a href="../utility/db_dump.html">db_dump185</a> utility output formats are
97
documented in the <a href="../ref/dumpload/format.html">Dump Output
98
Formats</a> section of the Berkeley DB Reference Guide.
99
<p>The db_dump utility may be used with a Berkeley DB environment (as described for the
100
<b>-h</b> option, the environment variable <b>DB_HOME</b>, or
101
because the utility was run in a directory containing a Berkeley DB
102
environment). In order to avoid environment corruption when using a
103
Berkeley DB environment, db_dump should always be given the chance to
104
detach from the environment and exit gracefully. To cause db_dump
105
to release all environment resources and exit cleanly, send it an
106
interrupt signal (SIGINT).
107
<p>Even when using a Berkeley DB database environment, the db_dump
108
utility does not use any kind of database locking if it is invoked with
109
the <b>-d</b>, <b>-R</b>, or <b>-r</b> arguments. If used with
110
one of these arguments, the db_dump utility may only be safely
111
run on databases that are not being modified by any other process;
112
otherwise, the output may be corrupt.
113
<p>The db_dump utility exits 0 on success, and >0 if an error occurs.
114
<p>The <a href="../utility/db_dump.html">db_dump185</a> utility exits 0 on success, and >0 if an error occurs.
115
<h1>Environment Variables</h1>
117
<p><dt>DB_HOME<dd>If the <b>-h</b> option is not specified and the environment variable
118
DB_HOME is set, it is used as the path of the database home, as described
119
in <a href="../api_c/env_open.html">DB_ENV->open</a>.
122
<p><font size=1><a href="http://www.sleepycat.com">Copyright Sleepycat Software</a></font>