When using yum on CentOS, you might get something like Error: rpmdb open failed. A similar error like this can be shown:

yum clean all
error: rpmdb: BDB0113 Thread/process 2921108/140151702521664 failed: BDB1507 Thread died in Berkeley DB library
error: db5 error(-30973) from dbenv->failchk: BDB0087 DB_RUNRECOVERY: Fatal error, run database recovery
error: cannot open Packages index using db5 -  (-30973)
error: cannot open Packages database in /var/lib/rpm

This means that your yum repository is corrupted. To fix this, we need to clean out the local yum database:

mv /var/lib/rpm/__db* /tmp
yum clean all

Now run the yum command again, e.g.:

yum update
Loaded plugins: fastestmirror, rhnplugin
This system is receiving updates from CLN.
Determining fastest mirrors

If all goes well, remove the old database:

rm -rf /tmp/__db*