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