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

Home » Articles » Misc » Here

EMCLI : Manage Databases 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 databases 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 Database

The add_target verb is used to add all targets, including databases. The command below includes the monitoring credentials. The get_targets verb is used to show the target has been added.


emcli add_target \
  -name="${DB_NAME}" \
  -type="oracle_database" \
  -host="${DB_HOST}" \
  -credentials="UserName:${DB_USERNAME};password:\"${DB_PASSWORD}\";Role:${DB_ROLE}" \

emcli get_targets -targets="${DB_NAME}:oracle_database"

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

Remove Database

The delete_target verb is used to remove all targets, including databases. The get_targets verb is used to show the target has been removed.


emcli delete_target \
  -name="${DB_NAME}" \

emcli get_targets -targets="${DB_NAME}:oracle_database"


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

emcli help add_target
emcli help delete_target
emcli help get_targets

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

emcli help

For more information see:

Hope this helps. Regards Tim...

Back to the Top.