Error:

error: db5 error(-30969) from dbenv->open: BDB0091 DB_VERSION_MISMATCH: Database environment version mismatch
error: cannot open Packages index using db5 –  (-30969)

Solution:
rpm --rebuilddb
rpm --initdb