[Date Prev][Date Next] [Chronological] [Thread] [Top]

Re: how do you delete the entire openldap bdb database

John Borwick wrote:
Jason Joines wrote:

I ran slapadd to populate the 2.2 server. Some of my conversions were bad so I want to remove all the entries and run the population again. I delete everything in my database directory via "rm /var/lib/ldap/*", and verify everything is gone via "ls -l /var/lib/ldap/".

> However, when I then start the server back up, it

starts without errors and if I do a search I see all of the entries of my fully populated directory. "ls -l /var/lib/ldap/" reveals that all of the files have returned (__db.001 __db.002 __db.003 __db.004 __db.005 dn2id.bdb id2entry.bdb log.0000000001). I stop the server, delete them all again, and search the entire disk for these files finding nothing. When I start it again, they all return again.

These files are automatically created when you run any LDAP tool that interacts with the database. They don't have anything in them.

The easy way to erase everything is
 1. stop slapd
 2. rm -f /path/to/ldap/dir/*
 3. start slapd

Is that exactly what you've done?

How do I get back to a brand new, empty, directory without re-installing?

Yep, that's exactly what I did. I just discovered I was doing something else stupid though. I had configured my .ldaprc file to search the production server by default. After deleting the entries on the test server, out of habit I did my search without specifying a host. The entries I was seeing were on the production server where they should be. When I searched the test server where I had deleted the entries, the results were empty as should be.
Thanks for the help.