数据库的机器突然kernel panic了,导致openldap的数据文件损坏,BDB报错,现象如下:

Aug 26 11:00:32 db5 slapd[14029]: bdb(dc=chinabank,dc=com): Program version 4.2 doesn't match environment version  
Aug 26 11:00:32 db5 slapd[14029]: bdb_db_open: dbenv_open failed: Invalid argument (22)  
Aug 26 11:00:32 db5 slapd[14029]: backend_startup: bi_db_open(0) failed! (22)  

修复方法:

cd /var/lib/  
db_recover -v -h ldap (路径)  
或者slapd_db_recover -v -h ldap

顺便贴一下ldap的导入和导出命令:

slapcat > 1.ldif  
slapadd < 1.ldif  
comments powered by Disqus