Stable5 oracle testsuite fixes

backports of oracle fixes from master. see list of commits

@DeepDiver1975 @MTGap @karlitschek @icewind1991 @bartv2 @VicDeo