How to Reindex Corrupted OpenLDAP Database

If your LDAP DB got corrupted or showing unclear shutdown, then you can recover it manually by re indexing the database.

Recover Corrupted LDAP Database

Stop Ldpa service first

#service slapd stop

Take the database backup

#tar -cvzf ldap.tar.gz /var/lib/ldap/*

LDAP Database Recovery Method

1. DB Recovery Method

Identify the path of ldap data base.

Run the following command. This will recover the LDAP Database.

#/usr/sbin/slapd_db_recover -v -h /var/lib/ldap

Now Start the ldap service

#service slapd start

2. Re indexing Method

If the above method was not recovering the ldap db, then try to re index the database.

#service slapd stop
#cd /var/lib/ldap
#chown -R ldap.ldap *
#service slapd start