We perform first-principles pseudopotential calculations to investigate the oxidation process by oxygen gas exposure in single-wall carbon nanotubes with a closed tip. Oxygen molecules can be initially adsorbed either on the tube cap or wall, keeping their molecular form, then, a successive transformation occurs into the stable geometry with broken C-C and O-O bonds. The broken-bond configuration of oxidated nanotubes is suggested to be a precursor for etching away the tube cap and wall, particularly, in nanotubes with small diameters, while the oxidative etching is suppressed on the wall of nanotubes with large diameters. Despite a charge transfer from the tube to O-2 molecule, metallic nanotubes still exhibit the metallic conduction, in good agreement with experiments.