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

Home » Articles » Misc » Here

EMCLI : Manage Listeners 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 listeners in Cloud Control using EMCLI, rather than using the web interface.

For more information see:

Setup

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.

unset SSH_ASKPASS
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 Listener

The add_target verb is used to add all targets, including listeners. The get_targets verb is used to show the target has been added.

LISTENER_HOST="NC_HOST_MY_HOST"
LISTENER_ORACLE_HOME="/u01/app/oracle/product/19.0.0/dbhome_1"
LISTENER_PORT="1521"
LISTENER_NAME="LISTENER"

emcli add_target \
  -name="${LISTENER_NAME}_${LISTENER_HOST}" \
  -type="oracle_listener" \
  -host="${LISTENER_HOST}" \
  -properties="LsnrName:${LISTENER_NAME};ListenerOraDir:${LISTENER_ORACLE_HOME}/network/admin;Port:${LISTENER_PORT};OracleHome:${LISTENER_ORACLE_HOME};Machine:${LISTENER_HOST}"

emcli get_targets -targets="${LISTENER_NAME}_${LISTENER_HOST}:oracle_listener"

Remove Listener

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

LISTENER_HOST="NC_HOST_MY_HOST"
LISTENER_NAME="LISTENER

emcli delete_target \
  -name="${LISTENER_NAME}_${LISTENER_HOST}" \
  -type="oracle_listener"

emcli get_targets -targets="${LISTENER_NAME}_${LISTENER_HOST}:oracle_listener"

Help

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 listener verbs in the Help Command Output.

emcli help

For more information see:

Hope this helps. Regards Tim...

Back to the Top.