Hi Martin,
Sounds like ... Technical systems has not been maintained peroperly in the LMDB.
Advise you please check the "Landscape Verification".
LMDB=> Technical system=> Landscape Verification => Execute Verification Check
once you happy the Landscaspe Verification then run optimizer.
Regards
Mani