Today on a RedHat server at work, I ran into an issue trying to clear the yum cache. The upshot of the error I got was that the RPM database was corrupted. Here’s how to fix it.
# cd /var/lib/rpm
# mkdir backup
# mv __db* backup/
# rpm --quiet -qa
# rpm --rebuilddb
# yum clean all
Thanks to this blog post for the solution.