Ab initiolattice dynamics and charge fluctuations in alkaline-earth oxides