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

Home » Articles » Misc » Here

EMCLI : Manage WebLogic Domains 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 WebLogic domains 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 Domain

The discover_wls verb is used to discover WebLogic domains and their sub-components. The resulting target will have a name in the following format depending on the WebLogic version, but it may vary a little depending on the setup.

In its simplest form the discover_wls verb requires an input CSV file containing information used during the discovery process. This can be used to discover multiple domains, or just a single domain, as shown here. The example probably seems overly verbose, but reading a CSV can be difficult.

WLS_VERSION="12"
ADMIN_HOST="my-server.localdomain"
ADMIN_PORT="7001"
ADMIN_USERNAME="weblogic"
ADMIN_PASWORD="Welcome1"
FARM_NAME="MY_DEV_FARM"
AGENT_PORT="3872"
AGENT_URL="https://${ADMIN_HOST}:${AGENT_PORT}/emd/main/"
FILE_PATH="/tmp/"

cat > ${FILE_PATH}wls_discovery.csv <<EOF
${WLS_VERSION},${ADMIN_HOST},${ADMIN_PORT},${ADMIN_USERNAME},${ADMIN_PASWORD},,,,${FARM_NAME},${AGENT_URL}
EOF

emcli discover_wls -input_file=domain_discovery_file:${FILE_PATH}wls_discovery.csv

Remove Domain

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

TARGET_NAME="/MY_DEV_FARM_my_domain/my_domain"

emcli delete_target \
  -name="${TARGET_NAME}" \
  -type="weblogic_domain"

emcli get_targets -targets="${TARGET_NAME}:weblogic_domain"

Help

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

emcli help discover_wls
emcli help delete_target
emcli help get_targets

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

emcli help

For more information see:

Hope this helps. Regards Tim...

Back to the Top.