How to detect a corrupt database?