OK that verifies a) there are no virtual libraries in play, and b) that the data base does indeed only have 703 book records.
Do the Book folders have metadata.opf files in them? Check a few that are missing from the database and a few that recorded in the dattabase.
Assuming the metadata.opf files are present, and after ensuring I had a backup copy of the library I would use the Library Maintenance->Restore database option, viz:
That will reconstruct the database… the metadata.db file in the library folder… from the metadata.opf files… that's why they exist. It will take a while for 7,000 books - watch a movie or have a snooze.
BR