The question isn't entirely clear, because if you want to perform a comparison between db1 and db2, it's not possible if db1 is corrupt
Conversely, if we assume db1 and db2 are accessible, then simply loop through all the tables, scrolling through all the rows for each table, and compare the two...