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>DbEnv::lsn_reset()</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="env.html" title="Chapter 5. The DbEnv Handle" /> 11 <link rel="prev" href="envget_verbose.html" title="DbEnv::get_verbose()" /> 12 <link rel="next" href="envopen.html" title="DbEnv::open()" /> 13 </head> 14 <body> 15 <div class="navheader"> 16 <table width="100%" summary="Navigation header"> 17 <tr> 18 <th colspan="3" align="center">DbEnv::lsn_reset()</th> 19 </tr> 20 <tr> 21 <td width="20%" align="left"><a accesskey="p" href="envget_verbose.html">Prev</a> </td> 22 <th width="60%" align="center">Chapter 5. 23 The DbEnv Handle 24 </th> 25 <td width="20%" align="right"> <a accesskey="n" href="envopen.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="envlsn_reset"></a>DbEnv::lsn_reset()</h2> 35 </div> 36 </div> 37 </div> 38 <pre class="programlisting">#include <db_cxx.h> 39 40int 41DbEnv::lsn_reset(const char *file, u_int32_t flags);</pre> 42 <p> 43 The <code class="methodname">DbEnv::lsn_reset()</code> method allows database files to be moved from 44 one transactional database environment to another. 45 </p> 46 <p> 47 Database pages in transactional database environments contain 48 references to the environment's log files (that is, log sequence 49 numbers, or LSNs). Copying or moving a database file from one database 50 environment to another, and then modifying it, can result in data 51 corruption if the LSNs are not first cleared. 52 </p> 53 <p> 54 Note that LSNs should be reset before moving or copying the database 55 file into a new database environment, rather than moving or copying 56 the database file and then resetting the LSNs. Berkeley DB has 57 consistency checks that may be triggered if an application calls 58 <code class="methodname">DbEnv::lsn_reset()</code> on a database in a new environment when the 59 database LSNs still reflect the old environment. 60 </p> 61 <p> 62 The <code class="methodname">DbEnv::lsn_reset()</code> method modifies the physical file, in-place. 63 Applications should not reset LSNs in files that are currently in use. 64 </p> 65 <p> 66 The <code class="methodname">DbEnv::lsn_reset()</code> method may be called at any time during the 67 life of the application. 68 </p> 69 <p> 70 The <code class="methodname">DbEnv::lsn_reset()</code> <span> 71 72 <span> 73 method either returns a non-zero error value or throws an 74 exception that encapsulates a non-zero error value on 75 failure, and returns 0 on success. 76 </span> 77 </span> 78 </p> 79 <div class="sect2" lang="en" xml:lang="en"> 80 <div class="titlepage"> 81 <div> 82 <div> 83 <h3 class="title"><a id="id1666769"></a>Parameters</h3> 84 </div> 85 </div> 86 </div> 87 <div class="sect3" lang="en" xml:lang="en"> 88 <div class="titlepage"> 89 <div> 90 <div> 91 <h4 class="title"><a id="id1666741"></a>file</h4> 92 </div> 93 </div> 94 </div> 95 <p> 96 The name of the physical file in which the LSNs are to be cleared. 97 </p> 98 </div> 99 <div class="sect3" lang="en" xml:lang="en"> 100 <div class="titlepage"> 101 <div> 102 <div> 103 <h4 class="title"><a id="id1667135"></a>flags</h4> 104 </div> 105 </div> 106 </div> 107 <p> 108 The <span class="bold"><strong>flags</strong></span> parameter must be set to 0 109 or the following value: 110 </p> 111 <div class="itemizedlist"> 112 <ul type="disc"> 113 <li> 114 <p> 115 <code class="literal">DB_ENCRYPT</code> 116 </p> 117 <p> 118 The file contains encrypted databases. 119 </p> 120 </li> 121 </ul> 122 </div> 123 </div> 124 </div> 125 <div class="sect2" lang="en" xml:lang="en"> 126 <div class="titlepage"> 127 <div> 128 <div> 129 <h3 class="title"><a id="id1667417"></a>Errors</h3> 130 </div> 131 </div> 132 </div> 133 <p> 134 The <code class="methodname">DbEnv::lsn_reset()</code> <span> 135 136 <span> 137 method may fail and throw a <a class="link" href="dbexception.html" title="Chapter 6. The DbException Class">DbException</a> 138 exception, encapsulating one of the following non-zero errors, or return one 139 of the following non-zero errors: 140 </span> 141 </span> 142 </p> 143 <div class="sect3" lang="en" xml:lang="en"> 144 <div class="titlepage"> 145 <div> 146 <div> 147 <h4 class="title"><a id="id1666853"></a>EINVAL</h4> 148 </div> 149 </div> 150 </div> 151 <p> 152 An invalid flag value or parameter was specified. 153 </p> 154 </div> 155 </div> 156 <div class="sect2" lang="en" xml:lang="en"> 157 <div class="titlepage"> 158 <div> 159 <div> 160 <h3 class="title"><a id="id1666854"></a>Class</h3> 161 </div> 162 </div> 163 </div> 164 <p> 165 <a class="link" href="env.html" title="Chapter 5. The DbEnv Handle">DbEnv</a> 166 </p> 167 </div> 168 <div class="sect2" lang="en" xml:lang="en"> 169 <div class="titlepage"> 170 <div> 171 <div> 172 <h3 class="title"><a id="id1667019"></a>See Also</h3> 173 </div> 174 </div> 175 </div> 176 <p> 177 <a class="xref" href="env.html#envlist" title="Database Environments and Related Methods">Database Environments and Related Methods</a> 178 </p> 179 </div> 180 </div> 181 <div class="navfooter"> 182 <hr /> 183 <table width="100%" summary="Navigation footer"> 184 <tr> 185 <td width="40%" align="left"><a accesskey="p" href="envget_verbose.html">Prev</a> </td> 186 <td width="20%" align="center"> 187 <a accesskey="u" href="env.html">Up</a> 188 </td> 189 <td width="40%" align="right"> <a accesskey="n" href="envopen.html">Next</a></td> 190 </tr> 191 <tr> 192 <td width="40%" align="left" valign="top">DbEnv::get_verbose() </td> 193 <td width="20%" align="center"> 194 <a accesskey="h" href="index.html">Home</a> 195 </td> 196 <td width="40%" align="right" valign="top"> DbEnv::open()</td> 197 </tr> 198 </table> 199 </div> 200 </body> 201</html> 202