I need to verify that the RPM database (not an RPM, the database in /var/lib/rpm) is not corrupt or inconsistent, in a manner suitable for scripting (i.e. will return exit code 0 if good and something else if corrupt).  I can use db_verify to verify the individual Berkeley databases, but suppose the individual Berkeley databases are totally valid and the inconsistency is across databases. I experimented by deleting (renaming) a database, and rpm -qa --dump was oblivious and rpm -Va just regenerated it with a warning.  I suppose I could look for the string warning: in the output, but that seems unreliable.  Besides I don't really want to verify the files, I want to verify the database.  I've searched for OpenSuSE RPM-related packages and found nothing apropos.  Any suggestions?  I'd prefer something designed to do a thorough verification as opposed to just a dump.
How to verify the RPM database?
opensuse;rpm
There's an undocumented --verifydb flag that's been around since at least rpm-4.1.See rpm/rpmdb.c:{ verifydb, '\0', (POPT_ARG_VAL|POPT_ARGFLAG_OR|POPT_ARGFLAG_DOC_HIDDEN),    &mode, MODE_VERIFYDB, N_(verify database files), NULL},So rpm --verifydb should do exactly what you're looking for.