8i | 9i | 10g | 11g | 12c | 13c | 18c | 19c | Misc | PL/SQL | SQL | RAC | WebLogic | Linux

Home » Articles » Misc » Here

EMCLI : Manage Agents using Enterprise Manager Command Line Interface (Cloud Control)

The Enterprise Manager Command Line Interface (EMCLI) allows you to script your Cloud Control setup, rather than using the Cloud Control console. This article describes how to manage agents in Cloud Control using EMCLI, rather than using the web interface.

For more information see:


You can perform these actions from anywhere with an EMCLI client, but for this example we're going to use the EMCLI client on the Cloud Control server. We use the following commands to connect to the OMS and sync the EMCLI client.

export OMS_HOME=/u01/app/oracle/middleware
export AGENT_HOME=/u01/app/oracle/agent/agent_inst
alias emcli='${OMS_HOME}/bin/emcli'

emcli login -username=sysman
emcli sync

Add Agent

Make sure the AGENT_BASE_DIR directory is present on the AGENT_HOST server before attempting to push an agent to it. Use the submit_add_host verb to push the agent to the server to be monitored.


emcli submit_add_host \
  -host_names="${AGENT_HOST}" \
  -platform="${AGENT_PLATFORM}" \
  -installation_base_directory="${AGENT_BASE_DIR}" \
  -credential_name="${AGENT_HOST_CREDENTIAL}" \
  -port="${AGENT_PORT}" \

Run the "root.sh" file on the monitored server. For example.


You need to know "Platform ID" of the destination server. The available IDs can be listed using the list_add_host_platforms verb.

emcli list_add_host_platforms -all
Platform ID  Platform Name
226          Linux x86-64
197          HP-UX Itanium

After adding the agent, you should set the preferred credentials, as described here.

Remove Agent

You can only remove an agent if it is stopped, so you may want to issue a stop command before attempting to remove the agent. The following example uses the stop_agent and delete_target verbs to achieve this.


emcli stop_agent \
  -agent_name="${AGENT_HOST}:${AGENT_PORT}" \
emcli delete_target \
  -name="${AGENT_HOST}:${AGENT_PORT}" \
  -type="oracle_emd" \
  -delete_monitored_targets \

Remember to delete the contents of the AGENT_BASE_DIR on the host.


The usage of the commands referenced in this article can displayed using the following commands.

emcli help list_add_host_platforms
emcli help submit_add_host
emcli help stop_agent
emcli help delete_target

You can also check out all the other agent verbs in the Help Command Output.

emcli help

For more information see:

Hope this helps. Regards Tim...

Back to the Top.