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: DbEnv::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>DbEnv::lsn_reset</b>
14</td>
15<td align=right>
16<a href="../api_cxx/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_cxx.h&gt;
23<p>
24int
25DbEnv::lsn_reset(const char *file, u_int32_t flags);
26</pre></b>
27<hr size=1 noshade>
28<b>Description: DbEnv::lsn_reset</b>
29<p>The DbEnv::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 DbEnv::lsn_reset
40on a database in a new environment when the database LSNs still reflect
41the old environment.</p>
42<p>The DbEnv::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 DbEnv::lsn_reset method may be called at any time during the life of the
45application.</p>
46<p>The DbEnv::lsn_reset method
47either returns a non-zero error value
48or throws an exception that encapsulates a non-zero error value on
49failure, and returns 0 on success.
50</p>
51<b>Parameters</b> <br>
52 <b>file</b><ul compact><li>The name of the physical file in which the LSNs are to be cleared.</ul>
53 <b>flags</b><ul compact><li>The <b>flags</b> parameter must be set to 0 or
54the following value:
55<br>
56<b>DB_ENCRYPT</b><ul compact><li>The file contains encrypted databases.</ul>
57<br></ul>
58<br>
59<br><b>Errors</b>
60<p>The DbEnv::lsn_reset method
61may fail and throw
62<a href="../api_cxx/except_class.html">DbException</a>,
63encapsulating one of the following non-zero errors, or return one of
64the following non-zero errors:</p>
65<br>
66<b>EINVAL</b><ul compact><li>An
67invalid flag value or parameter was specified.</ul>
68<br>
69<hr size=1 noshade>
70<br><b>Class</b>
71<a href="../api_cxx/env_class.html">DbEnv</a>
72<br><b>See Also</b>
73<a href="../api_cxx/env_list.html">Database Environments and Related Methods</a>
74</tt>
75<table width="100%"><tr><td><br></td><td align=right>
76<a href="../api_cxx/api_core.html"><img src="../images/api.gif" alt="API"></a><a href="../ref/toc.html"><img src="../images/ref.gif" alt="Ref"></a>
77</td></tr></table>
78<p><font size=1>Copyright (c) 1996,2008 Oracle.  All rights reserved.</font>
79</body>
80</html>
81