May be some simple scriptings could help.
Eg: delete all entries under People branch:
1) Find out who they are, export them to People.ldif, script is
db2ldif_People.sh
# db2ldif_People.sh
#
# Execute these for iPlanet Directory Server
if [ -n "`ps -ef | grep 'ns-slapd' | grep -v grep`" ]
then
YYYY=`date +'%Y'`
cd /usr/iplanet/ds5/slapd-`hostname`/ldif
rm -f $YYYY*.ldif
../db2ldif -n UserRoot -s "ou=People,dc=example,dc=com"
cp $YYYY*.ldif /home/ldap/People.ldif
fi
# Execute these for OpenLDAP Server
if [ -n "`ps -ef | grep 'slapd' | grep -v grep`" ]
then
# For RedHat
BINDIR=/usr/bin
# For Others
#BINDIR=/usr/local/bin
$BINDIR/ldapsearch -x -LLL -b "ou=People,dc=example,dc=com" \
-D "cn=Manager,dc=example,dc=com" \
-w `cat /etc/ldap.secret` \
"objectclass=*" >/home/ldap/People.ldif
fi
chmod 600 /home/ldap/People.ldif
2) Delete them via ldapdelete, script is openldap_delete_Peoples.sh
#! /bin/sh
# openldap_delete_Peoples.sh
# Destructive script
# Never do deletion at LDAP Master Server
# Do deletion only at LDAP Slave Server
[ "`uname -n`" = "ldap1" ] && exit
# Un-Comment for RedHat
BINDIR=/usr/bin
# Un-Comment for others
#BINDIR=/usr/local/bin
grep "^dn:" People.ldif | sed 's/^dn: //' >openldap_delete_Peoples.ldif