So, your OpenLDAP server has crashed and possibly your database is corrupted? Yeah, I know - its a bitch. I seriosly hope you're using back-bdb (BerkeleyDB backend) and not back-ldbm. If you're using back-ldbm, pray you have a ldif-backup stored somewhere - and possibly as resent as possible. If this is the case, jump to step [2]. NOTE! Before doing any of these, make a backup of your directories containing your database(s). This is just some general advices, and I do not take any responsibility for whatever happens to your database. 1. Recovering a corrupted berkeleydb-based OpenLDAP database Find out which version of berkeleydb slapd is compiled with. This will somewhat have something to do with which utility you have to use to recover your data. $ ldd /usr/sbin/slapd | grep libdb libdb-4.2.so => /usr/lib/libdb-4.2.so (0x4006b000) In this example, my slapd was compiled with ver 4.2.x and my tool for recovery whould be /usr/bin/db4.2_recover $ cd (usually /var/lib/ldap) $ db4.2_recover On some systems, you'll only have db_recover - so you'll check to be shure you have the correct version before you try recovery. If this fails.. add argument -c (catastrophic recover) as described in http://www.sleepycat.com/docs/ref/transapp/recovery.html OpenLDAP has also a description in their FAQ on how to do bdb-recovery based on snapshots of your db and logfiles. 2. Recovery using flatfile exported LDIF-files. To be 100% shure you have an OK database, with all indexes working, you should first go to the directory containing your databases, after shutting down slapd. $ cd (usually /var/lib/ldap) Then delete all files, except DB_CONFIG if it exists Now you can start playing with slapadd, OpenLDAPs offline database creation tool. $ slapadd -v -l ...and possibly add other nice arguments (man 8 slapadd) What happens next is your database is created, the -v switch will tell you which object is being added - and if you have any indexes configured in slapd.conf, slapadd will re-create these as well. So the more indexes you have, the longer slapadd will take. In some cases, I've made a slapd-without-indexes.conf I use for slapd. Just to get stuff imported as quickly as possible. Then I start slapd in readonly mode while slapindex works on re-creating indexes in the background.