You can backup your BDB, HDB, or LDBM-based directory by making a copy of the
id2entry index file while slapd is NOT running. This file is located
in your the database directory and is commonly named
id2entry.bdb, id2entry.hdb, id2entry.dbb, id2entry.dbh, or id2entry.gdbm
(depending on which backend and database subsystem is in use).
Note that the format of the database files is dependent on the database library OpenLDAP was compiled with, the version of this library, the major version of OpenLDAP, and the architecture of the CPU. As such, the database files are not very portable. Backups to LDIF are entirely portable, and as such a better format to use for backups.