EMCLI is an alternative for the web interface. It enables you to access OEM functionality from a text-based console.
Examples of EM CLI tasks you can accomplish are as follows:
- Create a new Enterprise Manager administrator account.
- Monitor and manage targets, jobs, groups, and blackouts
How to Download EMCLI
From the Cloud Control console, navigate to the “Enterprise Manager Command Line Tools Download” page using the “Setup > Command Line Interface” menu option. Click on the “Download the EMCLI with Scripting option kit to your workstation.” link under the “EMCLI with Scripting option” section. Once you have the JAR file you can install EMCLI. Remember, this is a client tool, so the location you install it is independent of the location of the management server. You may have a management server running on Linux, but choose to install the EMCLI on your desktop PC running Windows.
Linux Installation
mkdir /home/oracle/emcli export JAVA_HOME=/usr/java/jdk1.7.0_25 export PATH=$JAVA_HOME/bin:$PATH java -jar /download/location/emcliadvancedkit.jar client -install_dir=/home/oracle/emcli cd /home/oracle/emcli export EMCLI_STATE_DIR=/home/oracle/emcli emcli setup -url=https://dbadeeds.com:7803/em -username=sysman -trustall -autologin -dir=/home/oracle/emcli emcli sync Adjust the JAVA_HOME and the install location of EMCLI as required. The "-autologin" flag means that once you've logged in for the first time you will not have to log in again. If you think this is too risky, you can omit it and log in each time you use the tool. The "-url" parameter should be set to the fully qualified URL of your management server.
EMCLI Scripting
How to Login()
set your ENV to EMCLI directory location
emcli login -username=sysman -password=XXXXXX Login successful
Synchronize emcli with the OMS
$ emcli sync Synchronized successfully
How to Logout EM
$ emcli logout Logout successful
perl script to login
#!/bin/perl
#
#Title:login.pl
#Author: Sandeep R Narani
#Date:2/6/2016
use strict;
my $emcli_home_bin="<provide a path to emcli or OMS_HOME";
my $time_now = localtime();
my $login_type = $ARGV[0];
my $sysman_pwd = $ARGV[1];
my $num_args = $#ARGV+1;
my $result = 0;
if ($num_args != 2){
print "\nUsage: perl login.pl \n";
print " : Enter login type to remove\n";
print " : Provide the SYSMAN password\n\n";
}
if ($num_args == 1){
print "\nStart Time: ".$time_now."\n";
emcli_login();
else
emcli_logout();
}
##########################
#Sub-Programs
##########################
sub emcli_login{
print "\n";
system($emcli_home_bin.'/emcli login -username=sysman -password='.$sysman_pwd);
system($emcli_home_bin.'/emcli sync');
print "\n";
}
sub emcli_logout{
print "\n";
system($emcli_home_bin.'/emcli logout');
print "\n";
}
How to execute
login.pl login sysmanpwd
List available agents in the library
emcli get_supported_platforms Getting list of platforms ... Check the logs at /home/oracle/agent.log About to access self-update code path to retrieve the platforms list.. Getting Platforms list ... ----------------------------------------------- Version = 12.1.0.1.0 Platform = Linux x86-64 ----------------------------------------------- Version = 12.1.0.1.0 Platform = IBM AIX on POWER Systems (64-bit) ----------------------------------------------- Version = 12.1.0.1.0 Platform = Microsoft Windows (32-bit) ----------------------------------------------- Version = 12.1.0.1.0 Platform = Microsoft Windows (64-bit) ----------------------------------------------- Platforms list displayed successfully
Download an agent from the library (used for agentDeploy.sh script method)
$ emcli get_agentimage -destination=/home/oracle -platform="Linux x86-64" -version="12.1.0.1.0" Platform:Microsoft Windows x64 (64-bit) Destination:/home/oracle === Partition Detail === Space free : 11 GB Space required : 1 GB Check the logs at /home/oracle/get_agentimage_2012-06-11_15-18-09-PM.log Setting property ORACLE_HOME to:/u01/app/oracle/Middleware/oms calling pulloneoffs with arguments:/u01/app/oracle/Middleware/softLibrary/8E0439D33010AE58512.1.0.1.0Linux x86-64 Check this logs for more information: /uu01/app/oracle/Middleware/oms/sysman/prov/agentpush/logs
Leave a reply to OEM Agents & EM CLi Silent Installation | DBADEEDS Cancel reply