your circuit may be correct, but the problem i feel is the hysterisis setting of the OPAMP, when you switch the 2nd battery obviously the voltage of the running battery comes high again, so the circuit again reconnect it to 1st battery then imediately to other...it continues and you get such osscillation.
modify your circuit only to trigger one time, or to give you an indication so that you will manually change it from one to another.
Edit: i understood your post wrong, since you need change over when the 1st battery is charged. so check wheather your input to the realy is stable or not, also make sure you use a freewheeling doide across the relay, drive the relay through a transistor after OPAMP.