| 1 | <?xml version="1.0" encoding="UTF-8" standalone="no"?> |
| 2 | <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> |
| 3 | <html xmlns="http://www.w3.org/1999/xhtml"> |
| 4 | <head> |
| 5 | <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /> |
| 6 | <title>Database verification and salvage</title> |
| 7 | <link rel="stylesheet" href="gettingStarted.css" type="text/css" /> |
| 8 | <meta name="generator" content="DocBook XSL Stylesheets V1.73.2" /> |
| 9 | <link rel="start" href="index.html" title="Berkeley DB Programmer's Reference Guide" /> |
| 10 | <link rel="up" href="am.html" title="Chapter 3. Access Method Operations" /> |
| 11 | <link rel="prev" href="am_upgrade.html" title="Database upgrade" /> |
| 12 | <link rel="next" href="am_sync.html" title="Flushing the database cache" /> |
| 13 | </head> |
| 14 | <body> |
| 15 | <div xmlns="" class="navheader"> |
| 16 | <div class="libver"> |
| 17 | <p>Library Version 11.2.5.3</p> |
| 18 | </div> |
| 19 | <table width="100%" summary="Navigation header"> |
| 20 | <tr> |
| 21 | <th colspan="3" align="center">Database verification and salvage</th> |
| 22 | </tr> |
| 23 | <tr> |
| 24 | <td width="20%" align="left"><a accesskey="p" href="am_upgrade.html">Prev</a> </td> |
| 25 | <th width="60%" align="center">Chapter 3. |
| 26 | Access Method Operations |
| 27 | </th> |
| 28 | <td width="20%" align="right"> <a accesskey="n" href="am_sync.html">Next</a></td> |
| 29 | </tr> |
| 30 | </table> |
| 31 | <hr /> |
| 32 | </div> |
| 33 | <div class="sect1" lang="en" xml:lang="en"> |
| 34 | <div class="titlepage"> |
| 35 | <div> |
| 36 | <div> |
| 37 | <h2 class="title" style="clear: both"><a id="am_verify"></a>Database verification and salvage</h2> |
| 38 | </div> |
| 39 | </div> |
| 40 | </div> |
| 41 | <p>The <a href="../api_reference/C/dbverify.html" class="olink">DB->verify()</a> method verifies that a file, and any databases it may |
| 42 | contain, are uncorrupted. In addition, the method may optionally be |
| 43 | called with a file stream argument to which all key/data pairs found in |
| 44 | the database are output. There are two modes for finding key/data pairs |
| 45 | to be output:</p> |
| 46 | <div class="orderedlist"> |
| 47 | <ol type="1"> |
| 48 | <li>If the <a href="../api_reference/C/dbverify.html#verify_DB_SALVAGE" class="olink">DB_SALVAGE</a> flag is specified, the key/data pairs in the |
| 49 | database are output. When run in this mode, the database is assumed to |
| 50 | be largely uncorrupted. For example, the <a href="../api_reference/C/dbverify.html" class="olink">DB->verify()</a> method will |
| 51 | search for pages that are no longer linked into the database, and will |
| 52 | output key/data pairs from such pages. However, key/data items that |
| 53 | have been marked as deleted in the database will not be output, as the |
| 54 | page structures are generally trusted in this mode.</li> |
| 55 | <li>If both the <a href="../api_reference/C/dbverify.html#verify_DB_SALVAGE" class="olink">DB_SALVAGE</a> and <a href="../api_reference/C/dbverify.html#verify_DB_AGGRESSIVE" class="olink">DB_AGGRESSIVE</a> flags are |
| 56 | specified, all possible key/data pairs are output. When run in this mode, |
| 57 | the database is assumed to be seriously corrupted. For example, key/data |
| 58 | pairs that have been deleted will re-appear in the output. In addition, |
| 59 | because pages may have been subsequently reused and modified during |
| 60 | normal database operations after the key/data pairs were deleted, it is |
| 61 | not uncommon for apparently corrupted key/data pairs to be output in this |
| 62 | mode, even when there is no corruption in the underlying database. The |
| 63 | output will almost always have to be edited by hand or other means before |
| 64 | the data is ready for reload into another database. We recommend that |
| 65 | <a href="../api_reference/C/dbverify.html#verify_DB_SALVAGE" class="olink">DB_SALVAGE</a> be tried first, and <a href="../api_reference/C/dbverify.html#verify_DB_AGGRESSIVE" class="olink">DB_AGGRESSIVE</a> only tried |
| 66 | if the output from that first attempt is obviously missing data items or |
| 67 | the data is sufficiently valuable that human review of the output is |
| 68 | preferable to any kind of data loss.</li> |
| 69 | </ol> |
| 70 | </div> |
| 71 | </div> |
| 72 | <div class="navfooter"> |
| 73 | <hr /> |
| 74 | <table width="100%" summary="Navigation footer"> |
| 75 | <tr> |
| 76 | <td width="40%" align="left"><a accesskey="p" href="am_upgrade.html">Prev</a> </td> |
| 77 | <td width="20%" align="center"> |
| 78 | <a accesskey="u" href="am.html">Up</a> |
| 79 | </td> |
| 80 | <td width="40%" align="right"> <a accesskey="n" href="am_sync.html">Next</a></td> |
| 81 | </tr> |
| 82 | <tr> |
| 83 | <td width="40%" align="left" valign="top">Database upgrade </td> |
| 84 | <td width="20%" align="center"> |
| 85 | <a accesskey="h" href="index.html">Home</a> |
| 86 | </td> |
| 87 | <td width="40%" align="right" valign="top"> Flushing the database cache</td> |
| 88 | </tr> |
| 89 | </table> |
| 90 | </div> |
| 91 | </body> |
| 92 | </html> |