The group number in a periodic table tells us about the number of valence electrons in that certain element. So as Oxygen is in group 6 so it has six valence electrons in its outer most shell. It has two orbitals/shells. It has 2 electrons in the first and remaining six in the 2nd shell thus completing in total 8 electrons. It needs two more electrons to achieve stability, 6+2=8, thus it will ahve 8 electron in the outer most shell too. Hope you got it. If you have any problem with chemistry I ll be happy to help! :)