OK, perhaps likening it to a library may not be the best method.
Basically, the following happens during a database repair.
Firstly, it checks for items that have been deleted, but may have been found at a new location.
Secondly, it checks for any items that have been added outside of Content Manager (like some addon packs)
Thirdly, it checks the content that is flagged as 'Locally Modified' to check that the folder references are correct.
Next, it checks for assets which have missing dependencies, using the config.txt file as a guide.
It then checks for faulty assets, followed by obsolete assets.
You may find that the obsolete and missing dependency checks are the other way around.
Shane