What's the electronic configuration of Nickel and Oxygen in RNiO3 (R=Rare-Earth)? Nickel's electronic ground state is $\mathrm{3d^8 4s^2}$ (there's a dispute on this, but let's not worry about it for now). Oxygen's is $\mathrm{2s^2 2p^4}$. In a Rare-Earth based Nickelate with chemical formula $\mathrm{RNiO_3}$, if we assume simple ionic bonds, then what should the electronic state be?

Literature indicate that the "classical" case is $\mathrm{Ni^{3+} O^{2-}}$ corresponding to $\mathrm{3d^7, 2p^6}$. But this means that Oxygen has gained 2*3=6 electrons. But how can this be possible if Nickel has donated only 3 electrons?
What's the electronic configuration of Nickel and Oxygen in RNiO3
  (R=Rare-Earth)?


As an example, let's look at $\ce{LaNiO3}$.  Each oxygen has an oxidation state of -2, nickel has an oxidation state of +3 and lanthanum has an oxidation state of +3.  Overall the molecule is neutral.
$$\ce{La(+3)~ plus~ Ni(+3)~plus~ 3~oxygens (-6)~=~0}$$