A novel heterostructure is designed by stacking 2D black phosphorus (BP) on a SrTiO3 substrate. The device demonstrates programmable photoconductive switching under illumination of UV and red light. The light-tunable persistent photoconductivity exhibits a large on/off ratio exceeding 105. The persistent state shows almost no relaxation or decay at low temperature. These features are suitable for a new generation of optoelectronic devices for memory application.