You may be able to use an 11/16" socket. 17mm = 0.669". 11/16 = 0.6875".
Be aware that build tolerances usually allow a few thousandths +/- for tooling.
The issue is you need to use a quality socket, as cheap ones will round a rusty, stuck O2 sensor off in short order. So you will need to sacrifice a good tool and mill a slot into it lengthwise to accommodate the O2 wiring. 1/4" wide will suffice. The quickest way would be to set the socket in your vertical mill and just hog it out, as accuracy to ten one thousandths isn't necessary here. Or you can put it in a vise and use a cutoff wheel, but that is more dangerous.
If you are replacing the O2 sensor, all of that is unnecessary. You can just cut the sensor down to the nub and put a regular socket on, if clearance allows. If not, use a line wrench and an oxy-acetelyne torch to heat the O2 bung to cherry red. It'll come out, trust me. Use nickel-based anti-seize on the threads of the new O2 sensor when installing it. Just a little bit, as excess amounts can foul the lambda sensor element, or the heating element.