An oil well is the hole in the earth from which oil is extracted. And oil rig is the mechanical device used by oil companies to extract the oil from the oil well.
An oil well refers to any land or marine based drilling operation to extract oil from the ground while an oil rig refers to the actual machinery that bores through the ground and can be land-based or marine-based.