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