The Magento Database Repair Tool compares 2 databases (reference and target), and updates the target database so it has the same structure as the reference database by doing the following:
- Adds missing tables, or repairs them to have the same engine type and char-set.
- Adds missing fields or repairs them.
- Removes inconsistent data from tables that have broken foreign key references.
- Adds missing foreign keys and indexes.
You can download it here. For a full list of features and instructions, you can refer to this wiki post.