2
<!--Copyright 1997-2002 by Sleepycat Software, Inc.-->
3
<!--All rights reserved.-->
4
<!--See the file LICENSE for redistribution information.-->
7
<title>Berkeley DB Reference Guide: Database verification and salvage</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><a name="3"><!--meow--></a><a name="4"><!--meow--></a>
13
<table width="100%"><tr valign=top>
14
<td><h3><dl><dt>Berkeley DB Reference Guide:<dd>Access Methods</dl></h3></td>
15
<td align=right><a href="../../ref/am/upgrade.html"><img src="../../images/prev.gif" alt="Prev"></a><a href="../../reftoc.html"><img src="../../images/ref.gif" alt="Ref"></a><a href="../../ref/am/sync.html"><img src="../../images/next.gif" alt="Next"></a>
18
<h1 align=center>Database verification and salvage</h1>
19
<p>The <a href="../../api_c/db_verify.html">DB->verify</a> method is the standard interface for verifying
20
that a file, and any databases it may contain, are uncorrupted. In
21
addition, the method may optionally be called with a file stream
22
argument to which all key/data pairs found in the database are output.
23
There are two modes for finding key/data pairs to be output:
25
<p><li>If the <a href="../../api_c/db_verify.html#DB_SALVAGE">DB_SALVAGE</a> flag is specified, the key/data pairs in the
26
database are output. When run in this mode, the database is assumed to
27
be largely uncorrupted. For example, the <a href="../../api_c/db_verify.html">DB->verify</a> method will
28
search for pages that are no longer linked into the database, and will
29
output key/data pairs from such pages. However, key/data items that
30
have been marked as deleted in the database will not be output, as the
31
page structures are generally trusted in this mode.
32
<p><li>If both the <a href="../../api_c/db_verify.html#DB_SALVAGE">DB_SALVAGE</a> and <a href="../../api_c/db_verify.html#DB_AGGRESSIVE">DB_AGGRESSIVE</a> flags are
33
specified, all possible key/data pairs are output. When run in this mode,
34
the database is assumed to be seriously corrupted. For example, key/data
35
pairs that have been deleted will re-appear in the output. In addition,
36
because pages may have been subsequently reused and modified during
37
normal database operations after the key/data pairs were deleted, it is
38
not uncommon for apparently corrupted key/data pairs to be output in this
39
mode, even when there is no corruption in the underlying database. The
40
output will almost always have to be edited by hand or other means before
41
the data is ready for reload into another database. We recommend that
42
<a href="../../api_c/db_verify.html#DB_SALVAGE">DB_SALVAGE</a> be tried first, and <a href="../../api_c/db_verify.html#DB_AGGRESSIVE">DB_AGGRESSIVE</a> only tried
43
if the output from that first attempt is obviously missing data items or
44
the data is sufficiently valuable that human review of the output is
45
preferable to any kind of data loss.
47
<table width="100%"><tr><td><br></td><td align=right><a href="../../ref/am/upgrade.html"><img src="../../images/prev.gif" alt="Prev"></a><a href="../../reftoc.html"><img src="../../images/ref.gif" alt="Ref"></a><a href="../../ref/am/sync.html"><img src="../../images/next.gif" alt="Next"></a>
49
<p><font size=1><a href="http://www.sleepycat.com">Copyright Sleepycat Software</a></font>