Script for removing invalid records from srs before starting marc-bib migration process
Remove MARC records with an empty external ID, if found
select count(*) from fs09000000_mod_source_record_storage.records_lb where external_id is null and state = 'ACTUAL' and "record_type" = 'MARC_BIB';
-------------------------------------------------------
DELETE from fs09000000_mod_source_record_storage.records_lb where external_id is null and state = 'ACTUAL' and "record_type" = 'MARC_BIB';Then, run the script below to check if records contain consistent matched ID
with actual_records_count_report as (
select distinct(external_id) as externalId, count(state) as actualCount from <tenant>_mod_source_record_storage.records_lb
where state = 'ACTUAL'
group by external_id
)
select externalId, actualCount from actual_records_count_report
where actualCount > 1If this query returns the data, we need to run the scripts described on this page Clean up records with inconsistent matched id values
After running the script for removing the records with an inconsistent matched ID, run this query:
select * from <tenant>_mod_source_record_storage.records_lb r
left join <tenant>_mod_source_record_storage.marc_records_lb mr on r.id = mr.id
where mr.id is null;If this query returns the data, run the scripts described on this page Script to delete records containing error record data
In case of errors related to optimistic locking exception during data saving phase, run this script Script to update source field of instance records to update the source field of instances, which contains linked MARC records