I'm currently attempting to use berkeley utils on the database files created by openldap, such as db_stat -m . However, I get nothing but an error message. I found this post in the archives, which seems to be the exact same problem: http://www.openldap.org/lists/openldap-software/200401/msg00540.html . However, I don't see a solution, just that I might be inadvertently using the wrong type of backend.Here's what I'm doing:

tamarin# pwd
/var/lib/ldap

tamarin# ls
alock   __db.001  __db.003  __db.005  DB_CONFIG  id2entry.bdb    member.bdb       ou.bdb
cn.bdb  __db.002  __db.004  __db.006  dn2id.bdb  log.0000000001  objectClass.bdb

tamarin# db_stat -m
db_stat: Program version 4.3 doesn't match environment version
db_stat: DB_ENV->open: DB_VERSION_MISMATCH: Database environment version mismatch

tamarin# db_recover
db_recover: Program version 4.3 doesn't match environment version
db_recover: Unacceptable log file log.0000000001: unsupported log version 11
db_recover: Invalid log file: log.0000000001 : Invalid argument
db_recover: PANIC: Invalid argument
db_recover: PANIC: DB_RUNRECOVERY: Fatal error, run database recovery
db_recover: DB_ENV->open: DB_RUNRECOVERY: Fatal error, run database recovery

All the while openldap works perfectly and I can add entries to the directory using ldapadd etc. No complaints in /var/log/local4 either.

The database directive in slapd.conf is set to type "hdb", and the directory directive to /var/lib/ldap. When starting slapd with -d 4 the following line is printed to stdout: "bdb_db_open: dc=test,dc=com". I've tried to specify "bdb" as well, still same result when running db_stat. The way I understood the docs, hdb is merely bdb with a special structure. Anyway: What I haven't set in my slapd.conf is anything under the section "Load dynamic backend modules". In particular, I've left the following directives commented out:
# modulepath    /usr/lib64/openldap
# moduleload    back_bdb.la
# moduleload    back_ldap.la
# moduleload    back_ldbm.la
# moduleload    back_passwd.la
# moduleload    back_shell.la

I tried enabling the modulepath and moduleload directive for back_bdb.la but openldap fails to launch saying the module can't be found, which is not very strange as /usr/lib64/openldap does not exist. Are these modules needed to successfully specify hdb in slapd.conf's database-directive, and does it revert to back-ldbm if not found?

As far as program  versions go, I'm not very proficient with *NIX, so I've used yum installs for everything rather than attempt to compile things myself. IHere are the  versions:
- db4-utils-4.3.29-9.fc6 (db_stat etc)
- openldap-servers-2.3.27-8
- openldap-2.3.27-8

I'm obviously going wrong somewhere, but where?