DbEnv::lsn_reset API Ref

#include <db_cxx.h>

int DbEnv::lsn_reset(const char *file, u_int32_t flags);


Description: DbEnv::lsn_reset

The DbEnv::lsn_reset method allows database files to be moved from one transactional database environment to another.

Database pages in transactional database environments contain references to the environment's log files (that is, log sequence numbers, or LSNs). Copying or moving a database file from one database environment to another, and then modifying it, can result in data corruption if the LSNs are not first cleared.

Note that LSNs should be reset before moving or copying the database file into a new database environment, rather than moving or copying the database file and then resetting the LSNs. Berkeley DB has consistency checks that may be triggered if an application calls DbEnv::lsn_reset on a database in a new environment when the database LSNs still reflect the old environment.

The DbEnv::lsn_reset method modifies the physical file, in-place. Applications should not reset LSNs in files that are currently in use.

The DbEnv::lsn_reset method may be called at any time during the life of the application.

The DbEnv::lsn_reset method either returns a non-zero error value or throws an exception that encapsulates a non-zero error value on failure, and returns 0 on success.

Parameters
file flags

Errors

The DbEnv::lsn_reset method may fail and throw DbException, encapsulating one of the following non-zero errors, or return one of the following non-zero errors:


EINVAL


Class DbEnv
See Also Database Environments and Related Methods

APIRef

Copyright (c) 1996,2008 Oracle. All rights reserved.