Memristive switching in polycrystalline materials is widely attributed to the formation and rupture of conducting filaments, believed to be mediated by oxygenâvacancy redistribution. The underlying atomicâscale processes are still unknown, however, which limits device modeling and design. Here, experimental data are combined with multiscale calculations to elucidate the entire atomicâscale cycle in undoped polycrystalline BiFeO3. Conductive atomic force microscopy reveals that the grain boundaries behave like 2D nanovaristors, while on the return part of the cycle, the decreasing current is through the grains. Using densityâfunctionalâtheory and Monte Carlo calculations, the atomicâscale mechanism of the observed phenomena is deduced. Oxygen vacancies in nonequilibrium concentrations are initially distributed relatively uniformly, but they are swept into the grain boundaries by an increasing voltage. A critical voltage, the SET voltage, then eliminates the barrier for hopping conduction through vacancy energy levels in grain boundaries. On the return part of the cycle, the grain boundaries are again nonconductive, but the grains show nonzero conductivity by virtue of remote doping by oxygen vacancies. The RESET voltage amounts to a heat pulse that redistributes the vacancies. The realization that nanovaristors are at the heart of memristive switching in polycrystalline materials may open possibilities for novel devices and circuits.