When installing rpm packages or using up2date to update packages on Oracle / RedHat Enterprise Linux, you may get the following error,
$ sudo up2date --nox --register
rpmdb: PANIC: fatal region error detected; run recovery
error: db4 error(-30978) from dbenv->open: DB_RUNRECOVERY: Fatal error, run database recovery
error: cannot open Packages index using db3 - (-30978)
error: cannot open Packages database in /var/lib/rpm
An error has occurred:
exceptions.TypeError
See /var/log/up2date for more information
This error is caused by a corrupted RPM database, run the following commands to recover the database.
# cd /var/lib/rpm
# rm -f __db.*
# rpm --rebuilddb
The "--rebuilddb" rebuilds the database indices from the installed RPM package headers.
===