ZrO2 films were in situ prepared using the anodic passivation of a ZrB2 ceramic in alkaline solutions. The composition and structure of the films were characterized using field-emission scanning electron microscopy (FE-SEM), Raman spectroscopy, and X-ray photoelectron spectroscopy (XPS). The corrosion resistances were evaluated in 0.1 M oxalate solution using the potentiodynamic polarization method (PDP) and the electrochemical impedance spectroscopy (EIS) technique. The results show that ZrO2 films can be prepared using anodization from −0.8 to 0.8 V standard hydrogen electrode (SHE) in 2–16 M NaOH solutions. During the anodization, the dehydration reaction of Zr(OH)4 to ZrO2 caused the volume shrinkage and tensile stress of the films. When the thickness of the films exceeded a critical value, the mud-cracking morphology occurred. The films without cracks exhibited the inhibition effect and provided effective corrosion protection in a 0.1 M H2C2O4 solution, which had a positive correlation with the film thickness. The film obtained when put in an 8 M NaOH solution (near the critical thickness) was found to significantly improve its corrosion resistance when put in a 0.1 M H2C2O4 solution by almost one order of magnitude compared with the bare ceramic.