One thing I'll add ? the "replace with power on" instruction is correct and it's the whole point of absolute encoders. The encoder retains position data in volatile memory while powered. You swap the battery, the encoder never loses power from the drive's 5V supply, and you're done. Takes 30 seconds.
The safety concern is real though. What we do: lock out the main motor circuit but leave the drive control power on. That way the cabinet is safe to open (no high voltage on the bus) but the encoder still has its 5V keep-alive. Check your drive manual for the specific procedure ? on Yaskawa Sigma series there's a dedicated battery connector accessible without exposing the power terminals.
On replacement interval: 2 years is aggressive but safe. I've seen Yaskawa ER6V batteries last 4-5 years in climate-controlled plants, but in shops with wide temperature swings (hot summers, cold winters) they degrade faster. The 3.4V-under-load issue carlos_mx mentioned is real ? we had the same thing on a Fanuc setup. Now we check voltage under load during every quarterly PM. If it's below 3.0V loaded, it gets replaced regardless of age.
Pro tip: label every battery with the install date using a paint pen. Sounds basic but when you have 12 presses and batteries scattered across different PM cycles, that label saves you from guessing.