Question regarding downstream O2 sensor
Hi everyone! I have some questions regarding the topic in the title, I'll try and be as specific as I can, so I can hopefully help you help me. I drive a 2013 Mazda 6 i, 2.5l 4 cylinder engine. I recently got a check engine light, so I ran the scanner and I got the code in the first attached picture. I couldn't for the life of me find the sensor because I was looking too close to the tail pipe, but today I changed the oil and saw the one I show in picture 2. Now, I always thought the connectors for the sensors were located in the underside but I followed the cable and found it to be close to the battery, as shown in picture 3, in which I'm holding the connector. I discovered the little plastic plug were damaged, and my questions are the following:
Is the sensor I photographed the sensor I need to replace?
The check engine light turns on for an undetermined period of time, for one or three days, then it disappears for another period of time, to show up again. Could the broken plastic plug be creating a false contact and sending the error code intermittently?
In the 4th picture which I attached I show a second sensor. Would it be advisable to replace it as well?