How to move OEM12c management agent to new location
While working on another Exadata project recently I found that OEM12c agents on the compute nodes were installed on different locations on each of the three Exadatas. On one of them was under /home/oracle/agent, another one had them under /opt/oracle/agent and third one had them under /oracle/agent. Obviously this was not the standard and the agents had to be moved under /u01/app/oracle/agent. The only problem with that was that the three Exadatas were already discovered along with some database targets. Fortunately this wasn’t production yet but it would still require all the agents to be reinstalled and all targets rediscovered.
Fortunately there is an easier way to move the OEM management agents to new location without all the hassle of reinstalling agents and rediscovering agents. In the following example the agent was installed in /home/oracle/agent/ and I had to move it to /u01/app/oracle/agent/.
First you need to download the ConvertToStandalone.pl utility from 2021782.1 and then upload it to the server under /home/oracle
You need to create a list of plugins, otherwise the move process will fail:
[oracle@exa01db01 ~]$ /home/oracle/agent/core/18.104.22.168.0/perl/bin/perl /home/oracle/agent/core/22.214.171.124.0/sysman/install/create_plugin_list.pl -instancehome /home/oracle/agent/core/126.96.36.199.0
This will create a file /home/oracle/agent/plugins.txt which is used by the perl script later.
Export the following variables:
export OLD_AGENT_HOME=/home/oracle/agent/core/188.8.131.52.0 export ORACLE_HOME=/u01/app/oracle/agent/core/184.108.40.206.0
Another thing is you need to do is to modify the SBIN_MODIFIED_VERSION from 220.127.116.11.0. to 18.104.22.168.0 in /home/oracle/agent/agentimage.properties, otherwise the process will fail.
Then run the perl script which will migrate the agent home to the new location:
[oracle@exa01db01 ~]$ /home/oracle/agent/core/22.214.171.124.0/perl/bin/perl /home/oracle/ConvertToStandalone.pl -instanceHome /home/oracle/agent/agent_inst -newAgentBaseDir /u01/app/oracle/agent
Pay attention that the script accepts two arguments, instanceHome is the agent instance home directory e.g. /home/oracle/agent/agent_inst/ and the newAgentBaseDir is the new base dir for the agent /u01/app/oracle/agent/
After the command completes you need to run root.sh as root:
[oracle@exa01db01 ~]# /u01/app/oracle/agent/core/126.96.36.199.0/root.sh Finished product-specific root actions. /etc exists
Deinstall the old agent:
[oracle@exa01db01 ~]$ /home/oracle/agent/core/188.8.131.52.0/perl/bin/perl /home/oracle/agent/core/184.108.40.206.0/sysman/install/AgentDeinstall.pl -agentHome /home/oracle/agent/core/220.127.116.11.0
Finally remove the old agent directory where a log file from the deinstall process is left:
[oracle@exa01db01 ~]$ rm -rf /home/oracle/agent
The beauty of this process is that the script will create a blackout AGT_CNT_BLK_OUT on a node level and then stop the agent. It will then migrate the agent to the new home, start the agent and finally remove the blackout. The whole process takes less than five minutes.