Script to remove SRS MARC_BIB records with no links to Instance Id

MODSOURMAN-944 - Getting issue details... STATUS

MODSOURCE-585 - Getting issue details... STATUS

MARC Bib records stored in SRS with no externalId links are considered invalid. They might have been created by import jobs that failed or completed with errors, therefore these records contain no reference to FOLIO entities (Instances in case of MARC BIB records). Such records may cause problems when the user tries MARC to MARC match on 035 field, for example. If there is a valid record in SRS with the reference to Instance id and a record with no such reference, but with identical 035 value, DI will show a Multiple match error. Until the matching mechanism is fixed, the issue can be overcome by deleting invalid SRS records from the DB with the following script:

DELETE FROM {TENANT_ID}_mod_source_record_storage.records_lb
	WHERE record_type ='MARC_BIB' AND external_id IS NULL;