1<!--$Id: verify.so,v 10.10 2003/10/18 19:15:54 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 Reference Guide: Database verification and salvage</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<a name="2"><!--meow--></a><a name="3"><!--meow--></a><a name="4"><!--meow--></a> 12<table width="100%"><tr valign=top> 13<td><b><dl><dt>Berkeley DB Reference Guide:<dd>Access Methods</dl></b></td> 14<td align=right><a href="/am/upgrade.html"><img src="/images/prev.gif" alt="Prev"></a><a href="/toc.html"><img src="/images/ref.gif" alt="Ref"></a><a href="/am/sync.html"><img src="/images/next.gif" alt="Next"></a> 15</td></tr></table> 16<p align=center><b>Database verification and salvage</b></p> 17<p>The <a href="/api_c/db_verify.html">DB->verify</a> method verifies that a file, and any databases it may 18contain, are uncorrupted. In addition, the method may optionally be 19called with a file stream argument to which all key/data pairs found in 20the database are output. There are two modes for finding key/data pairs 21to be output:</p> 22<ol> 23<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 24database are output. When run in this mode, the database is assumed to 25be largely uncorrupted. For example, the <a href="/api_c/db_verify.html">DB->verify</a> method will 26search for pages that are no longer linked into the database, and will 27output key/data pairs from such pages. However, key/data items that 28have been marked as deleted in the database will not be output, as the 29page structures are generally trusted in this mode. 30<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 31specified, all possible key/data pairs are output. When run in this mode, 32the database is assumed to be seriously corrupted. For example, key/data 33pairs that have been deleted will re-appear in the output. In addition, 34because pages may have been subsequently reused and modified during 35normal database operations after the key/data pairs were deleted, it is 36not uncommon for apparently corrupted key/data pairs to be output in this 37mode, even when there is no corruption in the underlying database. The 38output will almost always have to be edited by hand or other means before 39the data is ready for reload into another database. We recommend that 40<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 41if the output from that first attempt is obviously missing data items or 42the data is sufficiently valuable that human review of the output is 43preferable to any kind of data loss. 44</ol> 45<table width="100%"><tr><td><br></td><td align=right><a href="/am/upgrade.html"><img src="/images/prev.gif" alt="Prev"></a><a href="/toc.html"><img src="/images/ref.gif" alt="Ref"></a><a href="/am/sync.html"><img src="/images/next.gif" alt="Next"></a> 46</td></tr></table> 47<p><font size=1>Copyright (c) 1996,2008 Oracle. All rights reserved.</font> 48</body> 49</html> 50