1<!--$Id: env_lsn_reset.so,v 1.4 2005/12/13 16:48:01 bostic Exp $-->
2<!--Copyright (c) 1997,2008 Oracle.  All rights reserved.-->
3<!--See the file LICENSE for redistribution information.-->
4<html>
5<head>
6<title>Berkeley DB: DB_ENV-&gt;lsn_reset</title>
7<meta name="description" content="Berkeley DB: An embedded database programmatic toolkit.">
8<meta name="keywords" content="embedded,database,programmatic,toolkit,btree,hash,hashing,transaction,transactions,locking,logging,access method,access methods,Java,C,C++">
9</head>
10<body bgcolor=white>
11<table width="100%"><tr valign=top>
12<td>
13<b>DB_ENV-&gt;lsn_reset</b>
14</td>
15<td align=right>
16<a href="/api_c/api_core.html"><img src="/images/api.gif" alt="API"></a>
17<a href="/ref/toc.html"><img src="/images/ref.gif" alt="Ref"></a></td>
18</tr></table>
19<hr size=1 noshade>
20<tt>
21<b><pre>
22#include &lt;db.h&gt;
23<p>
24int
25DB_ENV-&gt;lsn_reset(DB_ENV *dbenv, const char *file, u_int32_t flags);
26</pre></b>
27<hr size=1 noshade>
28<b>Description: DB_ENV-&gt;lsn_reset</b>
29<p>The DB_ENV-&gt;lsn_reset method allows database files to be moved from one
30transactional database environment to another.</p>
31<p>Database pages in transactional database environments contain references
32to the environment's log files (that is, log sequence numbers, or LSNs).
33Copying or moving a database file from one database environment to
34another, and then modifying it, can result in data corruption if the
35LSNs are not first cleared.</p>
36<p>Note that LSNs should be reset before moving or copying the database
37file into a new database environment, rather than moving or copying the
38database file and then resetting the LSNs.  Berkeley DB has consistency checks
39that may be triggered if an application calls DB_ENV-&gt;lsn_reset
40on a database in a new environment when the database LSNs still reflect
41the old environment.</p>
42<p>The DB_ENV-&gt;lsn_reset method modifies the physical file, in-place.
43Applications should not reset LSNs in files that are currently in use.</p>
44<p>The DB_ENV-&gt;lsn_reset method may be called at any time during the life of the
45application.</p>
46<p>The DB_ENV-&gt;lsn_reset method
47returns a non-zero error value on failure
48and 0 on success.
49</p>
50<b>Parameters</b> <br>
51 <b>file</b><ul compact><li>The name of the physical file in which the LSNs are to be cleared.</ul>
52 <b>flags</b><ul compact><li>The <b>flags</b> parameter must be set to 0 or
53the following value:
54<br>
55<b>DB_ENCRYPT</b><ul compact><li>The file contains encrypted databases.</ul>
56<br></ul>
57<br>
58<br><b>Errors</b>
59<p>The DB_ENV-&gt;lsn_reset method
60may fail and return one of the following non-zero errors:</p>
61<br>
62<b>EINVAL</b><ul compact><li>An
63invalid flag value or parameter was specified.</ul>
64<br>
65<hr size=1 noshade>
66<br><b>Class</b>
67<a href="/api_c/env_class.html">DB_ENV</a>
68<br><b>See Also</b>
69<a href="/api_c/env_list.html">Database Environments and Related Methods</a>
70</tt>
71<table width="100%"><tr><td><br></td><td align=right>
72<a href="/api_c/api_core.html"><img src="/images/api.gif" alt="API"></a><a href="/ref/toc.html"><img src="/images/ref.gif" alt="Ref"></a>
73</td></tr></table>
74<p><font size=1>Copyright (c) 1996,2008 Oracle.  All rights reserved.</font>
75</body>
76</html>
77