RPM DB corrupt : How to recover RPM DB in Linux?

Step: 1

A.Backup existing RPM DB
B.Remove the DB file
C.Rebuild the DB 

Bring down the server to runlevel 1. It will help to avoid further damage to server.


#init 1


Then take the backup of existing RPM DB Files.

#cp /var/lib/rpm/__db.* /tmp/backup

Remove /var/lib/rpm/__db* files to avoid stale locks:

# cd /var/lib
# rm __db*

Now Rebuild RPM database using below commands:

# rpm --rebuilddb
# rpmdb_verify Packages


Step # 2

If you are still getting errors, then try with following commands:

# mv Packages Packages-bkp
# usr/bin/db_dump Packages-bkp | db_load Packages
# rpm -qa
# rpm --rebuilddb

0 comments:

Post a Comment

Blogger Tips and TricksLatest Tips And TricksBlogger Tricks