Howto repoint your Oracle Management Agent to a different OEM 12c Server

This post is also available in: Português

Maybe one day you might face a situation where you lose, change or reinstall your Oracle EM 12c Server and if you do so, you won't need to reinstall all the OMS agents running on your client hosts. All you need is to create a new instance of the agent inside each of your client hosts and configure them.

Let's do it in 4 steps. Before everything, you need to be sure that your agent will be pointing to a new OMS of the same version or of a higher version. Never lower!

Eg:
Agent = 12.1.0.1.0
OMS = 12.1.0.3.0

First of all, create a response file somewhere like "~/deploy.rsp" with the following variables set:

OMS_HOST=oraem12ctrj001
EM_UPLOAD_PORT=4903
AGENT_REGISTRATION_PASSWORD=abc@1234
AGENT_PORT=3872

The response file must contain the OMS_HOST, EM_UPLOAD_PORT, and AGENT_REGISTRATION_PASSWORD parameters. OMS_HOST and EM_UPLOAD_PORT must match your new EM Server host and port. If you use a hostname string instead of an IP in OMS_HOST variable, do not forget to update or set it up inside "/etc/hosts" file. For the agent registration password, you can create a new one in your EM 12c web panel under "Setup->Security->Registration Passwords". You can also define the variable ORACLE_HOSTNAME if you wish to change the host target name that will be presented on your OMS Server. If you omit it, the old one will be used.

Next step is to be sure that the agent is stopped in the client. Logged in as the agent binary owner, run: emctl stop agent

[emc12@oracbddrjs001 ~]$ emctl stop agent
Oracle Enterprise Manager Cloud Control 12c Release 3
Copyright (c) 1996, 2013 Oracle Corporation.  All rights reserved.
Stopping agent ..... stopped.
[emc12@oracbddrjs001 ~]$

Second step is to remove the old instance of the agent. In this example, the agent base folder is "/u01/app/emc12/emagent". We are going to rename the agent_inst folder to agent_inst_old:

[emc12@oracbddrjs001 ~]$ cd /u01/app/emc12/emagent/
[emc12@oracbddrjs001 emagent]$ ls -la
total 36
drwxr-xr-x. 6 emc12 oinstall 4096 May  8 09:46 .
drwxr-xr-x. 3 emc12 oinstall 4096 Nov 18 20:16 ..
-rw-rw-r--  1 emc12 oinstall  178 Jun 22  2013 agentimage.properties
drwxr-xr-x  6 emc12 oinstall 4096 May  8 09:25 agent_inst
drwxr-xr-x  3 emc12 oinstall 4096 Nov 22 11:48 core
drwxr-xr-x  8 emc12 oinstall 4096 Dec 11 01:16 plugins
-rwxr-xr-x  1 emc12 oinstall  223 Nov 22 08:49 plugins.txt
-rw-r--r--  1 emc12 oinstall  298 May  7 16:46 plugins.txt.status
drwxr-xr-x  5 emc12 oinstall 4096 May  7 16:49 sbin
[emc12@oracbddrjs001 emagent]$ mv agent_inst agent_inst_old
[emc12@oracbddrjs001 emagent]$

Now, it's time to reconfigure the agent. To do it, we are going to execute the agentDeploy.sh script inside the core folder passing the parameterized variables AGENT_BASE_DIR, RESPONSE_FILE and using the -configOnly flag:

[emc12@oracbddrjs001 ~]$ /u01/app/emc12/emagent/core/12.1.0.3.0/sysman/install/agentDeploy.sh AGENT_BASE_DIR=/u01/app/emc12/emagent/ RESPONSE_FILE=~/deploy.rsp -configOnly

Executing command : /u01/app/emc12/emagent/core/12.1.0.3.0/jdk/bin/java -classpath /u01/app/emc12/emagent/core/12.1.0.3.0/oui/jlib/OraInstaller.jar:/u01/app/emc12/emagent/core/12.1.0.3.0/oui/jlib/xmlparserv2.jar:/u01/app/emc12/emagent/core/12.1.0.3.0/oui/jlib/srvm.jar:/u01/app/emc12/emagent/core/12.1.0.3.0/oui/jlib/emCfg.jar:/u01/app/emc12/emagent/core/12.1.0.3.0/jlib/agentInstaller.jar:/u01/app/emc12/emagent/core/12.1.0.3.0/oui/jlib/share.jar oracle.sysman.agent.installer.AgentInstaller /u01/app/emc12/emagent/core/12.1.0.3.0 ./core/12.1.0.3.0/sysman/install /u01/app/emc12/emagent /u01/app/emc12/emagent/agent_inst AGENT_BASE_DIR=/u01/app/emc12/emagent

Performing the agent configuration...
Executing command: /u01/app/emc12/emagent/core/12.1.0.3.0/oui/bin/runConfig.sh ORACLE_HOME=/u01/app/emc12/emagent/core/12.1.0.3.0 RESPONSE_FILE=/u01/app/emc12/emagent/core/12.1.0.3.0/agent.rsp ACTION=configure MODE=perform COMPONENT_XML={oracle.sysman.top.agent.11_1_0_1_0.xml} RERUN=true
Configuration Log Location:/u01/app/emc12/emagent/core/12.1.0.3.0/cfgtoollogs/cfgfw/CfmLogger<timestamp>.log
Agent Configuration completed successfully

The following configuration scripts need to be executed as the "root" user.
#!/bin/sh
#Root script to run
 /u01/app/emc12/emagent/core/12.1.0.3.0/root.sh
To execute the configuration scripts:
1. Open a terminal window
2. Log in as "root"
3. Run the scripts
Agent Deployment Successful.
Agent deployment log location:
/u01/app/emc12/emagent/core/12.1.0.3.0/cfgtoollogs/agentDeploy/agentDeploy_2014-05-07_16-45-50-PM.log
Agent deployment completed successfully.
[emc12@oracbddrjs001 emagent]$

Great, everything is almost done. Execute the root script:

[root@oracbddrjs001 ~]# /u01/app/emc12/emagent/core/12.1.0.3.0/root.sh
Finished product-specific root actions.
/etc exist
Finished product-specific root actions.
[root@oracbddrjs001 ~]#

The last steps are restarting your OMS agent and adding it to your OMS Service:

Execute:
emctl start agent
emctl config agent addinternaltargets

[emc12@oracbddrjs001 ~]$ emctl start agent
Oracle Enterprise Manager Cloud Control 12c Release 3
Copyright (c) 1996, 2013 Oracle Corporation.  All rights reserved.
Starting agent .......... started.
[emc12@oracbddrjs001 ~]$ emctl config agent addinternaltargets
Oracle Enterprise Manager Cloud Control 12c Release 3
Copyright (c) 1996, 2013 Oracle Corporation.  All rights reserved.
[emc12@oracbddrjs001 ~]$

If you go now to your EM 12c web console, you will see that the the client was added and is listed as one of the monitored hosts.

Update: Oracle has a great article witch explains those steps, has complete list of prerequisites and can be accessed on: http://docs.oracle.com/cd/E24628_01/install.121/e24089/appdx_repoint_agent.htm.

Have you enjoyed? Please leave a comment or give a 👍!

9 comments

Skip to comment form

    • Aqeel Wahaj on May 18, 2014 at 16:09
    • Reply

    This document really helped, specially understanding how to create a response file. I must say, awesome document.

    1. Thanks Aqeel! I'm glad you enjoyed! =]

    • Mohit on June 20, 2014 at 04:35
    • Reply

    Hi,

    Thanks for the article.

    Can you please let me know what path i have to put for RESPONSE_FILE and where i can find the response file on my old OEM Agent location ?

    Regards,
    Mohit

    1. Hi Mohit,
      I'm glad you enjoyed. You need to create a new response file on any path (eg: "c:\deploy.rsp" or "/tmp/deploy.rsp", if linux). After that, put the variables OMS_HOST, EM_UPLOAD_PORT, AGENT_REGISTRATION_PASSWORD and AGENT_PORT as described.

      Regards,
      Rodrigo

    • Santhosh on June 23, 2016 at 16:15
    • Reply

    I have followed above steps to point existing 12C client to new 13C OMS, I can only see agent, host and oracle home in new 13C OMS but database targets are not visible. Is there any way we can pull all the targets associated with the host{client} ? Thanks...!

    1. Can you see the targets on the client side when you run:
      $ emctl config agent listtargets

      Try:
      $ emctl start agent
      $ emctl config agent addinternaltargets

      Regards,
      DBARJ

    • Steven on October 21, 2016 at 23:24
    • Reply

    Elegant. Thank you.

    Another option in creating that response file as I'm often re-connecting an agent:

    grep -m 3 -E 'OMS_HOST|EM_UPLOAD_PORT|AGENT_PORT' \
    /u01/app/emc12/emagent/core/12.1.0.4.0/inventory/Components21/oracle.sysman.top.agent/12.1.0.4.0/context.xml \
    |tr -s ' '|cut -d ' ' -f3,7|tr -d '"'|sed 's~^NAME=~~'|sed 's~ VAL~~' > ~/deploy.rsp

    Thanks again,
    Steven

  1. Thanks!

    If only the official documentation had gone the extra step of adding the internal targets I wouldn't have wasted a day trying to figure out what I had done wrong and why the Host Target hadn't appeared on the OMS.

    • shymonr19 on August 29, 2021 at 13:57
    • Reply

    HI ,

    i forget my agent_registration_password.. few of the server are deployed. i need to deploy agent in a new server.

    if i reset with new password will the other agent get affected. kindly advice it is for oem 13c

Leave a Reply

Your email address will not be published.