# How to get and use slapd_db_recovery

## LonelyStar

Hi,

My slapd database does not work anymore. If  I run slapdtest, I get:

```
hdb_db_open: unclean shutdown detected; attempting recovery.

hdb_db_open: Warning - No DB_CONFIG file found in directory /var/lib/openldap-data: (2)

Expect poor performance for suffix dc=lonely-star,dc=org.

hdb_db_open: Recovery skipped in read-only mode. Run manual recovery if errors are encountered.

bdb(dc=lonely-star,dc=org): PANIC: fatal region error detected; run recovery

hdb_db_open: Database cannot be opened, err -30975. Restore from backup!

bdb(dc=lonely-star,dc=org): DB_ENV->lock_id_free interface requires an environment configured for the locking subsystem

backend_startup_one: bi_db_open failed! (-30975)

slap_startup failed (test would succeed using the -u switch)
```

So I should run a manual recovery, right? How? google tells me about the "slapd_db_recovery" script. But where can I get it? It's not in any of

/usr/bin

/usr/sbin

/bin

/sbin

Thanks!

Nathan

----------

## notHerbert

For one thing you need a DB_CONFIG file

Then maybe run /usr/sbin/slapindex will do.

```
cat /var/lib/openldap-data/DB_CONFIG.example

# $OpenLDAP: pkg/ldap/servers/slapd/DB_CONFIG,v 1.1.2.4 2007/12/18 11:51:46 ghenry Exp $

# Example DB_CONFIG file for use with slapd(8) BDB/HDB databases.

#

# See the Oracle Berkeley DB documentation

#   <http://www.oracle.com/technology/documentation/berkeley-db/db/ref/env/db_config.html>

# for detail description of DB_CONFIG syntax and semantics.

#

# Hints can also be found in the OpenLDAP Software FAQ

#       <http://www.openldap.org/faq/index.cgi?file=2>

# in particular:

#   <http://www.openldap.org/faq/index.cgi?file=1075>

# Note: most DB_CONFIG settings will take effect only upon rebuilding

# the DB environment.

# one 0.25 GB cache

set_cachesize 0 268435456 1

# Data Directory

#set_data_dir db

# Transaction Log settings

set_lg_regionmax 262144

set_lg_bsize 2097152

#set_lg_dir logs

# Note: special DB_CONFIG flags are no longer needed for "quick"

# slapadd(8) or slapindex(8) access (see their -q option).

```

----------

