DbEnv::fileid_reset()
Prev | Chapter 5. The DbEnv Handle | Next

## DbEnv::fileid_reset()

    #include <db_cxx.h>

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

The `DbEnv::fileid_reset()` method allows database files to be copied, and then the copy used in the same database environment as the original.

All databases contain an ID string used to identify the database in the database environment cache. If a physical database file is copied, and used in the same environment as another file with the same ID strings, corruption can occur. The `DbEnv::fileid_reset()` method creates new ID strings for all of the databases in the physical file.

The `DbEnv::fileid_reset()` method modifies the physical file, in-place. Applications should not reset IDs in files that are currently in use.

The `DbEnv::fileid_reset()` method may be called at any time during the life of the application.

The `DbEnv::fileid_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

The name of the physical file in which new file IDs are to be created.

#### flags

The flags parameter must be set to 0 or the following value:

- `DB_ENCRYPT`

  The file contains encrypted databases.

### Errors

The `DbEnv::fileid_reset()` method may fail and throw a DbException exception, encapsulating one of the following non-zero errors, or return one of the following non-zero errors:

#### EINVAL

An invalid flag value or parameter was specified.

### Class

DbEnv

### See Also

Database Environments and Related Methods

Prev | Up | Next
DbEnv::failchk() | Home | DbEnv::get_create_dir()