how to replace o2 sensor on 2004 Dodge Grand Caravan

The upstream sensor is the one that threads into the exhaust manifold . After you replace it then disconnect the battery. This will not only clear the codes, but will clear all engine controller memory and it will let it relearn the characteristics of the new sensor's heater circuit.

There is only one upstream and one downstream sensor. The upstream one is in the rear exhaust manifold, downstream threads into the side of the catalytic converter.

After disconnecting the battery you won't need to do anything special, normal driving is fine. It won't take long for the PCM to relearn all of it's adaptive memory, probably 10-15 miles or less.