oracle.sysman.emSDK.emd.comm.OperationException: could not write to targets.xml.bak file
I had some trouble adding a new database to an OEM Grid installation this weekend.
I didn't find too many references to the above error so I wanted to post about it here. Of course Metalink was all doom and gloom. Note 745795.1 says to stop the agent, run fsck on the AGENT_HOME filesystem, then start the agent. After that you should be able to add new targets.
targets.xml lives in AGENT_HOME/sysman/emd. At the OS prompt I changed to that directory I was able to create new files there but for some reason the above error kept popping up when Grid tried to save a new target.
Don't believe the fsck'ng hype. Bring the agent down and back up and try again, worked for me. It is possible there was an issue with writing to the AGENT_HOME directory at some point but the Agent didn't recover nicely. An agent restart seemed to solve this for me.