I am getting an error Invalid Filter error when trying to open a contact that was configured with a contact type that has since been deleted. The contacts are returned in the search but I am unable to open. Is there a way to restore the contacts without having to manually re-enter each contact or restoring a backup of the database?
You could change clean out all the contact_sub_types of the relevant contacts directly in the DB with an SQL Query. That would be something like:
SELECT * FROM civicrm_contact WHERE contact_sub_type IS NOT NULL AND contact_sub_type NOT IN (SELECT name FROM civicrm_contact_type)
To add to Erik answer: the contact_sub_type field contains an aggregation of all its sub types, with a "hidden" separators ^A, if you want to modify the subtype directly,
update civicrm_contact set contact_sub_type=concat(char(01),"EXAMPLE",char(01)) where ...