Library Version 11.2.5.3

DB_ENV->set_metadata_dir()
Prev | Chapter 5. The DB_ENV Handle | Next

## DB_ENV->set_metadata_dir()

    #include <db.h>

    int
    DB_ENV->set_metadata_dir(DB_ENV *envp, const char *dir);

The `DB_ENV->set_metadata_dir()` method sets the directory where persistent metadata is stored. By default, persistent metadata is stored in the environment home directory.

When used in a replicated application, the metadata directory must be the same location for all sites within a replication group.

The `DB_ENV->set_metadata_dir()` method may not be called after the DB_ENV->open() method is called. The directory identified by this method must already exist when the `DB_ENV->open()` method is called. The directory identified by this method is added to the environment's list of data directories, if this directory is not already included on that list.

The database environment's metadata directory may also be configured using the environment's DB_CONFIG file. The syntax of the entry in that file is a single line with the string "set_metadata_dir", one or more whitespace characters, followed by the directory location. Because the DB_CONFIG file is read when the database environment is opened, it will silently overrule configuration done before that time.

The `DB_ENV->set_metadata_dir()` method returns a non-zero error value on failure and 0 on success.

### Parameters

#### dir

The dir parameter identifies the directory used to store persistent metadata files.

### Class

DB_ENV

### See Also

Database Environments and Related Methods, DB_ENV->get_metadata_dir()

Prev | Up | Next
DB_ENV->set_memory_max() | Home | DB_ENV->set_msgcall()