The O2 sensor is actually easier (IMHO) to replace than the knock sensor. See this link for the O2 sensor locations:
formatting link
Do you know what the exact code was? It will help identify which O2 sensor has failed.
You can either rent an O2 sensor socket kit from Autozone (or other car parts place) or just use an open ended wrench to get the O2 sensor out. Soaking it for a few minutes with a penetrant like PB Blaster will make removing it easier.
I would recommend using anti-seize on the threads of the new O2 sensor to make removal easier. Be careful not to contaminate the tip of the sensor.
You can buy Bosch (OEM equivalent) O2 sensors from
formatting link
for a fair price.
Cheers. Nirav
96 Max GLE, 117k