How to Deinstall OEM Agent from Oracle Enterprise Manager 12C

There are a couple of ways to deinstall an OEM agent: from OEM Console, in silent mode, by running runInstaller, by running AgentDeinstall.pl, etc.

This post shows different kind of ways available for uninstalling an Oracle 12c EM agent.

Before starting to uninstall an agent, stop OEM agent first.

   $ emctl stop agent

Decommission the agent from OEM Console

a) Go to OEM agent home –> Target Setup –> Agent Decommission

Capture1

b) Confirm the agent decommission.

uninstall_2

c) It will delete all the related targets monitored by this agent. This will save lots of time and energy compared to the old way, in which we have to manually delete every monitored target one by one.

d) Confirm the agent target will be deleted, plus all the targets monitored by this agent.

uninstall_4

e) Agent is decommissioned. All the targets monitored by this agent are deleted from OEM as well.

uninstall_5

De-install the agent in Silent Mode

$export AGENT_HOME=/u01/app/oracle/product/agent12g/core/12.1.0.5.0

$ cat inventory.xml
<?xml version="1.0" standalone="yes" ?>
<!-- Copyright (c) 1999, 2015, Oracle and/or its affiliates.
All rights reserved. -->
<!-- Do not modify the contents of this file by hand. -->
<INVENTORY>
<VERSION_INFO>
 <SAVED_WITH>11.1.0.13.0</SAVED_WITH>
 <MINIMUM_VER>2.1.0.6.0</MINIMUM_VER>
</VERSION_INFO>
<HOME_LIST>
<HOME NAME="OraGI12Home1" LOC="/u01/app/12.1.0.2/grid" TYPE="O" IDX="1" CRS="true">
 <NODE_LIST>
 <NODE NAME="racnode1"/>
 <NODE NAME="racnode2"/>
 </NODE_LIST>
</HOME>
<HOME NAME="OraDb11g_home1" LOC="/u01/app/oracle/product/11.2.0/dbhome_1" TYPE="O" IDX="2">
 <NODE_LIST>
 <NODE NAME="racnode1"/>
 <NODE NAME="racnode2"/>
 </NODE_LIST>
</HOME>
<HOME NAME="agent12c1" LOC="/u01/app/oracle/product/agent12g/core/12.1.0.5.0" TYPE="O" IDX="3">
 <REFHOMELIST>
 <REFHOME LOC="/u01/app/oracle/product/agent12g/sbin"/>
 <REFHOME LOC="/u01/app/oracle/product/agent12g/plugins/oracle.sysman.xa.discovery.plugin_12.1.0.6.0"/>
 <REFHOME LOC="/u01/app/oracle/product/agent12g/plugins/oracle.sysman.db.discovery.plugin_12.1.0.8.0"/>
 <REFHOME LOC="/u01/app/oracle/product/agent12g/plugins/oracle.sysman.emas.discovery.plugin_12.1.0.8.0"/>
 <REFHOME LOC="/u01/app/oracle/product/agent12g/plugins/oracle.sysman.oh.discovery.plugin_12.1.0.5.0"/>
 <REFHOME LOC="/u01/app/oracle/product/agent12g/plugins/oracle.sysman.oh.agent.plugin_12.1.0.5.0"/>
 </REFHOMELIST>
</HOME>
<HOME NAME="sbin12c1" LOC="/u01/app/oracle/product/agent12g/sbin" TYPE="O" IDX="4">
 <DEPHOMELIST>
 <DEPHOME LOC="/u01/app/oracle/product/agent12g/core/12.1.0.5.0"/>
 </DEPHOMELIST>
</HOME>
<HOME NAME="OraHome1" LOC="/u01/app/oracle/product/agent12g/plugins/oracle.sysman.xa.discovery.plugin_12.1.0.6.0" TYPE="O" IDX="5">
 <DEPHOMELIST>
 <DEPHOME LOC="/u01/app/oracle/product/agent12g/core/12.1.0.5.0"/>
 </DEPHOMELIST>
</HOME>
<HOME NAME="OraHome2" LOC="/u01/app/oracle/product/agent12g/plugins/oracle.sysman.db.discovery.plugin_12.1.0.8.0" TYPE="O" IDX="6">
 <DEPHOMELIST>
 <DEPHOME LOC="/u01/app/oracle/product/agent12g/core/12.1.0.5.0"/>
 </DEPHOMELIST>
</HOME>
<HOME NAME="OraHome3" LOC="/u01/app/oracle/product/agent12g/plugins/oracle.sysman.emas.discovery.plugin_12.1.0.8.0" TYPE="O" IDX="7">
 <DEPHOMELIST>
 <DEPHOME LOC="/u01/app/oracle/product/agent12g/core/12.1.0.5.0"/>
 </DEPHOMELIST>
</HOME>
<HOME NAME="OraHome4" LOC="/u01/app/oracle/product/agent12g/plugins/oracle.sysman.oh.discovery.plugin_12.1.0.5.0" TYPE="O" IDX="8">
 <DEPHOMELIST>
 <DEPHOME LOC="/u01/app/oracle/product/agent12g/core/12.1.0.5.0"/>
 </DEPHOMELIST>
</HOME>
<HOME NAME="OraHome5" LOC="/u01/app/oracle/product/agent12g/plugins/oracle.sysman.oh.agent.plugin_12.1.0.5.0" TYPE="O" IDX="9">
 <DEPHOMELIST>
 <DEPHOME LOC="/u01/app/oracle/product/agent12g/core/12.1.0.5.0"/>
 </DEPHOMELIST>
</HOME>
</HOME_LIST>
<COMPOSITEHOME_LIST>
</COMPOSITEHOME_LIST>
</INVENTORY>

a) Deinstall the plug-in homes.

$AGENT_HOME/oui/bin/runInstaller -deinstall -silent "REMOVE_HOMES={/u01/app/oracle/product/agent12g/plugins/oracle.sysman.xa.discovery.plugin_12.1.0.6.0}" -invPtrLoc /etc/oraInst.loc
$AGENT_HOME/oui/bin/runInstaller -deinstall -silent "REMOVE_HOMES={/u01/app/oracle/product/agent12g/plugins/oracle.sysman.db.discovery.plugin_12.1.0.8.0}" -invPtrLoc /etc/oraInst.loc
$AGENT_HOME/oui/bin/runInstaller -deinstall -silent "REMOVE_HOMES={/u01/app/oracle/product/agent12g/plugins/oracle.sysman.emas.discovery.plugin_12.1.0.8.0}" -invPtrLoc /etc/oraInst.loc
$AGENT_HOME/oui/bin/runInstaller -deinstall -silent "REMOVE_HOMES={/u01/app/oracle/product/agent12g/plugins/oracle.sysman.oh.discovery.plugin_12.1.0.5.0}" -invPtrLoc /etc/oraInst.loc
$AGENT_HOME/oui/bin/runInstaller -deinstall -silent "REMOVE_HOMES={/u01/app/oracle/product/agent12g/plugins/oracle.sysman.oh.agent.plugin_12.1.0.5.0}" -invPtrLoc /etc/oraInst.loc

b) Deinstall the sbin home.

$AGENT_HOME/oui/bin/runInstaller -deinstall -silent "REMOVE_HOMES={/u01/app/oracle/product/agent12g/sbin}" -invPtrLoc /etc/oraInst.loc

c) Deinstall the Management Agent.

$AGENT_HOME/oui/bin/runInstaller -deinstall -silent "REMOVE_HOMES={/u01/app/oracle/product/agent12g/core/12.1.0.5.0}" -invPtrLoc /etc/oraInst.loc
$cat inventory.xml
<?xml version="1.0" standalone="yes" ?>
<!-- Copyright (c) 1999, 2015, Oracle and/or its affiliates.
All rights reserved. -->
<!-- Do not modify the contents of this file by hand. -->
<INVENTORY>
<VERSION_INFO>
 <SAVED_WITH>11.1.0.13.0</SAVED_WITH>
 <MINIMUM_VER>2.1.0.6.0</MINIMUM_VER>
</VERSION_INFO>
<HOME_LIST>
<HOME NAME="OraGI12Home1" LOC="/u01/app/12.1.0.2/grid" TYPE="O" IDX="1" CRS="true">
 <NODE_LIST>
 <NODE NAME="racnode1"/>
 <NODE NAME="racnode2"/>
 </NODE_LIST>
</HOME>
<HOME NAME="OraDb11g_home1" LOC="/u01/app/oracle/product/11.2.0/dbhome_1" TYPE="O" IDX="2">
 <NODE_LIST>
 <NODE NAME="racnode1"/>
 <NODE NAME="racnode2"/>
 </NODE_LIST>
</HOME>
</HOME_LIST>
<COMPOSITEHOME_LIST>
</COMPOSITEHOME_LIST>
</INVENTORY>

d) Delete the binaries.

$cd /u01/app/oracle/product/agent12g
$ pwd
/u01/app/oracle/product/agent12g
$ rm -fr *

De-install the agent from server with GUI interface

a) start runInstaller from AGENT_HOME :

 $ /u01/app/oracle/product/agent12g/core/12.1.0.5.0/oui/bin/runInstaller -deinstall ORACLE_HOME=/u01/app/oracle/product/agent12g/core/12.1.0.5.0 -removeallfiles

b) Choose one of six plug-in HOMEs and remove them one by one.

<HOME NAME="OraHome1" LOC="/u01/app/oracle/product/agent12g/plugins/oracle.sysman.xa.discovery.plugin_12.1.0.6.0" TYPE="O" IDX="4">
 <DEPHOMELIST>
 <DEPHOME LOC="/u01/app/oracle/product/agent12g/core/12.1.0.5.0"/>
 </DEPHOMELIST>
</HOME>
<HOME NAME="OraHome2" LOC="/u01/app/oracle/product/agent12g/plugins/oracle.sysman.db.discovery.plugin_12.1.0.8.0" TYPE="O" IDX="5">
 <DEPHOMELIST>
 <DEPHOME LOC="/u01/app/oracle/product/agent12g/core/12.1.0.5.0"/>
 </DEPHOMELIST>
</HOME>
<HOME NAME="OraHome3" LOC="/u01/app/oracle/product/agent12g/plugins/oracle.sysman.emas.discovery.plugin_12.1.0.8.0" TYPE="O" IDX="6">
 <DEPHOMELIST>
 <DEPHOME LOC="/u01/app/oracle/product/agent12g/core/12.1.0.5.0"/>
 </DEPHOMELIST>
</HOME>
<HOME NAME="OraHome4" LOC="/u01/app/oracle/product/agent12g/plugins/oracle.sysman.oh.discovery.plugin_12.1.0.5.0" TYPE="O" IDX="7">
 <DEPHOMELIST>
 <DEPHOME LOC="/u01/app/oracle/product/agent12g/core/12.1.0.5.0"/>
 </DEPHOMELIST>
</HOME>
<HOME NAME="OraHome5" LOC="/u01/app/oracle/product/agent12g/plugins/oracle.sysman.oh.agent.plugin_12.1.0.5.0" TYPE="O" IDX="8">
 <DEPHOMELIST>
 <DEPHOME LOC="/u01/app/oracle/product/agent12g/core/12.1.0.5.0"/>
 </DEPHOMELIST>
</HOME>
<HOME NAME="OraHome6" LOC="/u01/app/oracle/product/agent12g/plugins/oracle.sysman.db.agent.plugin_12.1.0.8.0" TYPE="O" IDX="10">
 <DEPHOMELIST>
 <DEPHOME LOC="/u01/app/oracle/product/agent12g/core/12.1.0.5.0"/>
 </DEPHOMELIST>
</HOME>
uninstall_8

c) Choose sbin HOME, and remove this HOME.

<HOME NAME=”sbin12c1” LOC=”/u01/app/oracle/product/agent12g/sbin” TYPE=”O” IDX=”3″ >

uninstall_7

d) The last is to choose agent12c HOME and remove it accordingly.

uninstall_10

If plug-ins or sbin HOME has not been removed before removing agent12c HOME, the below WARNING will be received.

uninstall_9

e) Remove the contents left under <AGENT_HOME> folder, like :

$ rm -fr /u01/app/oracle/product/agent12g

f) Check oraInventory to confirm the agent has been de-installed successfully.

uninstall_11
$ cat inventory.xml

....
....
...
<HOME NAME="sbin12c1" LOC="/u01/app/oracle/product/agent12g/sbin" TYPE="O" IDX="3" REMOVED="T"/>
<HOME NAME="OraHome1" LOC="/u01/app/oracle/product/agent12g/plugins/oracle.sysman.xa.discovery.plugin_12.1.0.6.0" TYPE="O" IDX="4" REMOVED="T"/>
<HOME NAME="OraHome2" LOC="/u01/app/oracle/product/agent12g/plugins/oracle.sysman.db.discovery.plugin_12.1.0.8.0" TYPE="O" IDX="5" REMOVED="T"/>
<HOME NAME="OraHome3" LOC="/u01/app/oracle/product/agent12g/plugins/oracle.sysman.emas.discovery.plugin_12.1.0.8.0" TYPE="O" IDX="6" REMOVED="T"/>
<HOME NAME="OraHome4" LOC="/u01/app/oracle/product/agent12g/plugins/oracle.sysman.oh.discovery.plugin_12.1.0.5.0" TYPE="O" IDX="7" REMOVED="T"/>
<HOME NAME="OraHome5" LOC="/u01/app/oracle/product/agent12g/plugins/oracle.sysman.oh.agent.plugin_12.1.0.5.0" TYPE="O" IDX="8" REMOVED="T"/>
<HOME NAME="OraHome6" LOC="/u01/app/oracle/product/agent12g/plugins/oracle.sysman.db.agent.plugin_12.1.0.8.0" TYPE="O" IDX="10" REMOVED="T"/>
<HOME NAME="agent12c1" LOC="/u01/app/oracle/product/agent12g/core/12.1.0.5.0" TYPE="O" IDX="2" REMOVED="T"/>
...
...
...

Deinstall the agent in Silent Mode Using AgentDeinstall.pl Script

$AGENT_HOME/perl/bin/perl <AGENT_HOME>/sysman/install/AgentDeinstall.pl -agentHome  $AGENT_HOME

-- Remove binaries

$cd /u01/app/oracle/product/agent12g
$ rm -fr *

Delete OEM agent auto-start scripts

#cd  /etc/rc.d/  
#rm gcstartup unlockgcstartup lockgcstartup

One thought on “How to Deinstall OEM Agent from Oracle Enterprise Manager 12C”

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.