| 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_recover</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="db_printlog.html" title="db_printlog" /> |
| 12 | <link rel="next" href="db_replicate.html" title="db_replicate" /> |
| 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_recover</th> |
| 22 | </tr> |
| 23 | <tr> |
| 24 | <td width="20%" align="left"><a accesskey="p" href="db_printlog.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_replicate.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_recover"></a>db_recover</h2> |
| 38 | </div> |
| 39 | </div> |
| 40 | </div> |
| 41 | <pre class="programlisting">db_recover [-cefVv] [-h home] [-P password] [-t [[CC]YY]MMDDhhmm[.SS]]] </pre> |
| 42 | <p> |
| 43 | The <span class="command"><strong>db_recover</strong></span> utility must be run after an unexpected application, |
| 44 | Berkeley DB, or system failure to restore the database to a consistent |
| 45 | state. All committed transactions are guaranteed to appear after |
| 46 | <span class="command"><strong>db_recover</strong></span> has run, and all uncommitted transactions will be |
| 47 | completely undone. |
| 48 | </p> |
| 49 | <p> |
| 50 | Note that this utility performs the same action as if the |
| 51 | environment is opened with the |
| 52 | <a class="link" href="envopen.html#envopen_DB_RECOVER">DB_RECOVER</a> |
| 53 | flag. If <code class="literal">DB_RECOVER</code> is specified on environment open, |
| 54 | then use of this utility is not necessary. |
| 55 | </p> |
| 56 | <div class="note" style="margin-left: 0.5in; margin-right: 0.5in;"> |
| 57 | <h3 class="title">Note</h3> |
| 58 | <p> |
| 59 | If the application(s) that use the environment make use of |
| 60 | any of the following methods: |
| 61 | </p> |
| 62 | <table class="simplelist" border="0" summary="Simple list"> |
| 63 | <tr> |
| 64 | <td> |
| 65 | <a class="xref" href="envadd_data_dir.html" title="DB_ENV->add_data_dir()">DB_ENV->add_data_dir()</a> |
| 66 | </td> |
| 67 | </tr> |
| 68 | <tr> |
| 69 | <td> |
| 70 | <a class="xref" href="envset_data_dir.html" title="DB_ENV->set_data_dir()">DB_ENV->set_data_dir()</a> |
| 71 | </td> |
| 72 | </tr> |
| 73 | <tr> |
| 74 | <td> |
| 75 | <a class="xref" href="envset_lg_dir.html" title="DB_ENV->set_lg_dir()">DB_ENV->set_lg_dir()</a> |
| 76 | </td> |
| 77 | </tr> |
| 78 | </table> |
| 79 | <p> |
| 80 | then in order for this utility to run correctly, you need a |
| 81 | <a href="../../programmer_reference/env_db_config.html#env_db_config.DB_CONFIG" class="olink">DB_CONFIG</a> |
| 82 | file which sets the proper paths using the |
| 83 | <a class="xref" href="add_data_dir_parameter.html" title="add_data_dir">add_data_dir</a>, or |
| 84 | <a class="xref" href="set_lg_dir_parameter.html" title="set_lg_dir">set_lg_dir</a> |
| 85 | configuration parameters. |
| 86 | </p> |
| 87 | </div> |
| 88 | <p> |
| 89 | The options are as follows: |
| 90 | </p> |
| 91 | <div class="itemizedlist"> |
| 92 | <ul type="disc"> |
| 93 | <li> |
| 94 | <p> |
| 95 | <span class="bold"><strong>-c</strong></span> |
| 96 | </p> |
| 97 | <p> |
| 98 | Perform catastrophic recovery instead of normal recovery. |
| 99 | </p> |
| 100 | </li> |
| 101 | <li> |
| 102 | <p> |
| 103 | <span class="bold"><strong>-e</strong></span> |
| 104 | </p> |
| 105 | <p> |
| 106 | Retain the environment after running recovery. This |
| 107 | option will rarely be used unless a <a href="../../programmer_reference/env_db_config.html#env_db_config.DB_CONFIG" class="olink">DB_CONFIG</a> file is |
| 108 | present in the home directory. If a <a href="../../programmer_reference/env_db_config.html#env_db_config.DB_CONFIG" class="olink">DB_CONFIG</a> file is |
| 109 | not present, then the regions will be created with default |
| 110 | parameter values. |
| 111 | </p> |
| 112 | </li> |
| 113 | <li> |
| 114 | <p> |
| 115 | <span class="bold"><strong>-f</strong></span> |
| 116 | </p> |
| 117 | <p> |
| 118 | Display a message on the standard output showing the percent of |
| 119 | recovery completed. |
| 120 | </p> |
| 121 | </li> |
| 122 | <li> |
| 123 | <p> |
| 124 | <span class="bold"><strong>-h</strong></span> |
| 125 | </p> |
| 126 | <p> |
| 127 | Specify a home directory for the database environment; by default, the |
| 128 | current working directory is used. |
| 129 | </p> |
| 130 | </li> |
| 131 | <li> |
| 132 | <p> |
| 133 | <span class="bold"><strong>-P</strong></span> |
| 134 | </p> |
| 135 | <p> |
| 136 | Specify an environment password. Although Berkeley DB utilities |
| 137 | overwrite password strings as soon as possible, be aware there may be |
| 138 | a window of vulnerability on systems where unprivileged users can see |
| 139 | command-line arguments or where utilities are not able to overwrite |
| 140 | the memory containing the command-line arguments. |
| 141 | </p> |
| 142 | </li> |
| 143 | <li> |
| 144 | <p> |
| 145 | <span class="bold"><strong>-t</strong></span> |
| 146 | </p> |
| 147 | <p> |
| 148 | Recover to the time specified rather than to the most current possible |
| 149 | date. The timestamp argument should be in the form |
| 150 | <code class="literal">[[CC]YY]MMDDhhmm[.SS]</code> where each pair of letters represents the |
| 151 | following: |
| 152 | </p> |
| 153 | <div class="itemizedlist"> |
| 154 | <ul type="circle"> |
| 155 | <li> |
| 156 | <p> |
| 157 | <span class="bold"><strong>CC</strong></span> |
| 158 | </p> |
| 159 | <p> |
| 160 | The first two digits of the year (the century). |
| 161 | </p> |
| 162 | </li> |
| 163 | <li> |
| 164 | <p> |
| 165 | <span class="bold"><strong>YY</strong></span> |
| 166 | </p> |
| 167 | <p> |
| 168 | The second two digits of the year. If "YY" is specified, but "CC" is not, a |
| 169 | value for "YY" between 69 and 99 results in a "CC" value of 19. Otherwise, a |
| 170 | "CC" value of 20 is used. |
| 171 | </p> |
| 172 | </li> |
| 173 | <li> |
| 174 | <p> |
| 175 | <span class="bold"><strong>MM</strong></span> |
| 176 | </p> |
| 177 | <p> |
| 178 | The month of the year, from 1 to 12. |
| 179 | </p> |
| 180 | </li> |
| 181 | <li> |
| 182 | <p> |
| 183 | <span class="bold"><strong>DD</strong></span> |
| 184 | </p> |
| 185 | <p> |
| 186 | The day of the month, from 1 to 31. |
| 187 | </p> |
| 188 | </li> |
| 189 | <li> |
| 190 | <p> |
| 191 | <span class="bold"><strong>hh</strong></span> |
| 192 | </p> |
| 193 | <p> |
| 194 | The hour of the day, from 0 to 23. |
| 195 | </p> |
| 196 | </li> |
| 197 | <li> |
| 198 | <p> |
| 199 | <span class="bold"><strong>mm</strong></span> |
| 200 | </p> |
| 201 | <p> |
| 202 | The minute of the hour, from 0 to 59. |
| 203 | </p> |
| 204 | </li> |
| 205 | <li> |
| 206 | <p> |
| 207 | <span class="bold"><strong>SS</strong></span> |
| 208 | </p> |
| 209 | <p> |
| 210 | The second of the minute, from 0 to 61. |
| 211 | </p> |
| 212 | </li> |
| 213 | </ul> |
| 214 | </div> |
| 215 | <p> |
| 216 | If the "CC" and "YY" letter pairs are not specified, the values |
| 217 | default to the current year. If the "SS" letter pair is not |
| 218 | specified, the value defaults to 0. |
| 219 | </p> |
| 220 | </li> |
| 221 | <li> |
| 222 | <p> |
| 223 | <span class="bold"><strong>-V</strong></span> |
| 224 | </p> |
| 225 | <p> |
| 226 | Write the library version number to the standard output, and exit. |
| 227 | </p> |
| 228 | </li> |
| 229 | <li> |
| 230 | <p> |
| 231 | <span class="bold"><strong>-v</strong></span> |
| 232 | </p> |
| 233 | <p> |
| 234 | Run in verbose mode. |
| 235 | </p> |
| 236 | </li> |
| 237 | </ul> |
| 238 | </div> |
| 239 | <p> |
| 240 | In the case of catastrophic recovery, an archival copy — or |
| 241 | <span class="emphasis"><em>snapshot</em></span> — of all database files must be |
| 242 | restored along with all of the log files written since the database |
| 243 | file snapshot was made. (If disk space is a problem, log files may be |
| 244 | referenced by symbolic links). |
| 245 | |
| 246 | <span> |
| 247 | For further information on creating a database snapshot, see |
| 248 | <a href="../../programmer_reference/transapp_archival.html" class="olink">Archival Procedures</a>. |
| 249 | For further information on performing recovery, see |
| 250 | <a href="../../programmer_reference/transapp_recovery.html" class="olink">Recovery Procedures</a>. |
| 251 | </span> |
| 252 | </p> |
| 253 | <p> |
| 254 | If the failure was not catastrophic, the files present on the system |
| 255 | at the time of failure are sufficient to perform recovery. |
| 256 | </p> |
| 257 | <p> |
| 258 | If log files are missing, <span class="command"><strong>db_recover</strong></span> will identify the missing log |
| 259 | file(s) and fail, in which case the missing log files need to be |
| 260 | restored and recovery performed again. |
| 261 | </p> |
| 262 | <p> |
| 263 | The <span class="command"><strong>db_recover</strong></span> utility uses a Berkeley DB |
| 264 | environment (as described for the <span class="bold"><strong>-h</strong></span> |
| 265 | option, the environment variable |
| 266 | <span class="bold"><strong>DB_HOME</strong></span>, or because the utility |
| 267 | was run in a directory containing a Berkeley DB environment). |
| 268 | In order to avoid environment corruption when using a Berkeley DB |
| 269 | environment, <span class="command"><strong>db_recover</strong></span> should always be given the chance to detach |
| 270 | from the environment and exit gracefully. To cause <span class="command"><strong>db_recover</strong></span> to |
| 271 | release all environment resources and exit cleanly, send it an |
| 272 | interrupt signal (SIGINT). |
| 273 | </p> |
| 274 | <p> |
| 275 | The <span class="command"><strong>db_recover</strong></span> utility exits 0 on success, and >0 if an error |
| 276 | occurs. |
| 277 | </p> |
| 278 | <div class="sect2" lang="en" xml:lang="en"> |
| 279 | <div class="titlepage"> |
| 280 | <div> |
| 281 | <div> |
| 282 | <h3 class="title"><a id="idp55287448"></a>Environment Variables</h3> |
| 283 | </div> |
| 284 | </div> |
| 285 | </div> |
| 286 | <div class="sect3" lang="en" xml:lang="en"> |
| 287 | <div class="titlepage"> |
| 288 | <div> |
| 289 | <div> |
| 290 | <h4 class="title"><a id="idp55276192"></a>DB_HOME</h4> |
| 291 | </div> |
| 292 | </div> |
| 293 | </div> |
| 294 | <p> |
| 295 | If the <span class="bold"><strong>-h</strong></span> option is not specified and |
| 296 | the environment variable DB_HOME is set, it is used as the path of the |
| 297 | database home, as described in the |
| 298 | <a class="xref" href="envopen.html" title="DB_ENV->open()">DB_ENV->open()</a> |
| 299 | method. |
| 300 | </p> |
| 301 | </div> |
| 302 | </div> |
| 303 | </div> |
| 304 | <div class="navfooter"> |
| 305 | <hr /> |
| 306 | <table width="100%" summary="Navigation footer"> |
| 307 | <tr> |
| 308 | <td width="40%" align="left"><a accesskey="p" href="db_printlog.html">Prev</a> </td> |
| 309 | <td width="20%" align="center"> |
| 310 | <a accesskey="u" href="utilities.html">Up</a> |
| 311 | </td> |
| 312 | <td width="40%" align="right"> <a accesskey="n" href="db_replicate.html">Next</a></td> |
| 313 | </tr> |
| 314 | <tr> |
| 315 | <td width="40%" align="left" valign="top">db_printlog </td> |
| 316 | <td width="20%" align="center"> |
| 317 | <a accesskey="h" href="index.html">Home</a> |
| 318 | </td> |
| 319 | <td width="40%" align="right" valign="top"> db_replicate</td> |
| 320 | </tr> |
| 321 | </table> |
| 322 | </div> |
| 323 | </body> |
| 324 | </html> |