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_dump</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_deadlock.html" title="db_deadlock" /> 12 <link rel="next" href="db_hotbackup.html" title="db_hotbackup" /> 13 </head> 14 <body> 15 <div class="navheader"> 16 <table width="100%" summary="Navigation header"> 17 <tr> 18 <th colspan="3" align="center">db_dump</th> 19 </tr> 20 <tr> 21 <td width="20%" align="left"><a accesskey="p" href="db_deadlock.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_hotbackup.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_dump"></a>db_dump</h2> 35 </div> 36 </div> 37 </div> 38 <pre class="programlisting">db_dump [-klNpRrV] [-d ahr] 39 [-f output] [-h home] [-P password] [-s database] file 40 41db_dump [-kNpV] [-d ahr] [-f output] [-h home] -m database 42 43db_dump185 [-p] [-f output] file </pre> 44 <p> 45 The <span class="command"><strong>db_dump</strong></span> utility reads the database file <span class="bold"><strong>file</strong></span> and writes it to the standard output using 46 a portable flat-text format understood by the 47 <a class="xref" href="db_load.html" title="db_load">db_load</a> utility. The <span class="bold"><strong>file</strong></span> argument must be a file produced using the 48 Berkeley DB library functions. 49 </p> 50 <p> 51 The <span class="command"><strong>db_dump185</strong></span> utility is 52 similar to the <span class="command"><strong>db_dump</strong></span> utility, except that it reads databases in the 53 format used by Berkeley DB versions 1.85 and 1.86. 54 </p> 55 <p> 56 The options are as follows: 57 </p> 58 <div class="itemizedlist"> 59 <ul type="disc"> 60 <li> 61 <p> 62 <span class="bold"><strong>-d</strong></span> 63 </p> 64 <p> 65 Dump the specified database in a format helpful for debugging the 66 Berkeley DB library routines. 67 </p> 68 <div class="itemizedlist"> 69 <ul type="circle"> 70 <li> 71 <p> 72 <span class="bold"><strong>a</strong></span> 73 </p> 74 <p> 75 Display all information. 76 </p> 77 </li> 78 <li> 79 <p> 80 <span class="bold"><strong>h</strong></span> 81 </p> 82 <p> 83 Display only page headers. 84 </p> 85 </li> 86 <li> 87 <p> 88 <span class="bold"><strong>r</strong></span> 89 </p> 90 <p> 91 Do not display the free-list or pages on the free list. This mode is used by 92 the recovery tests. 93 </p> 94 </li> 95 </ul> 96 </div> 97 <p> 98 <span class="bold"><strong>The output format of the <span class="bold"><strong>-d</strong></span> option is not standard and may change, 99 without notice, between releases of the Berkeley DB 100 library.</strong></span> 101 </p> 102 </li> 103 <li> 104 <p> 105 <span class="bold"><strong>-f</strong></span> 106 </p> 107 <p> 108 Write to the specified file instead 109 of to the standard output. 110 </p> 111 </li> 112 <li> 113 <p> 114 <span class="bold"><strong>-h</strong></span> 115 </p> 116 <p> 117 Specify a home directory for the database environment; by default, the 118 current working directory is used. 119 </p> 120 </li> 121 <li> 122 <p> 123 <span class="bold"><strong>-k</strong></span> 124 </p> 125 <p> 126 Dump record numbers from Queue and Recno databases as keys. 127 </p> 128 </li> 129 <li> 130 <p> 131 <span class="bold"><strong>-l</strong></span> 132 </p> 133 <p> 134 List the databases stored in the file. 135 </p> 136 </li> 137 <li> 138 <p> 139 <span class="bold"><strong>-m</strong></span> 140 </p> 141 <p> 142 Specify a named in-memory database to dump. 143 In this case the <span class="bold"><strong>file</strong></span> argument must be omitted. 144 </p> 145 </li> 146 <li> 147 <p> 148 <span class="bold"><strong>-N</strong></span> 149 </p> 150 <p> 151 Do not acquire shared region mutexes while running. Other problems, 152 such as potentially fatal errors in Berkeley DB, will be ignored as 153 well. This option is intended only for debugging errors, and should 154 not be used under any other circumstances. 155 </p> 156 </li> 157 <li> 158 <p> 159 <span class="bold"><strong>-P</strong></span> 160 </p> 161 <p> 162 Specify an environment password. Although Berkeley DB utilities 163 overwrite password strings as soon as possible, be aware there may be 164 a window of vulnerability on systems where unprivileged users can see 165 command-line arguments or where utilities are not able to overwrite 166 the memory containing the command-line arguments. 167 </p> 168 </li> 169 <li> 170 <p> 171 <span class="bold"><strong>-p</strong></span> 172 </p> 173 <p> 174 If characters in either the key or data items are printing characters 175 (as defined by <span class="bold"><strong>isprint</strong></span>(3)), use 176 printing characters in <span class="bold"><strong>file</strong></span> to 177 represent them. This option permits users to use standard text 178 editors and tools to modify the contents of databases. 179 </p> 180 <p> 181 Note: different systems may have different notions about what 182 characters are considered <span class="emphasis"><em>printing characters</em></span>, 183 and databases dumped in this manner may be less portable to external 184 systems. 185 </p> 186 </li> 187 <li> 188 <p> 189 <span class="bold"><strong>-R</strong></span> 190 </p> 191 <p> 192 Aggressively salvage data from a possibly corrupt file. The <span class="bold"><strong>-R</strong></span> flag differs from the <span class="bold"><strong>-r</strong></span> option in that it will return all possible 193 data from the file at the risk of also returning already deleted or 194 otherwise nonsensical items. Data dumped in this fashion will almost 195 certainly have to be edited by hand or other means before the data is 196 ready for reload into another database 197 </p> 198 </li> 199 <li> 200 <p> 201 <span class="bold"><strong>-r</strong></span> 202 </p> 203 <p> 204 Salvage data from a possibly corrupt file. When used on a uncorrupted 205 database, this option should return equivalent data to a normal dump, 206 but most likely in a different order. 207 </p> 208 </li> 209 <li> 210 <p> 211 <span class="bold"><strong>-s</strong></span> 212 </p> 213 <p> 214 Specify a single database to dump. If no database is specified, all 215 databases in the database file are dumped. 216 </p> 217 </li> 218 <li> 219 <p> 220 <span class="bold"><strong>-V</strong></span> 221 </p> 222 <p> 223 Write the library version number to the standard output, and exit. 224 </p> 225 </li> 226 </ul> 227 </div> 228 <p> 229 Dumping and reloading Hash databases that use user-defined hash 230 functions will result in new databases that use the default hash 231 function. Although using the default hash function may not be optimal 232 for the new database, it will continue to work correctly. 233 </p> 234 <p> 235 Dumping and reloading Btree databases that use user-defined prefix or 236 comparison functions will result in new databases that use the default 237 prefix and comparison functions. <span class="bold"><strong>In this case, 238 it is quite likely that the database will be damaged beyond repair 239 permitting neither record storage or retrieval.</strong></span> 240 </p> 241 <p> 242 The only available workaround for either case is to modify the sources 243 for the <a class="xref" href="db_load.html" title="db_load">db_load</a> utility 244 to load the database using the correct hash, prefix, and comparison 245 functions. 246 </p> 247 <p> 248 The <span class="command"><strong>db_dump185</strong></span> utility 249 may not be available on your system because it is not always built 250 when the Berkeley DB libraries and utilities are installed. If you 251 are unable to find it, see your system administrator for further 252 information. 253 </p> 254 <p> 255 The <span class="command"><strong>db_dump</strong></span> and <span class="command"><strong>db_dump185</strong></span> utility output 256 formats are documented in the <a href="../../programmer_reference/dumpload_format.html" class="olink">Dump Output Formats</a> section 257 of the Berkeley DB Reference Guide. 258 </p> 259 <p> 260 The <span class="command"><strong>db_dump</strong></span> utility may be used with a Berkeley DB environment (as 261 described for the <span class="bold"><strong>-h</strong></span> option, the 262 environment variable <span class="bold"><strong>DB_HOME</strong></span>, or 263 because the utility was run in a directory containing a Berkeley DB 264 environment). In order to avoid environment corruption when using a 265 Berkeley DB environment, <span class="command"><strong>db_dump</strong></span> should always be given the chance to 266 detach from the environment and exit gracefully. To cause <span class="command"><strong>db_dump</strong></span> to 267 release all environment resources and exit cleanly, send it an 268 interrupt signal (SIGINT). 269 </p> 270 <p> 271 Even when using a Berkeley DB database environment, the db_dump 272 utility does not use any kind of database locking if it is invoked 273 with the <span class="bold"><strong>-d</strong></span>, <span class="bold"><strong>-R</strong></span>, or <span class="bold"><strong>-r</strong></span> 274 arguments. If used with one of these arguments, the <span class="command"><strong>db_dump</strong></span> utility 275 may only be safely run on databases that are not being modified by any 276 other process; otherwise, the output may be corrupt. 277 </p> 278 <p> 279 The <span class="command"><strong>db_dump</strong></span> utility exits 0 on success, and >0 if an error occurs. 280 </p> 281 <p> 282 The <span class="command"><strong>db_dump185</strong></span> utility 283 exits 0 on success, and >0 if an error occurs. 284 </p> 285 <div class="sect2" lang="en" xml:lang="en"> 286 <div class="titlepage"> 287 <div> 288 <div> 289 <h3 class="title"><a id="id1713222"></a>Environment Variables</h3> 290 </div> 291 </div> 292 </div> 293 <div class="sect3" lang="en" xml:lang="en"> 294 <div class="titlepage"> 295 <div> 296 <div> 297 <h4 class="title"><a id="id1713350"></a>DB_HOME</h4> 298 </div> 299 </div> 300 </div> 301 <p> 302 If the <span class="bold"><strong>-h</strong></span> option is not specified and 303 the environment variable DB_HOME is set, it is used as the path of the 304 database home, as described in the 305 <a class="xref" href="envopen.html" title="DB_ENV->open()">DB_ENV->open()</a> method. 306 </p> 307 </div> 308 </div> 309 </div> 310 <div class="navfooter"> 311 <hr /> 312 <table width="100%" summary="Navigation footer"> 313 <tr> 314 <td width="40%" align="left"><a accesskey="p" href="db_deadlock.html">Prev</a> </td> 315 <td width="20%" align="center"> 316 <a accesskey="u" href="utilities.html">Up</a> 317 </td> 318 <td width="40%" align="right"> <a accesskey="n" href="db_hotbackup.html">Next</a></td> 319 </tr> 320 <tr> 321 <td width="40%" align="left" valign="top">db_deadlock </td> 322 <td width="20%" align="center"> 323 <a accesskey="h" href="index.html">Home</a> 324 </td> 325 <td width="40%" align="right" valign="top"> db_hotbackup</td> 326 </tr> 327 </table> 328 </div> 329 </body> 330</html> 331