Resistively switching oxides are promising materials for use in electronic applications such as nonvolatile memories, logic gates, and artificial synapses. This work presents the bipolar resistive switching (BRS) in YMnO3/Nb:SrTiO3 pn-heterojunctions. A thermally driven electroforming process is required prior to the observed BRS. Results indicate that the BRS in YMnO3/Nb:SrTiO3 originates from the combined effects of charge trapping and detrapping processes along with the electro-migration of charged point defects in the depletion layer of the pn-heterojunction. It is shown that the built-in voltage of the pn-heterojunctions can be tuned by the oxygen partial pressure during growth of the YMnO3 thin film and impacts the working parameters of the resistively switching cell. This study provides a guideline for material engineering of bipolar resistive switches based on pn-heterojunctions.