BerkeleyDB upgrade

During switching LDAP directory to new environment with newer version of OpenLDAP (2.4.25) and new BerkeleyDB (5.1.25), I received following error message:


Program version 5.1 doesn't match environment version 4.7
database ... cannot be opened, err -30969. Restore from backup!
bdb(...): txn_checkpoint interface requires an environment configured for the transaction subsystem
bdb_db_close: database "...": txn_checkpoint failed: Invalid argument (22).
backend_startup_one (type=hdb, suffix="..."): bi_db_open failed! (-30969)
bdb_db_close: database "...": alock_close failed

This means that you need to upgrade BerkeleyDB. Because this is not OpenLDAP specific, but rather BerkeleyDB specific, I decided to describe how to fix this issue. First of all let’s make a backup:

# cd /data/var/openldap/openldap-data
# cp -a database database.db47

let’s try make db_upgrade:

# /usr/local/BerkeleyDB.5.1/bin/db_upgrade -h /data/var/openldap/openldap-data/database *
db_upgrade: Program version 5.1 doesn't match environment version 4.7
db_upgrade: DB_ENV->open: DB_VERSION_MISMATCH: Database environment version mismatch

Nope, we need to get back to old environment and make some steps there:

# /usr/local/BerkeleyDB.4.7/bin/db_checkpoint -1 -h /data/var/openldap/openldap-data/database
# /usr/local/BerkeleyDB.4.7/bin/db_recover -h /data/var/openldap/openldap-data/database

after this we can switch to new installation and just run application, which should be able to recover BerkeleyDB in new version. You can also do this manually in new environment:

/usr/local/BerkeleyDB.5.1/bin/db_upgrade -e

You may also like...

Leave a Reply