Sorry, but your post is a horror for reading. A better way is to use
Spoiler for your log listings. Then it is better to see what is a log and what is something what you wrote as comment or question.
If Calibre is not able to override the metadata.db then your OS is blocking the file. These mainly happen when an application is crashing without unlock the file. In this case you need to shut down the user profile and restart again. Then you can rename or delete the metadata.db and start Calibre again and rebuild the database.