"The thing is how do I repair or make a new one without losing all?"
I do not know how to repair your rpm data base. What I suggest that you do is start a new rpm data base and also leave the old one like it is. You can create a second rpm data base with:
rpm --initdb --dbpath=/new/rpm/data/base
Then install all new rpms in the new rpm data base using:
rpm --dbpath=/new/rpm/data/base -if /somepath/packagename.rpm
This will allow you to install new packages. When you upgrade a package, try removing the package from the old data base before you install the new package.
What I am suggesting will only partially solve your problem. I don't know how to retrieve the lost names from your old rpm data base and copy those names into the new rpm data base.
Be prepared. Create a LifeBoat CD.