Denaturation of proteins includes the interruption and conceivable decimation of both the secondary and tertiary structures. Since denaturation responses are not sufficiently solid to break the peptide bonds, the essential structure (arrangement of amino acids) continues as before after a denaturation procedure.
There are four levels in protein structure formation. Primary structure is the most basic one where the amino acids are linked to each other via peptide bonds. It is formed between carboxyl group of one amino acid and amino group of another amino acid. When Hydrogen bonding occurs in this polypeptide chain, secondary structure is formed. It can be of two types alpha helix and beta sheet. Tertiary structure is formed by side chain interactions within the polypeptide. Quarternary structure is formed when two or more polypetide chains interact with each other. Denaturation is able to disrupt various hydrophobic and hydrophilic interactions hence protein's structure is destroyed till secondary level. However it is not able to disrupt peptide bond hence primary structure remains intact.
Well oxygen has 6 electrons in its outer shell and mg has 2. Oxygen need two to complete it's outer shell and mg needs to lose 2 to gain a complete out we shell.