This YUM database issue troubled me a fair few times in the past, so I kept the following fix on-hand to resolve it in a pinch.
The root cause of the corruption turned out to be something modifying the YUM database outside of YUM itself and making a hash of it (a badly written Nagios plugin), still, your mileage may vary but it’s something to think about.
To repair this issue and get YUM working again, run the following:
rm -fv /var/lib/rpm/__db* rpm --rebuilddb yum clean all
Now you can install, update, upgrade, and remove as normal.
The corruption may be a one-off, though if it keeps happening then take a closer look to resolve it for good.