[Linux]使用yum提示Error: rpmdb open failed

  [root@roye yum.repos.d]# yum list

error: db3 error(12) from dbenv->open: Cannot allocate memory

error: db3 error(12) from dbenv->close: Cannot allocate memory

error: cannot open Packages index using db3 - Cannot allocate memory (12)

error: cannot open Packages database in /var/lib/rpm

CRITICAL:yum.main:

Error: rpmdb open failed

原因是RPM数据库被破坏

重建数据库后恢复正常

Shell

cd /var/lib/rpm/

for i in `ls | grep 'db.'`;do mv $i $i.bak;done

rpm --rebuilddb

yum clean all

来自 “ ITPUB博客 ” ,链接:http://blog.itpub.net/29302187/viewspace-2107379/,如需转载,请注明出处,否则将追究法律责任。

转载于:http://blog.itpub.net/29302187/viewspace-2107379/

你可能感兴趣的:(运维,数据库,shell)