libdb/docs/api_reference/C/db_dump.html
2012-11-14 16:35:20 -05:00

357 lines
16 KiB
HTML
Raw Blame History

This file contains invisible Unicode characters

This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<title>db_dump</title>
<link rel="stylesheet" href="apiReference.css" type="text/css" />
<meta name="generator" content="DocBook XSL Stylesheets V1.73.2" />
<link rel="start" href="index.html" title="Berkeley DB C API Reference" />
<link rel="up" href="utilities.html" title="Appendix A.  Berkeley DB Command Line Utilities" />
<link rel="prev" href="db_deadlock.html" title="db_deadlock" />
<link rel="next" href="db_hotbackup.html" title="db_hotbackup" />
</head>
<body>
<div xmlns="" class="navheader">
<div class="libver">
<p>Library Version 11.2.5.3</p>
</div>
<table width="100%" summary="Navigation header">
<tr>
<th colspan="3" align="center">db_dump</th>
</tr>
<tr>
<td width="20%" align="left"><a accesskey="p" href="db_deadlock.html">Prev</a> </td>
<th width="60%" align="center">Appendix A. 
Berkeley DB Command Line Utilities
</th>
<td width="20%" align="right"> <a accesskey="n" href="db_hotbackup.html">Next</a></td>
</tr>
</table>
<hr />
</div>
<div class="sect1" lang="en" xml:lang="en">
<div class="titlepage">
<div>
<div>
<h2 class="title" style="clear: both"><a id="db_dump"></a>db_dump</h2>
</div>
</div>
</div>
<pre class="programlisting">db_dump [-klNpRrV] [-d ahr]
[-f output] [-h home] [-P password] [-s database] file
db_dump [-kNpV] [-d ahr] [-f output] [-h home] -m database
db_dump185 [-p] [-f output] file </pre>
<p>
The <span class="command"><strong>db_dump</strong></span> utility reads the database file <span class="bold"><strong>file</strong></span> and writes it to the standard output using
a portable flat-text format understood by the
<a class="xref" href="db_load.html" title="db_load">db_load</a> utility. The <span class="bold"><strong>file</strong></span> argument must be a file produced using the
Berkeley DB library functions.
</p>
<p>
The <span class="command"><strong>db_dump185</strong></span> utility is
similar to the <span class="command"><strong>db_dump</strong></span> utility, except that it reads databases in the
format used by Berkeley DB versions 1.85 and 1.86.
</p>
<p>
The options are as follows:
</p>
<div class="itemizedlist">
<ul type="disc">
<li>
<p>
<span class="bold"><strong>-d</strong></span>
</p>
<p>
Dump the specified database in a format helpful for debugging the
Berkeley DB library routines.
</p>
<div class="itemizedlist">
<ul type="circle">
<li>
<p>
<span class="bold"><strong>a</strong></span>
</p>
<p>
Display all information.
</p>
</li>
<li>
<p>
<span class="bold"><strong>h</strong></span>
</p>
<p>
Display only page headers.
</p>
</li>
<li>
<p>
<span class="bold"><strong>r</strong></span>
</p>
<p>
Do not display the free-list or pages on the free list. This mode is used by
the recovery tests.
</p>
</li>
</ul>
</div>
<p>
<span class="bold"><strong>The output format of the <span class="bold"><strong>-d</strong></span> option is not standard and may change,
without notice, between releases of the Berkeley DB
library.</strong></span>
</p>
</li>
<li>
<p>
<span class="bold"><strong>-f</strong></span>
</p>
<p>
Write to the specified file instead
of to the standard output.
</p>
</li>
<li>
<p>
<span class="bold"><strong>-h</strong></span>
</p>
<p>
Specify a home directory for the database environment; by default, the
current working directory is used.
</p>
</li>
<li>
<p>
<span class="bold"><strong>-k</strong></span>
</p>
<p>
Dump record numbers from Queue and Recno databases as keys.
</p>
</li>
<li>
<p>
<span class="bold"><strong>-l</strong></span>
</p>
<p>
List the databases stored in the file.
</p>
</li>
<li>
<p>
<span class="bold"><strong>-m</strong></span>
</p>
<p>
Specify a named in-memory database to dump.
In this case the <span class="bold"><strong>file</strong></span> argument must be omitted.
</p>
</li>
<li>
<p>
<span class="bold"><strong>-N</strong></span>
</p>
<p>
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.
</p>
</li>
<li>
<p>
<span class="bold"><strong>-P</strong></span>
</p>
<p>
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.
</p>
</li>
<li>
<p>
<span class="bold"><strong>-p</strong></span>
</p>
<p>
If characters in either the key or data items are printing characters
(as defined by <span class="bold"><strong>isprint</strong></span>(3)), use
printing characters in <span class="bold"><strong>file</strong></span> to
represent them. This option permits users to use standard text
editors and tools to modify the contents of databases.
</p>
<p>
Note: different systems may have different notions about what
characters are considered <span class="emphasis"><em>printing characters</em></span>,
and databases dumped in this manner may be less portable to external
systems.
</p>
</li>
<li>
<p>
<span class="bold"><strong>-R</strong></span>
</p>
<p>
Aggressively salvage data from a possibly corrupt file. The <span class="bold"><strong>-R</strong></span> flag differs from the <span class="bold"><strong>-r</strong></span> 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
</p>
<p>
Note that this option causes the utility to verify the
integrity of the database before performing the database
dump. If this verification fails, the utility will exit
with error return <code class="literal">DB_VERIFY_BAD</code> even
though the database is successfully dumped. If you are
dumping a database known to be corrupt, you can safely
ignore a <code class="literal">DB_VERIFY_BAD</code> error return.
</p>
</li>
<li>
<p>
<span class="bold"><strong>-r</strong></span>
</p>
<p>
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.
</p>
<p>
Note that this option causes the utility to verify the
integrity of the database before performing the database
dump. If this verification fails, the utility will exit
with error return <code class="literal">DB_VERIFY_BAD</code> even
though the database is successfully dumped. If you are
dumping a database known to be corrupt, you can safely
ignore a <code class="literal">DB_VERIFY_BAD</code> error return.
</p>
</li>
<li>
<p>
<span class="bold"><strong>-s</strong></span>
</p>
<p>
Specify a single database to dump. If no database is specified, all
databases in the database file are dumped.
</p>
</li>
<li>
<p>
<span class="bold"><strong>-V</strong></span>
</p>
<p>
Write the library version number to the standard output, and exit.
</p>
</li>
</ul>
</div>
<p>
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.
</p>
<p>
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. <span class="bold"><strong>In this case,
it is quite likely that the database will be damaged beyond repair
permitting neither record storage or retrieval.</strong></span>
</p>
<p>
The only available workaround for either case is to modify the sources
for the <a class="xref" href="db_load.html" title="db_load">db_load</a> utility
to load the database using the correct hash, prefix, and comparison
functions.
</p>
<p>
The <span class="command"><strong>db_dump185</strong></span> utility
may not be available on your system because it is not always built
when the Berkeley DB libraries and utilities are installed. If you
are unable to find it, see your system administrator for further
information.
</p>
<p>
The <span class="command"><strong>db_dump</strong></span> and <span class="command"><strong>db_dump185</strong></span> utility output
formats are documented in the
<a href="../../programmer_reference/dumpload_format.html" class="olink">Dump Output Formats</a>
section of the Berkeley DB Reference Guide.
</p>
<p>
The <span class="command"><strong>db_dump</strong></span> utility may be used with a Berkeley DB
environment (as described for the <span class="bold"><strong>-h</strong></span>
option, the environment variable
<span class="bold"><strong>DB_HOME</strong></span>, 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, <span class="command"><strong>db_dump</strong></span> should always be given the chance to
detach from the environment and exit gracefully. To cause <span class="command"><strong>db_dump</strong></span> to
release all environment resources and exit cleanly, send it an
interrupt signal (SIGINT).
</p>
<p>
Even when using a Berkeley DB database environment, the db_dump
utility does not use any kind of database locking if it is invoked
with the <span class="bold"><strong>-d</strong></span>, <span class="bold"><strong>-R</strong></span>, or <span class="bold"><strong>-r</strong></span>
arguments. If used with one of these arguments, the <span class="command"><strong>db_dump</strong></span> utility
may only be safely run on databases that are not being modified by any
other process; otherwise, the output may be corrupt.
</p>
<p>
The <span class="command"><strong>db_dump</strong></span> utility exits 0 on success, and &gt;0 if an error occurs.
Note that this utility might return <code class="literal">DB_VERIFY_BAD</code> if the
<code class="literal">-R</code> or <code class="literal">-r</code> command line
options are used. This indicates a corrupt database. However, the
dump may still have been successful.
</p>
<p>
The <span class="command"><strong>db_dump185</strong></span> utility
exits 0 on success, and &gt;0 if an error occurs.
</p>
<div class="sect2" lang="en" xml:lang="en">
<div class="titlepage">
<div>
<div>
<h3 class="title"><a id="idp63105616"></a>Environment Variables</h3>
</div>
</div>
</div>
<div class="sect3" lang="en" xml:lang="en">
<div class="titlepage">
<div>
<div>
<h4 class="title"><a id="idp63105928"></a>DB_HOME</h4>
</div>
</div>
</div>
<p>
If the <span class="bold"><strong>-h</strong></span> option is not
specified and the environment variable DB_HOME is set, it
is used as the path of the database home, as described in
the <a class="xref" href="envopen.html" title="DB_ENV-&gt;open()">DB_ENV-&gt;open()</a> method.
</p>
</div>
</div>
</div>
<div class="navfooter">
<hr />
<table width="100%" summary="Navigation footer">
<tr>
<td width="40%" align="left"><a accesskey="p" href="db_deadlock.html">Prev</a> </td>
<td width="20%" align="center">
<a accesskey="u" href="utilities.html">Up</a>
</td>
<td width="40%" align="right"> <a accesskey="n" href="db_hotbackup.html">Next</a></td>
</tr>
<tr>
<td width="40%" align="left" valign="top">db_deadlock </td>
<td width="20%" align="center">
<a accesskey="h" href="index.html">Home</a>
</td>
<td width="40%" align="right" valign="top"> db_hotbackup</td>
</tr>
</table>
</div>
</body>
</html>