TwitterGoogleLinkedInEmailRSS

Installing EMCLI in EM12c

EMCLI is a Java based Command Line Interface that can be used to communicate with your OMS (Oracle Management Server) as an alternative to the GUI for some operations.

Installation is pretty straight forward, and the toolkit can be installed anywhere as long as you have a Java JDK installed (1.6 or higher at the time of writing this) and access to the OMS host.

First off, download the emclikit.jar from your OMS installation:

http(s)://[host]:[port]/em/console/emcli/download

…or SCP the file from your OMS host over to where you want to install EMCLI:

scp /u01/app/oracle/middleware/oms12c/oms/sysman/jlib/emclikit.jar oracle@[host]:/tmp

Then copy the emclikit.jar file to $AGENT_HOME/sysman/jlib, and setup your environment:

export AGENT_BASE=/u01/app/oracle/product/agent12c
export AGENT_HOME=$AGENT_BASE/core/12.1.0.2.0
export JAVA_HOME=$AGENT_HOME/jdk
export PATH=$JAVA_HOME/bin:$PATH

mkdir $AGENT_BASE/emcli
cp /tmp/emclikit.jar $AGENT_HOME/sysman/jlib

Install the EMCLI toolkit:

java -jar $AGENT_HOME/sysman/jlib/emclikit.jar client -install_dir=$AGENT_BASE/emcli

Setup EMCLI using an appropriate user (it doesn’t have to be SYSMAN) :

$AGENT_BASE/emcli/emcli setup -url=https://[host]:[port]/em -username=sysman -trustall -autologin

The last two flags used in the setup command above are optional.  The ‘trustall’ flag automatically accepts prompts for trusting the certificate chain, otherwise the setup will just prompt you.  The ‘autologin’ flag allows EMCLI to re-establish a connection to your OMS without prompting you for a password.  I prefer this option, but some would say it’s insecure…I guess it depends on your environment really.

Once you see “Emcli setup successful”, you’re all done!

Running the following command will confirm the setup configuration and status:

$AGENT_BASE/emcli/emcli status
Oracle Enterprise Manager Cloud Control 12c Release 2.
Copyright (c) 1996, 2012 Oracle Corporation and/or its affiliates. All rights reserved.

Instance Home          : /home/oracle/.emcli
Verb Jars Home         : /home/oracle/.emcli
Status                 : Configured
EMCLI Home             : /u01/app/oracle/product/agent12c/emcli/.
EMCLI Version          : 12.1.0.2.0
Java Home              : /u01/app/oracle/product/agent12c/core/12.1.0.2.0/jdk/jre
Java Version           : 1.6.0.12
Log file               : /home/oracle/.emcli/.emcli.log
EM URL                 : https://[host]:[port]/em
EM user                : sysman
Auto login             : true
Trust all certificates : true

NOTE: It’s important that you use the Fully Qualified Domain Name (FQDN) of your OMS host here, otherwise you could hit issues such as the “Session expired. Run emcli login to establish a session.” bug mentioned in MOS 10625373.

If you didn’t chose the autologin option earlier on, simply run the following to establish a connection:

$AGENT_BASE/emcli/emcli login -username=sysman -password=******
Login successful

…and to logout…

$AGENT_BASE/emcli/emcli logout 
Logout successful

This command is useful for checking the status of a specific target or targets (target type is based on EM12c internal name):

$AGENT_BASE/emcli/emcli get_targets -targets="EMREP:oracle_database;LISTENER_EMREP:oracle_listener"

Status  Status           Target Type           Target Name
 ID
1       Up               oracle_database       EMREP
1       Up               oracle_listener       LISTENER_EMREP

Leave a comment

Your email address will not be published. Required fields are marked *

*

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>