This paper presents an x-ray study of GaN, which is grown on nominally undoped and oxygen-doped AlN nucleation layers on sapphire substrates by metal organic vapor phase epitaxy. Without additional oxygen doping a trimodal nucleation distribution of AlN is observed leading to inhomogeneous in-plane strain fields, whereas in oxygen-doped layers a homogeneous distribution of nucleation centers is observed. In both types of nucleation layers extremely sharp correlation peaks occur in transverse ω-scans which are attributed to a high density of edge-type dislocations having an in-plane Burgers vector. The correlation peaks are still visible in the (0002) ω-scans of 500 nm GaN which might mislead an observer to conclude incorrectly that there exists an extremely high structural quality. For the undoped nucleation layers depth-sensitive measurements in grazing incidence geometry reveal a strong thickness dependence of the lattice parameter a, whereas no such dependence is observed for doped samples. For oxygen-doped nucleation layers, in cross-sectional transmission electron microscopy images a high density of stacking faults parallel to the substrate surface is found in contrast to undoped nucleation layers where a high density of threading dislocations is visible. GaN of 2.5 μm grown on top of 25 nm AlN nucleation layers with an additional in situ SiN mask show full widths at half maximum of 160″ and 190″ in (0002) and (10–10) high-resolution x-ray diffraction ω-scans, respectively.