OEM Agent Deinstall

NOTE: You need to perform both tasks described on this page (Remove Agent from OEM and Remove Agent from Machine). They are NOT the same thing.

Remove Agent from OEM

cd $EMAGENT_HOME/bin
./emctl stop agent

Remove Agent from Machine

As the user that owns the agent; usually 'oracle'

or 'oms' (if you are removing the Agent on the OMS server)...

$EMAGENT_HOME/sysman/install/AgentDeinstall.pl -agentHome $EMAGENT_HOME

Assumes EMAGENT_HOME is set correctly in your environment.If you get "not found" messages, check that perl is accessible from the location the script references. In testing I needed to do this as root:ln -s /usr/bin/perl /usr/local/bin/perlAlternatively, you can edit the first line of AgentDeinstall.pl to reflect the correct location of perl.
 Agent Oracle Home: /u01/app/em13/agent_13.3.0.0.0
agentHome = /u01/app/em13/agent_13.3.0.0.0Agent installed in config modevalue of skip flag is falseNOTE: The agent base directory: /u01/app/em13 will be removed after successful deinstallation of agent home.The command is /u01/app/em13/agent_13.3.0.0.0/oracle_common/jdk/jre/bin/java -classpath /u01/app/em13/agent_13.3.0.0.0/oui/modules/OraInstaller.jar:/u01/app/em13/agent_13.3.0.0.0/oui/modules/emCfg.jar:/u01/app/em13/agent_13.3.0.0.0/jlib/agentInstaller.jar oracle.sysman.agent.installer.AgentDeinstallation /u01/app/em13/agent_13.3.0.0.0 /u01/app/em13 /u01/app/em13/agent_instOct 21, 2020 10:43:37 AM oracle.sysman.agent.installer.AgentInstaller$StreamGobbler runINFO: Oracle Enterprise Manager Cloud Control 13c Release 3Oct 21, 2020 10:43:37 AM oracle.sysman.agent.installer.AgentInstaller$StreamGobbler runINFO: Copyright (c) 1996, 2018 Oracle Corporation.  All rights reserved.Oct 21, 2020 10:43:41 AM oracle.sysman.agent.installer.AgentInstaller$StreamGobbler runINFO: Agent is Not RunningOct 21, 2020 10:43:41 AM oracle.sysman.agent.installer.AgentInstaller$StreamGobbler runINFO: Plugin homes:Oct 21, 2020 10:43:41 AM oracle.sysman.agent.installer.AgentInstaller$StreamGobbler runINFO: Plugin homes:Oct 21, 2020 10:43:41 AM oracle.sysman.agent.installer.AgentInstaller execCommandSEVERE: STDERR:
STDOUT=
Oracle Enterprise Manager Cloud Control 13c Release 3Copyright (c) 1996, 2018 Oracle Corporation.  All rights reserved.Agent is Not RunningOct 21, 2020 10:43:41 AM oracle.sysman.agent.installer.AgentDeinstallation mainINFO: Creating directory /u01/app/em13/agent_13.3.0.0.0/install/tmp completed successfully.Oct 21, 2020 10:43:41 AM oracle.sysman.agent.installer.AgentDeinstallation mainINFO: File /etc/oragchomelist exists.Oct 21, 2020 10:43:41 AM oracle.sysman.agent.installer.AgentDeinstallation mainINFO: File /etc/oragchomelist is writable.Oct 21, 2020 10:43:41 AM oracle.sysman.agent.installer.AgentDeinstallation mainINFO: Index :-1 for line :Oct 21, 2020 10:43:41 AM oracle.sysman.agent.installer.AgentDeinstallation mainINFO: Index :-1 for line :Oct 21, 2020 10:43:41 AM oracle.sysman.agent.installer.AgentDeinstallation mainINFO: Index :-1 for line :Oct 21, 2020 10:43:42 AM oracle.sysman.agent.installer.AgentDeinstallation mainINFO: Index :-1 for line : /u01/app/em12c/agent_13.1.0.0.0:/u01/app/em12c/agent_instOct 21, 2020 10:43:42 AM oracle.sysman.agent.installer.AgentDeinstallation mainINFO: Index :-1 for line :Oct 21, 2020 10:43:42 AM oracle.sysman.agent.installer.AgentDeinstallation mainINFO: Index :0 for line : /u01/app/em13/agent_13.3.0.0.0:/u01/app/em13/agent_instOct 21, 2020 10:43:42 AM oracle.sysman.agent.installer.AgentDeinstallation mainINFO: Overwriting the contents since oracle home:/u01/app/em13/agent_13.3.0.0.0 entry already exists.The output is Agent Deinstall:agent deintall has been startedExecuting status :0Agent service stopped successfully. and the exit code is 0Agent deconfiguration completed successfully. 0

 DetachHome Command executed:/u01/app/em13/agent_13.3.0.0.0/oui/bin/detachHome.sh -silent ORACLE_HOME=/u01/app/em13/agent_13.3.0.0.0WARNING: Ignoring ORACLE_HOME=<value> on the command line (cannot override the Oracle Home to be detached)Launcher log file is /tmp/OraInstall2020-10-21_10-43-44AM/launcher2020-10-21_10-43-44AM.log.Starting Oracle Universal Installer
Checking swap space: must be greater than 500 MB.   Actual 19456 MB    PassedChecking if this platform requires a 64-bit JVM.   Actual 64    Passed (64-bit not required)

'detachHome' was successful.Logs successfully copied to /u01/app/oraInventory/logs.
 Removing other files ...
NOTE: The targets monitored by this Management Agent will not be deleted in the Enterprise Manager Repository by this deinstall script. Make sure to delete the targets manually from the Cloud Control Console for a successful deinstallation.

Bibliography

EM 12c, EM 13c: Enterprise Manager Cloud Control Agent Removal Using AgentDeinstall.pl on the Target Host and Agent Decommission in the Console (Doc ID 1673394.1)