How to Re-build malformed Database without metadata loss?

Sonarr version (exact version): 4.0.12.2823
Mono version (if Sonarr is not running on Windows):
OS: Unraid
Debug logs:

Description of issue:

I am getting a malformed database error that seems to be causing a bunch of weird issues. Sonarr still works for the msot part so I did not notice this error ar ages. All the DB backups already have this error.

I can just delete the database and rebuild from scratch but I dont want to loose any unrecoverable data. The series data is in the .nfo files and the config I can re-create manually.
One thing I wouldn’t want to loose is the original file info like the {Original Title} or {Original Filename}. This would mean I could not rename files to their original (if they were renamed by sonarr) and also mess with custom scoring. Release type (single episode/Season pack) is another bit of data I want to preserve as its used in custom profile scores. Is there anything else I might loose? Is there a way to preserve this and other important metadata? I am at a loss how to rebuild the db without loss of metadata.

This page on the wiki has some information on recovering the DB.

Plex also has a guide that may have some different/additional steps that are worth following.