This is how I fixed my problem.
This is quite the messy situation. You may fix this by cleaning out rpm database. To minimize risk, make a backup of files in /var/lib/rpm/ using cp command:
mkdir /root/backups.rpm.mm_dd_yyyy/ cp -avr /var/lib/rpm/ /root/backups.rpm.mm_dd_yyyy/
To fix this problem, try:
# rm -f /var/lib/rpm/__db* # db_verify /var/lib/rpm/Packages # rpm --rebuilddb # yum clean all
Verify that error has gone with the following yum command
# yum update