We investigated the resistive switching characteristics of two types of PtNiOPt structures with epitaxial and polycrystalline NiO layers. Both of these PtNiOPt structures exhibited unipolar resistive switching. Pt/epitaxial- NiOPt showed unstable switching or no resistance state change after several repeated runs. Pt/polycrystalline- NiOPt showed very reproducible switching. The experimental data indicated that microstructural defects (e.g., grain boundaries) played crucial roles in the reliability of the unipolar resistive switching behavior. This was further supported by first-principles calculations.