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