can you tell me what make, model, engine size and fuel type this is please?
also how many miles are on the car and when it was last serviced?
to get those knock / misfire faults along with the o2 fault then I'd 1st say its worth checking the fuel pressure on a running engine as it should be about 3.0 Bar when measured at the fuel rail
if its low then you'll get fuel starvation , misfires, knocking and cataylst faults as you describe
and the 1st thing to try and rectify it would be a new fuel filter
Also replace the spark plugs if any of them fail this checklist:http://www.ngksparkplugs.com/tech_support/spark_plugs/faqs/faqread.asp
You can also try spraying some water on the coil packs with the engine running. It is possible the coil is faulty and causing the misfire. If you see sparks arcing with the water, then replace the coil.
I'd check the condition of the injector plugs / connections as this could be a lean misfire if an injector isn't firing properly - the best way to check this is with a 'noid' light
Then check all the connections to the engine sensors one at a time, remove each one and examine for signs of corrosion or damage and a squirt of contact cleaner ( not WD40) will also help.
This could be an airleak after the airflow meter, any air dragged in here isn't 'seen' by the ECU and so not compensated for and leans the engine out causing rough running.
Check the hose clips for tightness and inspect the trunking for any cracks or splits and also all the vacuum system, the small bore pipes and fittings for cracks and missing parts.
Check for exhaust leaks before the O2 sensor as if this has been experiencing an exhaust leak then it will have been running very rich as the sensor will see the extra air pulled in as fresh / lean fuelling and be adding fuel to compensate.
this can lead to catalyst failure as the extra fuel can re-light inside and melt the catalyst
The best way to find an exhaust leak is to run the engine from cold and feel around the exhaust joints with your bare hands - you'll have about 30 seconds before it all gets too hot and you should feel any escaping gas moving over your fingers
just get back to me on this post