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>db_archive</title> 7 <link rel="stylesheet" href="apiReference.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 C++ API Reference" /> 10 <link rel="up" href="utilities.html" title="Appendix 1. Berkeley DB Command Line Utilities" /> 11 <link rel="prev" href="utilities.html" title="Appendix 1. Berkeley DB Command Line Utilities" /> 12 <link rel="next" href="db_checkpoint.html" title="db_checkpoint" /> 13 </head> 14 <body> 15 <div class="navheader"> 16 <table width="100%" summary="Navigation header"> 17 <tr> 18 <th colspan="3" align="center">db_archive</th> 19 </tr> 20 <tr> 21 <td width="20%" align="left"><a accesskey="p" href="utilities.html">Prev</a> </td> 22 <th width="60%" align="center">Appendix 1. 23 Berkeley DB Command Line Utilities 24 </th> 25 <td width="20%" align="right"> <a accesskey="n" href="db_checkpoint.html">Next</a></td> 26 </tr> 27 </table> 28 <hr /> 29 </div> 30 <div class="sect1" lang="en" xml:lang="en"> 31 <div class="titlepage"> 32 <div> 33 <div> 34 <h2 class="title" style="clear: both"><a id="db_archive"></a>db_archive</h2> 35 </div> 36 </div> 37 </div> 38 <pre class="programlisting">db_archive [-adlsVv] [-h home] [-P password] </pre> 39 <p> 40 The <span class="command"><strong>db_archive</strong></span> utility writes the pathnames of log files that are no 41 longer in use (for example, no longer involved in active 42 transactions), to the standard output, one pathname per line. These 43 log files should be written to backup media to provide for recovery in 44 the case of catastrophic failure (which also requires a snapshot of 45 the database files), but they may then be deleted from the system to 46 reclaim disk space. 47 </p> 48 <p> 49 The options are as follows: 50 </p> 51 <div class="itemizedlist"> 52 <ul type="disc"> 53 <li> 54 <p> 55 <span class="bold"><strong>-a</strong></span> 56 </p> 57 <p> 58 Write all pathnames as absolute pathnames, instead of relative to the 59 database home directory. 60 </p> 61 </li> 62 <li> 63 <p> 64 <span class="bold"><strong>-d</strong></span> 65 </p> 66 <p> 67 Remove log files that are no longer needed; no filenames are written. 68 This automatic log file removal is likely to make catastrophic recovery 69 impossible. 70 </p> 71 </li> 72 <li> 73 <p> 74 <span class="bold"><strong>-h</strong></span> 75 </p> 76 <p> 77 Specify a home directory for the database environment; by default, the 78 current working directory is used. 79 </p> 80 </li> 81 <li> 82 <p> 83 <span class="bold"><strong>-l</strong></span> 84 </p> 85 <p> 86 Write out the pathnames of all the database log files, whether or not 87 they are involved in active transactions. 88 </p> 89 </li> 90 <li> 91 <p> 92 <span class="bold"><strong>-P</strong></span> 93 </p> 94 <p> 95 Specify an environment password. Although Berkeley DB utilities 96 overwrite password strings as soon as possible, be aware there may be 97 a window of vulnerability on systems where unprivileged users can see 98 command-line arguments or where utilities are not able to overwrite 99 the memory containing the command-line arguments. 100 </p> 101 </li> 102 <li> 103 <p> 104 <span class="bold"><strong>-s</strong></span> 105 </p> 106 <p> 107 Write the pathnames of all the database files that need to be archived 108 in order to recover the database from catastrophic failure. If any of 109 the database files have not been accessed during the lifetime of the 110 current log files, <span class="command"><strong>db_archive</strong></span> will not include them 111 in this output. 112 </p> 113 <p> 114 It is possible that some of the files to which the log refers have 115 since been deleted from the system. In this case, 116 <span class="command"><strong>db_archive</strong></span> will ignore them. When 117 <a class="xref" href="db_recover.html" title="db_recover">db_recover</a> 118 is run, any files 119 to which the log refers that are not present during recovery are 120 assumed to have been deleted and will not be recovered. 121 </p> 122 </li> 123 <li> 124 <p> 125 <span class="bold"><strong>-V</strong></span> 126 </p> 127 <p> 128 Write the library version number to the standard output, and exit. 129 </p> 130 </li> 131 <li> 132 <p> 133 <span class="bold"><strong>-v</strong></span> 134 </p> 135 <p> 136 Run in verbose mode. 137 </p> 138 </li> 139 </ul> 140 </div> 141 <p> 142 Log cursor handles (returned by the <a class="xref" href="logcursor.html" title="DbEnv::log_cursor()">DbEnv::log_cursor()</a> 143 method) may have open file 144 descriptors for log files in the database environment. Also, the Berkeley DB interfaces to 145 the database environment logging subsystem (for example, 146 <a class="xref" href="logput.html" title="DbEnv::log_put()">DbEnv::log_put()</a> and 147 <a class="xref" href="txnabort.html" title="DbTxn::abort()">DbTxn::abort()</a> may allocate 148 log cursors and have open file descriptors for log files as well. On operating systems 149 where filesystem related system calls (for example, rename and unlink on Windows/NT) can 150 fail if a process has an open file descriptor for the affected file, attempting to move or 151 remove the log files listed by <span class="command"><strong>db_archive</strong></span> may fail. All Berkeley DB 152 internal use of log cursors operates on active log files only and furthermore, is 153 short-lived in nature. So, an application seeing such a failure should be restructured to 154 close any open log cursors it may have, and otherwise to retry the operation until it 155 succeeds. (Although the latter is not likely to be necessary; it is hard to imagine a 156 reason to move or rename a log file in which transactions are being logged or aborted.) 157 </p> 158 <p> 159 The <span class="command"><strong>db_archive</strong></span> utility uses a Berkeley DB environment (as described 160 for the <span class="bold"><strong>-h</strong></span> option, the environment 161 variable <span class="bold"><strong>DB_HOME</strong></span>, or because the 162 utility was run in a directory containing a Berkeley DB environment). 163 In order to avoid environment corruption when using a Berkeley DB 164 environment, <span class="command"><strong>db_archive</strong></span> should always be given the chance to detach 165 from the environment and exit gracefully. To cause <span class="command"><strong>db_archive</strong></span> to 166 release all environment resources and exit cleanly, send it an 167 interrupt signal (SIGINT). 168 </p> 169 <p> 170 The <span class="command"><strong>db_archive</strong></span> utility exits 0 on success, and >0 if an error 171 occurs. 172 </p> 173 <div class="sect2" lang="en" xml:lang="en"> 174 <div class="titlepage"> 175 <div> 176 <div> 177 <h3 class="title"><a id="id1716802"></a>Environment Variables</h3> 178 </div> 179 </div> 180 </div> 181 <div class="sect3" lang="en" xml:lang="en"> 182 <div class="titlepage"> 183 <div> 184 <div> 185 <h4 class="title"><a id="id1716736"></a>DB_HOME</h4> 186 </div> 187 </div> 188 </div> 189 <p> 190 If the <span class="bold"><strong>-h</strong></span> option is not specified and 191 the environment variable DB_HOME is set, it is used as the path of the 192 database home, as described in the 193 <a class="xref" href="envopen.html" title="DbEnv::open()">DbEnv::open()</a> method. 194 </p> 195 </div> 196 </div> 197 </div> 198 <div class="navfooter"> 199 <hr /> 200 <table width="100%" summary="Navigation footer"> 201 <tr> 202 <td width="40%" align="left"><a accesskey="p" href="utilities.html">Prev</a> </td> 203 <td width="20%" align="center"> 204 <a accesskey="u" href="utilities.html">Up</a> 205 </td> 206 <td width="40%" align="right"> <a accesskey="n" href="db_checkpoint.html">Next</a></td> 207 </tr> 208 <tr> 209 <td width="40%" align="left" valign="top">Appendix 1. 210 Berkeley DB Command Line Utilities 211 </td> 212 <td width="20%" align="center"> 213 <a accesskey="h" href="index.html">Home</a> 214 </td> 215 <td width="40%" align="right" valign="top"> db_checkpoint</td> 216 </tr> 217 </table> 218 </div> 219 </body> 220</html> 221