Most likely there is a stale lock somewhere. Usually they are removed in single user mode (runlevel 1) e.g. upon rebooting. If this is not the case, you can try to manually remove the /var/lib/rpm/__db.000, but first check if some application keeps the rpm database open:
Code:
# lsof | grep /var/lib/rpm
If the above command does not show any line of output, then you can safely try to remove the aforementioned file:
Code:
# cd /var/lib/rpm
# rm -f __db*
If the above procedure does not solve the problem, maybe you have some degree of corruption in the rpm database and you have to rebuild it. This is another story, anyway.