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_ENV->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 DB_ENV Handle" /> 11 <link rel="prev" href="envget_verbose.html" title="DB_ENV->get_verbose()" /> 12 <link rel="next" href="envopen.html" title="DB_ENV->open()" /> 13 </head> 14 <body> 15 <div class="navheader"> 16 <table width="100%" summary="Navigation header"> 17 <tr> 18 <th colspan="3" align="center">DB_ENV->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 DB_ENV 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>DB_ENV->lsn_reset()</h2> 35 </div> 36 </div> 37 </div> 38 <pre class="programlisting">#include <db.h> 39 40int 41DB_ENV->lsn_reset(DB_ENV *dbenv, const char *file, u_int32_t flags); </pre> 42 <p> 43 The <code class="methodname">DB_ENV->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">DB_ENV->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">DB_ENV->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">DB_ENV->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">DB_ENV->lsn_reset()</code> <span> 71 <span> 72 method returns a non-zero error value on failure and 0 on success. 73 </span> 74 75 </span> 76 </p> 77 <div class="sect2" lang="en" xml:lang="en"> 78 <div class="titlepage"> 79 <div> 80 <div> 81 <h3 class="title"><a id="id1664569"></a>Parameters</h3> 82 </div> 83 </div> 84 </div> 85 <div class="sect3" lang="en" xml:lang="en"> 86 <div class="titlepage"> 87 <div> 88 <div> 89 <h4 class="title"><a id="id1664498"></a>file</h4> 90 </div> 91 </div> 92 </div> 93 <p> 94 The name of the physical file in which the LSNs are to be cleared. 95 </p> 96 </div> 97 <div class="sect3" lang="en" xml:lang="en"> 98 <div class="titlepage"> 99 <div> 100 <div> 101 <h4 class="title"><a id="id1664414"></a>flags</h4> 102 </div> 103 </div> 104 </div> 105 <p> 106 The <span class="bold"><strong>flags</strong></span> parameter must be set to 0 107 or the following value: 108 </p> 109 <div class="itemizedlist"> 110 <ul type="disc"> 111 <li> 112 <p> 113 <code class="literal">DB_ENCRYPT</code> 114 </p> 115 <p> 116 The file contains encrypted databases. 117 </p> 118 </li> 119 </ul> 120 </div> 121 </div> 122 </div> 123 <div class="sect2" lang="en" xml:lang="en"> 124 <div class="titlepage"> 125 <div> 126 <div> 127 <h3 class="title"><a id="id1665138"></a>Errors</h3> 128 </div> 129 </div> 130 </div> 131 <p> 132 The <code class="methodname">DB_ENV->lsn_reset()</code> <span> 133 <span> 134 method may fail and return one of the following non-zero errors: 135 </span> 136 137 </span> 138 </p> 139 <div class="sect3" lang="en" xml:lang="en"> 140 <div class="titlepage"> 141 <div> 142 <div> 143 <h4 class="title"><a id="id1663651"></a>EINVAL</h4> 144 </div> 145 </div> 146 </div> 147 <p> 148 An invalid flag value or parameter was specified. 149 </p> 150 </div> 151 </div> 152 <div class="sect2" lang="en" xml:lang="en"> 153 <div class="titlepage"> 154 <div> 155 <div> 156 <h3 class="title"><a id="id1664412"></a>Class</h3> 157 </div> 158 </div> 159 </div> 160 <p> 161 <a class="link" href="env.html" title="Chapter��5.�� The DB_ENV Handle">DB_ENV</a> 162 </p> 163 </div> 164 <div class="sect2" lang="en" xml:lang="en"> 165 <div class="titlepage"> 166 <div> 167 <div> 168 <h3 class="title"><a id="id1664822"></a>See Also</h3> 169 </div> 170 </div> 171 </div> 172 <p> 173 <a class="xref" href="env.html#envlist" title="Database Environments and Related Methods">Database Environments and Related Methods</a> 174 </p> 175 </div> 176 </div> 177 <div class="navfooter"> 178 <hr /> 179 <table width="100%" summary="Navigation footer"> 180 <tr> 181 <td width="40%" align="left"><a accesskey="p" href="envget_verbose.html">Prev</a>��</td> 182 <td width="20%" align="center"> 183 <a accesskey="u" href="env.html">Up</a> 184 </td> 185 <td width="40%" align="right">��<a accesskey="n" href="envopen.html">Next</a></td> 186 </tr> 187 <tr> 188 <td width="40%" align="left" valign="top">DB_ENV->get_verbose()��</td> 189 <td width="20%" align="center"> 190 <a accesskey="h" href="index.html">Home</a> 191 </td> 192 <td width="40%" align="right" valign="top">��DB_ENV->open()</td> 193 </tr> 194 </table> 195 </div> 196 </body> 197</html> 198