How to Uninstall the Agent Oracle Home that Registered with Inventory

A long title for a short trick. I have uninstalled my cloud control agent and tried to re-install it. I gave the same directory I previously used to install and EM Cloud Control Agent Deploy Wizard gave an error at remote prerequisite check:

So it says I should deploy to a different directory or uninstall the Agent Oracle Home already registered. Because of our deployment standards, I need to deploy this agent to the same directory so I searched how I can uninstall the Agent Oracle Home.

Agent Homes are stored in /etc/oragchomelist (Linux) and /var/opt/oracle/oragchomelist (Solaris). I removed the entry from oragchomelist and retry to deploy and I got the same error! Then I checked the Oracle Inventory file – its location can be found at /var/opt/oracle/oraInst.loc (Solaris), the inventory file (ContentsXML/inventory.xml) has some entries for the Agent Homes:

Because I have already a working Oracle Database at this server, I didn’t delete the oraInventory files, and I issued the following command to detach the Agent Home:

That’s it. I re-run the deployment agent and it completed without any error.

Please share

AWS Big Data Specialist. Oracle Certified Professional (OCP) for EBS R12, Oracle 10g and 11g. Co-author of "Expert Oracle Enterprise Manager 12c" book published by Apress. Awarded as Oracle ACE (in 2011) and Oracle ACE Director (in 2016) for the continuous contributions to the Oracle users community. Founding member, and vice president of Turkish Oracle User Group (TROUG). Presented at various international conferences including Oracle Open World.


  1. Hey Gokhan,

    I have the exact same problem, but a little bit different.

    I want to deploy a new agent in the same folder where there was a deployment failure. in the agent12c folder there is a folder starting with ADATMP…, which is a sign that there was a failure.

    So I tried to redeploy the agent in the same folder, but I got your error.

    The problem I have is that when I execute the command to detach the home from the inventory I get an error ‘detachhome’ failed.
    Here is the output of the script:

    $ORACLE_HOME/oui/bin/runInstaller -silent -detachHome ORACLE_HOME="/opt/oracle/agent12c/core/"
    Starting Oracle Universal Installer...

    Checking swap space: must be greater than 500 MB. Actual 1027 MB Passed
    The inventory pointer is located at /etc/oraInst.loc
    The inventory is located at /opt/oracle/Middleware/oraInventory
    'DetachHome' failed.

    When I check the logs I have this:

    INFO: Setting variable 'CLUSTER_NODES' to ''. Received the value from a code block.
    INFO: This home /opt/oracle/agent12c/core/ cannot be detached or deinstalled as it contains references to other homes
    INFO: Done calling doOperation.
    INFO: Ending the inventory Session
    INFO: Disposing the install area control objects
    INFO: 'DetachHome' failed.

    Any ideas?

    Thanks in advance,

    • Gokhan Atil

      Bram, have you checked the inventory file (inventory.xml)? Do you see any references to your agent home (maybe some updates etc)?

    • I’m sorry for the spam. For some reason, the copy paste doesn’t work properly.

      I have the same entries in the inventory.xml file as you have.

  2. Madhu

    I had the same issue when trying to uninstall and redeploy the agent.

    I figured out that there is a backup copy of inventory.xml in /etc/oraInventory/backup folder.

    Grabbed the one which did not have any oem related entries and was able to deploy the agent successfully.

    Thanks for this post. Otherwise, I would not be able to resolve the issue with the agent re-install.

  3. Radhika


    How do you deinstall the agent12c if you install the agent thru agent deployment wizard 12c ?

    In this case I don’t see $AGENT_HOME/oui/bin/runinstaller -deinstall on target side ?

    • Gokhan Atil

      Radhika, you can deinstall the agent using using Enterprise Manager console. Select the host in targets/hosts list, try to remove it. It will ask you to remove related targets first and it will show you the defined targets in the target server. Remove all of them and then you can remove the target (so your agent will be deinstalled).

  4. Bakul

    unfortunately i have deleted agent with “rm -rf” and now i am getting error when installing agent with EM console saying “old agent” is already registred this AGENT_HOME that i am trying to install agent..i did remove entry from /etc/oragchomelist . not able to to run “detachhome” option as i have removed entire agent software from server.


    Please let me know how can i fix this..

  5. Ghe

    Thank you, your article was helpfull. After a OMS crash I have to restore a snapshot of my VM. So Agent were already installed on my oracle node…

    In my case running this command doesn’t work:

    $ORACLE_HOME/oui/bin/runInstaller -silent -detachHome ORACLE_HOME=”/u01/agent12c/core/″

    Because the oracle node already have plugins on it. So I use this command to remove dependencies and then uninstalling oms agent :

    $ORACLE_HOME/oui/bin/runInstaller -deinstall

    After that I have check that inventory  file was succesfully update:

    vi /u01/app/oraInventory/ContentsXML/inventory.xml

    Was good for me, I succesfully reinstall oms agent without that error after that.

  6. shanmugam

    I have completed the Oracle Enterprise Manager Cloud control 12C installation and deployment, now am looking for next step with best practice document.

    can you refrence any document for

    Oracle Enterprise Manager Cloud control 12C

    for mointoring/configuration the targets databases/asm/instance/hosts/application servers

    Please let me know.



  7. edwzhang

    Just remove the 12c content from file “oraInventory/ContentsXML/inventory.xml”, then click “Retry” in the GUI, OK.

    • Gokhan Atil

      Although it may work, it’s not the “supported” way to fix the problem. As you can see at the first lines of the file, you shouldn’t modify the contents of the file by hand.

  8. Gerald

    Hi guys,

    I’ve just fall in this trap this morning 🙂

    Thanks to your different experiences , I’ve fixed my orainventory’s issue.

    I would say depending servers, sometime you do not have to play with orainventory and sometime you got to. I’m removing agent with the emcli command line directly on the oms’ server. Normaly It’s enough to allow a direct install from the cloud (modulo , the rm -rf <agent_dir> on target server).

    As I do not have anymore the agent OUI’s runinstaller (rm -rf), I’ve used the one from my databases oracle binaries installed on the target server.

    And regarding your experience, I’ve remembered that when you want to desinstall an agent with OUI, you first have to remove, the pluggings, then the sbin , then <Agent_home>.

    something like that :

    ksh -silent -detachHome ORACLE_HOME=”…/oracle.sysman.emas.discovery.plugin_12.″
    ksh -silent -detachHome ORACLE_HOME=”…/oracle.sysman.oh.discovery.plugin_12.″
    ksh -silent -detachHome ORACLE_HOME=”…/oracle.sysman.db.agent.plugin_12.″
    ksh -silent -detachHome ORACLE_HOME=”…/oracle.sysman.db.discovery.plugin_12.″
    ksh -silent -detachHome ORACLE_HOME=”…/oracle.sysman.oh.agent.plugin_12.″
    ksh -silent -detachHome ORACLE_HOME=”…/″
    ksh -silent -detachHome ORACLE_HOME=”/appl/oracle/Middleware/agent12c/sbin”
    ksh -silent -detachHome ORACLE_HOME=”/appl/oracle/Middleware/agent12c/core/″

    at this time you will have this success prompt

    The inventory pointer is located at /etc/oraInst.loc
    The inventory is located at /appl/oracle/oraInventory
    ‘DetachHome’ was successful.

    Before running on the cloud for a reinstall, you first have to re do an rm -rf  /appl/oracle/Middleware/agent12c

    an then , it’s ok.

    In my case, nothing about orainventory’s file, but just a deletion ORDER to respect .

    Anyway thanks for this great help , hope this brick will help other on the some issue’s variation.

  9. Venky

    Thanks Gokhan,

    You have many useful posts related to the 12c which is very helpful.

  10. Manikanta


    Patch Apply on Agent 12c is failing

    OUI-67073:OPatch failed: PatchObject constructor: Input file “/home/oracle/Agent_Patch_OEM12c/etc/config/actions” or “/home/oracle/Agent_Patch_OEM12c/etc/config/inventory” does not exist.

    This is what I see in my inventory

    <HOME NAME=”agent12c0″ LOC=”/u01/orasys/core/″ TYPE=”O” IDX=”3″>

    Looks like there is a typo in the Home Name

    Im trying to detach it and attach it again

    Im seeing error

    ./runInstaller -detachHome ORACLE_HOME=/u01/orasys/core/ ORACLE_HOME_NAME=agent12c

    Starting Oracle Universal Installer…

    Checking swap space: must be greater than 500 MB.   Actual 73603 MB    Passed

    The inventory pointer is located at /etc/oraInst.loc

    The inventory is located at /u01/oraInventory

    can you help ?

  11. do deinstall Agent follow steps are needed!!

    for example

    cd /u00/app/oracle/product/agent12/core/
    ./runInstaller -silent -deinstall -removeallfiles \

    ./runInstaller -silent -deinstall -removeallfiles “REMOVE_HOMES={/u00/app/oracle/product/agent12/sbin}”
    ./runInstaller -silent -deinstall -removeallfiles “REMOVE_HOMES={/u00/app/oracle/product/agent12/core/}”

    now Agent is unregistered in Inventory!!

    cat ~/oraInventory/ContentsXML/inventory.xml
    <?xml version=”1.0″ standalone=”yes” ?>
    <!– Copyright (c) 1999, 2013, Oracle and/or its affiliates.
    All rights reserved. –>
    <!– Do not modify the contents of this file by hand. –>
    <HOME NAME=”Oracle12102″ LOC=”/u00/app/oracle/product/″ TYPE=”O” IDX=”1″/>


  12. hma

    unfortunately i also deleted agent with “rm -rf” and now i am getting error when installing agent with EM console saying “old agent” is already registred this AGENT_HOME that i am trying to install agent..i did remove entry from /etc/oragchomelist  and even i replace the inventory.xml which does not have any OEM12c entries. still getting the same error. Please suggest. …Thanks

  13. Shameem

    Hi..  from where to run ./runInstaller in order to remove entries in orainventory?

    Must we cd to /u01/app/oracle/product/agent12/core/  ?

    I’am asking because there are many homes like  “Oracle_BI11” ,  “oms12c1” , “oracle_sysman_xa11” etc ..  All these home have different paths..

    There’s no “runInstaller” under all respective paths…

    Secondly,  what if i run runInstaller from grid_home/oui  or /rdbms/oui ?

    If above will work , then this also should work .. Isn’t it ?

    I’m new.. Give me some idea?

    … thanks

Leave Comment

Your email address will not be published.

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