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