Newsletters




Oops, do over!


By Ray Smith , Database Administrator, PGE - Portland General Electric

Sometimes discovery of new host simply doesn’t work.  The agent may be installed and registered with the local inventory and the repository has references to the host and agent, but the agent obviously just needs to be reinstalled from scratch.

The process is fairly straight-forward and requires actions on the remote host and on your OMS management server.

Remote Host

Connect to the remote host and execute two emctl commands to start the scrubbing.

  1. Execute emctl status agent to find the exact name of the agent. In this example we’ll use myhost:3872.
  2. Stop the agent using the emctl stop agent command.

Keep that terminal window open, we’ll be back in a minute.

Management Server

Enterprise manager command line interface is installed on your OMS management server, so connect to that host and run two emcli commands

  1. Log in to emcli with emcli login -username="sysman".  You will be prompted for the password for that user.
  2. Execute this string on one line, substituting the agent name you discovered on the remote host:
            emcli delete_target -name="myhost:3872" \
     -type="oracle_emd" \
    -delete_monitored_targets \
    -async;

When it executes successfully, particularly for a new agent installation without history, this command runs more quickly than clicking through the console.  You can get the same results from the console, but you have to remove all the monitored targets manually before removing the agent.

If you get an error that agent is still running, just wait a moment for OMS to realize that you stopped the agent and for Oracle Enterprise Manager to flag the agent as in Unreachable state.  Just keep trying until it runs.

Under no circumstances should you attempt to remove the agent using this SQL statement for Oracle Enterprise Manager 12c. It used to work really well in 11g, but it can cause corruption in your 12c repository database.

exec mgmt_admin.cleanup_agent(‘myhost:3872′);


Under no circumstances should you attempt to remove the agent using this SQL statement for Oracle Enterprise Manager 12c. It used to work really well in 11g, but it can cause corruption in your 12c repository database.

exec mgmt_admin.cleanup_agent(‘myhost:3872′);

Remote Host

You also need to manually remove the agent software from your remote host with Oracle Universal Installer to ensure the proper inventory updates and then remove everything from the agent home directory.

  1. Move into your $AGENT_BASE/core/<release>/oui/bin directory
  2. Execute OUI in deinstall mode with ./runInstaller –deinstall
  3. Clean up the installation directories under $AGENT_BASE with an rm –rf command

Staged Deinstall

Oracle Enterprise Manager creates separate Oracle Homes for each plug-in installed on the remote host.  The subsidiary homes must be removed prior to removing the agent home itself. 



Fresh Host Discovery

You are now ready to reinstall the agent from the console.  Good luck! 


Sponsors