You could try running calibredb from the command line with calibre closed. See
restore_database for some help. If you don't specify the library path, it will default to the one stored in your settings.
Code:
calibredb restore_database -r --library-path=<path to your library>
You might want to first try to create a new library. Switch to the new library and Add books from folders and subfolders pointing to your old library as the source.