Search This Blog

Tuesday, October 10, 2017

ORACLE - Deleting a host target in OEM 13 - command line (emcli)

Deleteing host target in OEM (Oracle Entyerprise Manager) 13 thorugh the GUI can be a bit tricky.

Making things worse; if there are database targets inside that host (which have to be removed as well) which are added to the OEM, deleting all these targets and the host through the GUI involves a number of repetitive steps through the GUI. Doing this thorough the command line (emcli) is the best option in such a case.

Below steps lists how to remove a host (and the databases in that host) from OEM (OEM13 specifically) uisng command line. Please note these steps are for an OEM running on Linux. For an OEM running on Windows the steps should not be that different although OS specific commands would vary.

You have to remove the agent service from the host (and clean up the installed folders/files) seperately after (or before) these steps.

1. Login to the OEM host as oracle (or as the user who has necessary access)

2. login to the emcli tool as sysman. Provide the password for the sysman user in the repository database.
$ emcli login -username=sysman

3. Check if the target host we wish to remove is regsitered in the OEM. Here <hostname> is case sensitive (in Linux, at least)
Also we can see the exact "<host>.<domain>:<port_number>" we should use in the next step.
$ emcli get_targets -targets="oracle_emd" | grep <hostname>

4. Issue the command to delete the host from OEM together with the databases inside.
$ emcli delete_target -name="<host>.<domain>:<port_number>" -type="oracle_emd" -delete_monitored_targets