An Open Access Peon

02 April 2007

Recovering a corrupted OpenLDAP database

Warning! I do not give any warranty that this will work, it may make things worse. Always backup. A lot.

You will require the 'db_recover' utility for db4 (lives in the db-utils RPM).

Backup your LDAP database (in /var/lib/ldap).

Stop the LDAP server if it is running:

/etc/init.d/ldap stop

Change to the OpenLDAP directory:

cd /var/lib/ldap

Execute db_recover:

db_recover -v

Reset the file permissions:

chown ldap.ldap *
chmod 600 *

Restart the server:

/etc/init.d/slap start