Absolute cross sections for the single and double K-shell photoionization of carbonlike ${\mathrm{O}}^{2+}$ and nitrogenlike ${\mathrm{O}}^{+}$ ions were measured in the 526--620-eV photon energy range by employing the ion-photon merged-beam technique at the SOLEIL synchrotron radiation facility. High-resolution spectroscopy up to $E/\mathrm{\ensuremath{\Delta}}E\ensuremath{\approx}5300$ was achieved. Rich resonance structures observed in the experimental spectra are analyzed and identified with the aid of R-matrix and multiconfiguration Dirac-Fock (MCDF) methods. For these two atomic oxygen ions of particular astrophysical interest we characterized the strong $1s\ensuremath{\rightarrow}2p$ and the weaker $1s\ensuremath{\rightarrow}np\phantom{\rule{0.28em}{0ex}}(ng2)$ resonances observed. A detailed comparison of the energies of the $1s\ensuremath{\rightarrow}2p$ resonances in the first members of the oxygen isonuclear sequence measured by synchrotron based experiments and the Chandra and XMM-Newton x-ray satellites is presented.