The atomic number, represented by the letter Z, is the number given to each chemical element, i.e. to each different type of atom.
The atomic number of an atom is always equal to its number of protons.
In a neutral atom, there are as many protons as there are electrons. Thus, for these atoms, the atomic number also indicates the number of electrons they have. However, when an atom forms an ion, the number of protons is different from the number of electrons. Therefore, the atomic number should not be used to determine the number of electrons.
The atomic number for oxygen in the periodic table is 8. Therefore, this atom has 8 protons.
Each element has its own atomic number. When we change the atomic number, we change the element, as the number of protons is specific to each substance.
There are no exceptions to this rule.