Effective shell-model interaction for the isotopes of oxygen