SlideShare a Scribd company logo
1 of 40
Download to read offline
ORACLE ENTERPRISE MANAGER 12C
EM CLI CRASH COURSE
GÖKHAN ATIL
ORACLE ACE, DBA
Gökhan Atıl
DBA Team Leader

Oracle ACE (since 2011)

Founding Member and Vice President

of TROUG (troug.org) 

Co-author of Expert Oracle Enterprise 

Manager from Apress

Blogger (since 2008) gokhanatil.com
2
Agenda
Introduction to EM CLI

EM CLI Verbs

Formatting the Output

Fetching Information From EM Repository 

Sample Bash Scripts

EM CLI Interactive Mode and Scripting Mode

Fundamentals of Python

Sample Python Scripts
3
What is EM CLI?
Repository
EM CLI
Agent
OMS
Web Console
4
Why EM CLI?
Emotional Reasons:

We love text-based tools

Practical Reasons:

Sometimes it’s faster (less clicks)

Good for scripting
Web interface of
Enterprise Manager
is so cool!
5
Jump into the action!
It’s already installed and configured on
OMS server:

cd $OMSHOME/bin

./emcli (or emcli.bat on Windows servers)
6
How to Install and Configure EM CLI
Requires Java version 1.6.0_43 or greater

Supported Operating Systems: Windows, Linux,
Solaris, HPUX, Tru64, AIX 

Go to “command line interface” page under
“setup” page to download the installation JAR file.

Login is not required, so it’s possible to download
the JAR file with “wget”.
To run EM CLI on Java 1.8 or higher, you need apply patch 17555224 to
the weblogic server. Use"-no-check-certificate" parameter with wget.
7
How to Install and Configure EM CLI
After you download, set JAVA_HOME and install the JAR
file: 

java -jar emcliadvancedkit.jar -install_dir=<home>

java -jar emclikit.jar -install_dir=<home>

Configure EM CLI:

emcli help setup

emcli setup -url="https://host:port/em" 

-username=<emuser> -trustall
8
don’t forget check the syntax
Standard vs Scripting
There are two different installation kits for EM CLI:

EM CLI Standard Kit: This kit supports only the
Standard (command line) mode.

EM CLI with Scripting mode (option): This
“advanced kit” supports Interactive and Script
modes in addition to standard mode.
9
What are these
modes?
3 modes of EM CLI:
Standard mode: This mode provides a simple
command-line and executes one verb at a time.

emcli get_targets

Interactive mode: This mode creates an interactive
session.

emcli

Scripting mode: In Scripting mode, EM CLI runs
Jython scripts.

emcli @scriptname.py
10
Forget Jython
for now, and
you’ll be OKAY
Understanding EM CLI Syntax
In standard mode, EM CLI expect you enter a verb as
the first parameter. Verbs may take zero or more
arguments as input. Arguments are preceded by a dash.
It’s recommended to write values enclosed in quotation
marks.

emcli verb -1st_argument 

[ -2nd_ argument="value" ]

[ -3rd_ argument="value" ] 

[ -4th_ argument ]

…
11
A less known feature
emcli setup -

Syntax Error: Ambiguous argument - matches the
beginning of each of these argument names: 

-_newline_, -additionalpostparams, -autologin, 

-certans, -custom_attrib_file, -dir, -licans, 

-localdirans, -noautologin, -nocertvalidate, 

-noregister, -novalidate, -offline, -password, -trustall, 

-url, -username, -verb_jars_dir

emcli setup -ur="https://host:port/em" -us=<emuser> -t
12
error message shows all possible
arguments
Basic Operational Verbs
help: Get help for emcli verbs, usage: emcli help [verb]

setup: Configure emcli

status: List configuration details

sync: Synchronize with the OMS (after updates)

version: List emcli verb/client version

login: Login to the OMS

logout: Logout from the OMS

argfile: Execute emcli verbs from a file
13
You need to
login first!
400+ Verbs in 76 Categories
Add Host Verbs

Agent Administration Verbs

Agent Upgrade Verbs

BI Publisher Reports Verbs

Blackout Verbs

Credential Verbs

Incident Rules Verbs

Job Verbs

Metric Extension Verbs

Monitoring Templates Verbs

Oracle Cloud Verbs

Provisioning Verbs

Self Update Verbs

User Administration Verbs
14
Find the exact name of a target
Target names, target types and even “verbs” are case
sensitive, so be sure that you use the exact name and
target type: 

emcli get_targets

emcli get_targets -targets="targetname:%"

emcli get_targets -targets="targettype"

emcli get_targets -targets="targetname:targettype"
15
“Grep” is your friend!
Some verbs provide own filtering mechanism, 

but some of them don’t. Using grep will 

help you to filter the output of emcli.

emcli help | grep -i blackout



emcli get_target_types | grep -i database
16
Format and redirect the output
emcli get_targets -format="name:pretty" 

emcli get_targets -format="name:csv" 

emcli get_targets -format="name:script"

emcli get_targets -script

emcli get_targets -script > list_of_targets.txt

emcli get_targets -script l parsing_tool
17
Output can
be parsed
easily by
Unix tools
Gateway to the EM repository
There are more than 70 verbs to help you query information
from OMS, but you may still need a more powerful verb.
EMCLI list verb can query the Enterprise Manager
repository database.

The following command will list all resources that you can
query using “list” verb:

emcli list -help 

The following command will list the roles defined in EM:

emcli list -resource="Roles"
18
Management Views
Gateway to the EM repository
This command shows the columns of the specified resource:

emcli list -resource="Roles" -help

You can filter the columns and rows:

emcli list -resource="Roles" -columns="ROLE_NAME,DESCRIPTION" 

-search="ROLE_NAME= 'EM_ALL_ADMINISTRATOR'"
19
Gateway to the EM repository
On EM 12.1.0.5, “List” verb can query 27 resources.
If you can not find the data you need among these
resources, you can even run SQL on repository
database:

emcli list -sql="<query>"
20
You may check

my blog :)
List the targets with critical alerts
Get_targets can also be used to monitor if any
critical alerts or warnings raised.

emcli get_targets -alerts



emcli get_targets -alerts -script -noheader | awk '{ if
($5>0) print $4":"$3"t"$5 }'
21
Critical
Alerts
Sample Script: Blackout/Maintenance
emcli login -username="GOKHAN" -password="s3cr3t"

emcli create_blackout -name="DEVDB Blackout" 

-add_targets="DEVDB:oracle_database" 

-reason="Maintenance work" 

-schedule=“duration:200”

…

…

emcli stop_blackout -name="DEVDB Blackout"

emcli delete_blackout -name="DEVDB Blackout"

emcli logout
22
Sample Script: Clear Stateless Alerts
login=$(emcli login -username="GOKHAN" 

-password="s3cr3t" | grep -c “successful")



if [ $login -eq 1 ]; then

for DBNAME in $(emcli get_targets 

-targets="oracle_database" -noheader -script | cut -f4);

do

emcli clear_stateless_alerts -older_than=0

-target_type="oracle_database"

-target_name="$DBNAME"

done

emcli logout

fi
23
Sample Script: Delete All Named
Credentials
login=$(emcli login -username="GOKHAN" 

-password="s3cr3t" | grep -c "successful")



if [ $login -eq 1 ]; then

for CN in $(emcli list_named_credentials -script

-noheader | cut -f1);

do

emcli delete_named_credential -cred_name="$CN"

done

emcli logout

fi
24
EM CLI with Scripting Mode
Run “emcli" without any parameters;

… and you find yourself in a Jython world!
25
Someone said Jython?
Jython is an implementation of the Python programming
language designed to run on the Java platform.
26
Python:
Widely used general-purpose, 

high-level programming language

Supports multiple programming
paradigms, including OOP, imperative
and functional programming

Dynamic type system and 

automatic memory management

Batteries Included (!)
27
You say Jython
is Python but
what is Python?
EM CLI & Python
Verbs are defined as Python functions and arguments are
entered as function parameters:

get_targets -target="oracle_database"

get_targets( target="oracle_database")

Results of verbs can be formatted as JSON

Includes some Python modules (os, gzip, xml, ftplib and
more…)

Python makes EM CLI scripting easy!
28
Fundamentals of Python
Variables (dynamic type, no need for declaration but
need initialisation):

myvar = "TESTDB"

myvar = myvar + ":oracle_database"

myvar = 10

myvar = myvar + 10 

myvar = 10 + "10"
TypeError:
unsupported
operand type(s) for 

+: 'int' and 'str'
29
Fundamentals of Python
Conversion between integer and string, conditional
jumps and code blocks:

myvar = int("2")

myvar = 2

myvar = "2"

if ( myvar >= 10 ):

print "myvar is " + str(myvar)

else:

print "lower than 10"
Code blocks are identified
by “indentation”
30
Fundamentals of Python
Dictionary objects, list objects and iterations:

mydict = { 'Name':'Gokhan', 'Age':40 }

mydict['Name'] = "Gokhan"

mylist = [“Joe","William","Jack","Averell"]

mylist[0] = "Joe" 

for i in mylist:

print i
Looks
like JSON
It will print all elements in “mylist”
31
EM CLI Response Object
emcli.response.Response is the response object
when you run a emcli verb in scripting or interactive
mode.

emcli.response.Response

error() error text

exit_code() error code (0=success)

isJson() is JSON? true/false

out() JSON or TEXT
32
EM CLI Response Object
In scripting mode, default output format is JSON. In
interactive mode, default output format is TEXT, to
make it JSON, run the following command:

set_client_property('EMCLI_OUTPUT_TYPE', 'JSON') 

It’s better to use JSON format because Python
dictionary object can perfectly handle JSON format.
So there’s no need for extra effort to parse the
output.
33
EM CLI Response Object
Let’s get the response from a verb:

mytargets = get_targets( target="oracle_database" )

type(mytargets.out())

<type 'dict'>

mytargets.out()

{'data': [{'Status': 'Up', 'Warning': '6', 'Status ID': '0',
'Target Type': 'oracle_database', 'Critical': '64', 'Target
Name': ‘TESTDB’},{…}]}
34
returns

emcli.response.Response
object
EM CLI Response Object
A response always contain a “data” item which is a
list object:

type(mytargets.out()['data'])

<type ‘list'>

mytargets.out()['data']

[{'Status': 'Up', 'Warning': '6', 'Status ID': '0',
'Target Type': 'oracle_database', 'Critical': '64',
'Target Name': ‘TESTDB’},{…}]
35
EM CLI Response Object
We can iterate over all items of the list object (so we
can process all rows):

for DB in mytargets.out()['data']:

print DB['Target Name'], DB['Status']
36
Sample Script: Clear Stateless Alerts
Save the following code in a file (clearalerts.py) and
run it as “emcli @clearalerts.py”:

if login( username="GOKHAN" ).exit_code()==0:

mytargets=get_targets( targets="oracle_database" )

for DB in mytargets.out()['data']:

clear_stateless_alerts( 

target_name=DB['Target Name'], 

target_type=DB['Target Type'], older_than="0" )
37
Sample Script: Change DBSNMP
Passwords
if len(sys.argv) <> 2:

print "Usage: emcli @change_dbsnmp_passwords.py oldpwd newpwd"

exit()

if login( username="GOKHAN" ).exit_code()==0:

mytargets=get_targets( targets="%_database" )

for DB in mytargets.out()['data']:

try: 

update_db_password (target_name=DB['Target Name'],

target_type=DB['Target Type'] ,

change_at_target="yes",user_name="dbsnmp",

old_password=sys.argv[0],

new_password=sys.argv[1],

retype_new_password=sys.argv[1])

except emcli.exception.VerbExecutionError, e:

print e.error()
38
Sample Script: Promote Unmanaged
Databases
lg = login( username="SYSMAN" )

if lg.exit_code() <> 0:

print lg.error()

utargets=get_targets( "unmanaged", "properties",
targets="oracle_database" )

for target in utargets.out()['data']:

add_target( name=target['Target Name'], type=target['Target Type'],

host=target['Host Info'].split(';')[0].split(':')[1],

credentials="UserName:dbsnmp;password:xyz;Role:Normal",
properties=target[‘Properties'] )
positional parameters
39
Thank You for Attending!
40
I’m always open to your questions and comments:

gokhan at gokhanatil.com

gokhanatil 

www.gokhanatil.com

More Related Content

What's hot

LAD - GroundBreakers - Jul 2019 - Using Oracle Autonomous Health Framework to...
LAD - GroundBreakers - Jul 2019 - Using Oracle Autonomous Health Framework to...LAD - GroundBreakers - Jul 2019 - Using Oracle Autonomous Health Framework to...
LAD - GroundBreakers - Jul 2019 - Using Oracle Autonomous Health Framework to...Sandesh Rao
 
Oracle 12c and its pluggable databases
Oracle 12c and its pluggable databasesOracle 12c and its pluggable databases
Oracle 12c and its pluggable databasesGustavo Rene Antunez
 
The Top 5 Reasons to Deploy Your Applications on Oracle RAC
The Top 5 Reasons to Deploy Your Applications on Oracle RACThe Top 5 Reasons to Deploy Your Applications on Oracle RAC
The Top 5 Reasons to Deploy Your Applications on Oracle RACMarkus Michalewicz
 
Spark SQL Deep Dive @ Melbourne Spark Meetup
Spark SQL Deep Dive @ Melbourne Spark MeetupSpark SQL Deep Dive @ Melbourne Spark Meetup
Spark SQL Deep Dive @ Melbourne Spark MeetupDatabricks
 
12c (12.1) Database installation on Solaris 11(11.2)
12c (12.1) Database  installation on Solaris 11(11.2)12c (12.1) Database  installation on Solaris 11(11.2)
12c (12.1) Database installation on Solaris 11(11.2)K Kumar Guduru
 
Oracle backup and recovery
Oracle backup and recoveryOracle backup and recovery
Oracle backup and recoveryYogiji Creations
 
Backup and recovery in oracle
Backup and recovery in oracleBackup and recovery in oracle
Backup and recovery in oraclesadegh salehi
 
How to Use EXAchk Effectively to Manage Exadata Environments
How to Use EXAchk Effectively to Manage Exadata EnvironmentsHow to Use EXAchk Effectively to Manage Exadata Environments
How to Use EXAchk Effectively to Manage Exadata EnvironmentsSandesh Rao
 
Analysis of Database Issues using AHF and Machine Learning v2 - SOUG
Analysis of Database Issues using AHF and Machine Learning v2 -  SOUGAnalysis of Database Issues using AHF and Machine Learning v2 -  SOUG
Analysis of Database Issues using AHF and Machine Learning v2 - SOUGSandesh Rao
 
Deep review of LMS process
Deep review of LMS processDeep review of LMS process
Deep review of LMS processRiyaj Shamsudeen
 
Scaling paypal workloads with oracle rac ss
Scaling paypal workloads with oracle rac ssScaling paypal workloads with oracle rac ss
Scaling paypal workloads with oracle rac ssAnil Nair
 
Oracle RAC 19c: Best Practices and Secret Internals
Oracle RAC 19c: Best Practices and Secret InternalsOracle RAC 19c: Best Practices and Secret Internals
Oracle RAC 19c: Best Practices and Secret InternalsAnil Nair
 
Tanel Poder - Scripts and Tools short
Tanel Poder - Scripts and Tools shortTanel Poder - Scripts and Tools short
Tanel Poder - Scripts and Tools shortTanel Poder
 
Oracle Real Application Clusters 19c- Best Practices and Internals- EMEA Tour...
Oracle Real Application Clusters 19c- Best Practices and Internals- EMEA Tour...Oracle Real Application Clusters 19c- Best Practices and Internals- EMEA Tour...
Oracle Real Application Clusters 19c- Best Practices and Internals- EMEA Tour...Sandesh Rao
 
Why oracle data guard new features in oracle 18c, 19c
Why oracle data guard new features in oracle 18c, 19cWhy oracle data guard new features in oracle 18c, 19c
Why oracle data guard new features in oracle 18c, 19cSatishbabu Gunukula
 
Understanding oracle rac internals part 2 - slides
Understanding oracle rac internals   part 2 - slidesUnderstanding oracle rac internals   part 2 - slides
Understanding oracle rac internals part 2 - slidesMohamed Farouk
 
Rman Presentation
Rman PresentationRman Presentation
Rman PresentationRick van Ek
 
Tanel Poder - Performance stories from Exadata Migrations
Tanel Poder - Performance stories from Exadata MigrationsTanel Poder - Performance stories from Exadata Migrations
Tanel Poder - Performance stories from Exadata MigrationsTanel Poder
 
Using Apache Hive with High Performance
Using Apache Hive with High PerformanceUsing Apache Hive with High Performance
Using Apache Hive with High PerformanceInderaj (Raj) Bains
 

What's hot (20)

LAD - GroundBreakers - Jul 2019 - Using Oracle Autonomous Health Framework to...
LAD - GroundBreakers - Jul 2019 - Using Oracle Autonomous Health Framework to...LAD - GroundBreakers - Jul 2019 - Using Oracle Autonomous Health Framework to...
LAD - GroundBreakers - Jul 2019 - Using Oracle Autonomous Health Framework to...
 
Oracle 12c and its pluggable databases
Oracle 12c and its pluggable databasesOracle 12c and its pluggable databases
Oracle 12c and its pluggable databases
 
The Top 5 Reasons to Deploy Your Applications on Oracle RAC
The Top 5 Reasons to Deploy Your Applications on Oracle RACThe Top 5 Reasons to Deploy Your Applications on Oracle RAC
The Top 5 Reasons to Deploy Your Applications on Oracle RAC
 
Spark SQL Deep Dive @ Melbourne Spark Meetup
Spark SQL Deep Dive @ Melbourne Spark MeetupSpark SQL Deep Dive @ Melbourne Spark Meetup
Spark SQL Deep Dive @ Melbourne Spark Meetup
 
12c (12.1) Database installation on Solaris 11(11.2)
12c (12.1) Database  installation on Solaris 11(11.2)12c (12.1) Database  installation on Solaris 11(11.2)
12c (12.1) Database installation on Solaris 11(11.2)
 
Oracle backup and recovery
Oracle backup and recoveryOracle backup and recovery
Oracle backup and recovery
 
Backup and recovery in oracle
Backup and recovery in oracleBackup and recovery in oracle
Backup and recovery in oracle
 
How to Use EXAchk Effectively to Manage Exadata Environments
How to Use EXAchk Effectively to Manage Exadata EnvironmentsHow to Use EXAchk Effectively to Manage Exadata Environments
How to Use EXAchk Effectively to Manage Exadata Environments
 
Analysis of Database Issues using AHF and Machine Learning v2 - SOUG
Analysis of Database Issues using AHF and Machine Learning v2 -  SOUGAnalysis of Database Issues using AHF and Machine Learning v2 -  SOUG
Analysis of Database Issues using AHF and Machine Learning v2 - SOUG
 
Deep review of LMS process
Deep review of LMS processDeep review of LMS process
Deep review of LMS process
 
Scaling paypal workloads with oracle rac ss
Scaling paypal workloads with oracle rac ssScaling paypal workloads with oracle rac ss
Scaling paypal workloads with oracle rac ss
 
Oracle RAC 19c: Best Practices and Secret Internals
Oracle RAC 19c: Best Practices and Secret InternalsOracle RAC 19c: Best Practices and Secret Internals
Oracle RAC 19c: Best Practices and Secret Internals
 
Tanel Poder - Scripts and Tools short
Tanel Poder - Scripts and Tools shortTanel Poder - Scripts and Tools short
Tanel Poder - Scripts and Tools short
 
Oracle Real Application Clusters 19c- Best Practices and Internals- EMEA Tour...
Oracle Real Application Clusters 19c- Best Practices and Internals- EMEA Tour...Oracle Real Application Clusters 19c- Best Practices and Internals- EMEA Tour...
Oracle Real Application Clusters 19c- Best Practices and Internals- EMEA Tour...
 
Why oracle data guard new features in oracle 18c, 19c
Why oracle data guard new features in oracle 18c, 19cWhy oracle data guard new features in oracle 18c, 19c
Why oracle data guard new features in oracle 18c, 19c
 
Understanding oracle rac internals part 2 - slides
Understanding oracle rac internals   part 2 - slidesUnderstanding oracle rac internals   part 2 - slides
Understanding oracle rac internals part 2 - slides
 
Data Guard Architecture & Setup
Data Guard Architecture & SetupData Guard Architecture & Setup
Data Guard Architecture & Setup
 
Rman Presentation
Rman PresentationRman Presentation
Rman Presentation
 
Tanel Poder - Performance stories from Exadata Migrations
Tanel Poder - Performance stories from Exadata MigrationsTanel Poder - Performance stories from Exadata Migrations
Tanel Poder - Performance stories from Exadata Migrations
 
Using Apache Hive with High Performance
Using Apache Hive with High PerformanceUsing Apache Hive with High Performance
Using Apache Hive with High Performance
 

Viewers also liked

EM13c: Write Powerful Scripts with EMCLI
EM13c: Write Powerful Scripts with EMCLIEM13c: Write Powerful Scripts with EMCLI
EM13c: Write Powerful Scripts with EMCLIGokhan Atil
 
Enterprise Manager: Write powerful scripts with EMCLI
Enterprise Manager: Write powerful scripts with EMCLIEnterprise Manager: Write powerful scripts with EMCLI
Enterprise Manager: Write powerful scripts with EMCLIGokhan Atil
 
Oracle Enterprise Manager Cloud Control 13c for DBAs
Oracle Enterprise Manager Cloud Control 13c for DBAsOracle Enterprise Manager Cloud Control 13c for DBAs
Oracle Enterprise Manager Cloud Control 13c for DBAsGokhan Atil
 
The enterprise manager command line interface2
The enterprise manager command line interface2The enterprise manager command line interface2
The enterprise manager command line interface2Kellyn Pot'Vin-Gorman
 
CW India Sep 2015 - Feature Precast
CW India Sep 2015 - Feature PrecastCW India Sep 2015 - Feature Precast
CW India Sep 2015 - Feature PrecastLaxman Wadhwani
 
Essential Linux Commands for DBAs
Essential Linux Commands for DBAsEssential Linux Commands for DBAs
Essential Linux Commands for DBAsGokhan Atil
 
Oracle 11G SCAN: Concepts and Implementation Experience Sharing
Oracle 11G SCAN: Concepts and Implementation Experience SharingOracle 11G SCAN: Concepts and Implementation Experience Sharing
Oracle 11G SCAN: Concepts and Implementation Experience SharingYury Velikanov
 
Oracle AWR Data mining
Oracle AWR Data miningOracle AWR Data mining
Oracle AWR Data miningYury Velikanov
 
Oracle Enterprise Manager 13C and Hybrid Cloud
Oracle Enterprise Manager 13C and Hybrid CloudOracle Enterprise Manager 13C and Hybrid Cloud
Oracle Enterprise Manager 13C and Hybrid Cloudjobacle
 
Oracle Enterprise Manager Cloud Control 13c for DBAs
Oracle Enterprise Manager Cloud Control 13c for DBAsOracle Enterprise Manager Cloud Control 13c for DBAs
Oracle Enterprise Manager Cloud Control 13c for DBAsGokhan Atil
 

Viewers also liked (10)

EM13c: Write Powerful Scripts with EMCLI
EM13c: Write Powerful Scripts with EMCLIEM13c: Write Powerful Scripts with EMCLI
EM13c: Write Powerful Scripts with EMCLI
 
Enterprise Manager: Write powerful scripts with EMCLI
Enterprise Manager: Write powerful scripts with EMCLIEnterprise Manager: Write powerful scripts with EMCLI
Enterprise Manager: Write powerful scripts with EMCLI
 
Oracle Enterprise Manager Cloud Control 13c for DBAs
Oracle Enterprise Manager Cloud Control 13c for DBAsOracle Enterprise Manager Cloud Control 13c for DBAs
Oracle Enterprise Manager Cloud Control 13c for DBAs
 
The enterprise manager command line interface2
The enterprise manager command line interface2The enterprise manager command line interface2
The enterprise manager command line interface2
 
CW India Sep 2015 - Feature Precast
CW India Sep 2015 - Feature PrecastCW India Sep 2015 - Feature Precast
CW India Sep 2015 - Feature Precast
 
Essential Linux Commands for DBAs
Essential Linux Commands for DBAsEssential Linux Commands for DBAs
Essential Linux Commands for DBAs
 
Oracle 11G SCAN: Concepts and Implementation Experience Sharing
Oracle 11G SCAN: Concepts and Implementation Experience SharingOracle 11G SCAN: Concepts and Implementation Experience Sharing
Oracle 11G SCAN: Concepts and Implementation Experience Sharing
 
Oracle AWR Data mining
Oracle AWR Data miningOracle AWR Data mining
Oracle AWR Data mining
 
Oracle Enterprise Manager 13C and Hybrid Cloud
Oracle Enterprise Manager 13C and Hybrid CloudOracle Enterprise Manager 13C and Hybrid Cloud
Oracle Enterprise Manager 13C and Hybrid Cloud
 
Oracle Enterprise Manager Cloud Control 13c for DBAs
Oracle Enterprise Manager Cloud Control 13c for DBAsOracle Enterprise Manager Cloud Control 13c for DBAs
Oracle Enterprise Manager Cloud Control 13c for DBAs
 

Similar to Oracle Enterprise Manager 12c: EMCLI Crash Course

EMCLI Crash Course - DOAG Germany
EMCLI Crash Course - DOAG GermanyEMCLI Crash Course - DOAG Germany
EMCLI Crash Course - DOAG GermanyGokhan Atil
 
The Enterprise Manager Command Line by Kellyn Pot'Vin
The Enterprise Manager Command Line by Kellyn Pot'VinThe Enterprise Manager Command Line by Kellyn Pot'Vin
The Enterprise Manager Command Line by Kellyn Pot'VinEnkitec
 
The enterprise manager command line interface2
The enterprise manager command line interface2The enterprise manager command line interface2
The enterprise manager command line interface2Kellyn Pot'Vin-Gorman
 
Re-Design with Elixir/OTP
Re-Design with Elixir/OTPRe-Design with Elixir/OTP
Re-Design with Elixir/OTPMustafa TURAN
 
Different type of shells In Netapp Cluster mode 8.X and how to access them t...
Different type of shells In Netapp Cluster mode 8.X  and how to access them t...Different type of shells In Netapp Cluster mode 8.X  and how to access them t...
Different type of shells In Netapp Cluster mode 8.X and how to access them t...Saroj Sahu
 
ClojureScript: The Good Parts
ClojureScript: The Good PartsClojureScript: The Good Parts
ClojureScript: The Good PartsKent Ohashi
 
Windows Server 2008 (PowerShell Scripting Uygulamaları)
Windows Server 2008 (PowerShell Scripting Uygulamaları)Windows Server 2008 (PowerShell Scripting Uygulamaları)
Windows Server 2008 (PowerShell Scripting Uygulamaları)ÇözümPARK
 
Angular JS2 Training Session #1
Angular JS2 Training Session #1Angular JS2 Training Session #1
Angular JS2 Training Session #1Paras Mendiratta
 
PL/SQL User-Defined Functions in the Read World
PL/SQL User-Defined Functions in the Read WorldPL/SQL User-Defined Functions in the Read World
PL/SQL User-Defined Functions in the Read WorldMichael Rosenblum
 
Java tut1 Coderdojo Cahersiveen
Java tut1 Coderdojo CahersiveenJava tut1 Coderdojo Cahersiveen
Java tut1 Coderdojo CahersiveenGraham Royce
 
Yeahhhh the final requirement!!!
Yeahhhh the final requirement!!!Yeahhhh the final requirement!!!
Yeahhhh the final requirement!!!olracoatalub
 
Java Tutorial | My Heart
Java Tutorial | My HeartJava Tutorial | My Heart
Java Tutorial | My HeartBui Kiet
 
Java_Tutorial_Introduction_to_Core_java.ppt
Java_Tutorial_Introduction_to_Core_java.pptJava_Tutorial_Introduction_to_Core_java.ppt
Java_Tutorial_Introduction_to_Core_java.pptGovind Samleti
 

Similar to Oracle Enterprise Manager 12c: EMCLI Crash Course (20)

EMCLI Crash Course - DOAG Germany
EMCLI Crash Course - DOAG GermanyEMCLI Crash Course - DOAG Germany
EMCLI Crash Course - DOAG Germany
 
Kscope emcli kpotvin
Kscope emcli kpotvinKscope emcli kpotvin
Kscope emcli kpotvin
 
The Enterprise Manager Command Line by Kellyn Pot'Vin
The Enterprise Manager Command Line by Kellyn Pot'VinThe Enterprise Manager Command Line by Kellyn Pot'Vin
The Enterprise Manager Command Line by Kellyn Pot'Vin
 
The enterprise manager command line interface2
The enterprise manager command line interface2The enterprise manager command line interface2
The enterprise manager command line interface2
 
Re-Design with Elixir/OTP
Re-Design with Elixir/OTPRe-Design with Elixir/OTP
Re-Design with Elixir/OTP
 
Different type of shells In Netapp Cluster mode 8.X and how to access them t...
Different type of shells In Netapp Cluster mode 8.X  and how to access them t...Different type of shells In Netapp Cluster mode 8.X  and how to access them t...
Different type of shells In Netapp Cluster mode 8.X and how to access them t...
 
ClojureScript: The Good Parts
ClojureScript: The Good PartsClojureScript: The Good Parts
ClojureScript: The Good Parts
 
P3.docx
P3.docxP3.docx
P3.docx
 
Windows Server 2008 (PowerShell Scripting Uygulamaları)
Windows Server 2008 (PowerShell Scripting Uygulamaları)Windows Server 2008 (PowerShell Scripting Uygulamaları)
Windows Server 2008 (PowerShell Scripting Uygulamaları)
 
Angular JS2 Training Session #1
Angular JS2 Training Session #1Angular JS2 Training Session #1
Angular JS2 Training Session #1
 
PL/SQL User-Defined Functions in the Read World
PL/SQL User-Defined Functions in the Read WorldPL/SQL User-Defined Functions in the Read World
PL/SQL User-Defined Functions in the Read World
 
Java tut1
Java tut1Java tut1
Java tut1
 
Java tut1 Coderdojo Cahersiveen
Java tut1 Coderdojo CahersiveenJava tut1 Coderdojo Cahersiveen
Java tut1 Coderdojo Cahersiveen
 
Java tut1
Java tut1Java tut1
Java tut1
 
Javatut1
Javatut1 Javatut1
Javatut1
 
Yeahhhh the final requirement!!!
Yeahhhh the final requirement!!!Yeahhhh the final requirement!!!
Yeahhhh the final requirement!!!
 
Java Tutorial | My Heart
Java Tutorial | My HeartJava Tutorial | My Heart
Java Tutorial | My Heart
 
Java Tutorial
Java TutorialJava Tutorial
Java Tutorial
 
Java_Tutorial_Introduction_to_Core_java.ppt
Java_Tutorial_Introduction_to_Core_java.pptJava_Tutorial_Introduction_to_Core_java.ppt
Java_Tutorial_Introduction_to_Core_java.ppt
 
Elm dev front-end
Elm   dev front-endElm   dev front-end
Elm dev front-end
 

More from Gokhan Atil

Introduction to Spark with Python
Introduction to Spark with PythonIntroduction to Spark with Python
Introduction to Spark with PythonGokhan Atil
 
Introduction to Cassandra
Introduction to CassandraIntroduction to Cassandra
Introduction to CassandraGokhan Atil
 
SQL or noSQL - Oracle Cloud Day Istanbul
SQL or noSQL - Oracle Cloud Day IstanbulSQL or noSQL - Oracle Cloud Day Istanbul
SQL or noSQL - Oracle Cloud Day IstanbulGokhan Atil
 
TROUG & Turkey JUG Semineri: Veriye erişimin en hızlı yolu
TROUG & Turkey JUG Semineri: Veriye erişimin en hızlı yoluTROUG & Turkey JUG Semineri: Veriye erişimin en hızlı yolu
TROUG & Turkey JUG Semineri: Veriye erişimin en hızlı yoluGokhan Atil
 
Oracle 12c Database In Memory DBA SIG
Oracle 12c Database In Memory DBA SIGOracle 12c Database In Memory DBA SIG
Oracle 12c Database In Memory DBA SIGGokhan Atil
 
Oracle 12c Database In-Memory
Oracle 12c Database In-MemoryOracle 12c Database In-Memory
Oracle 12c Database In-MemoryGokhan Atil
 
Oracle DB Standard Edition: Başka Bir Arzunuz?
Oracle DB Standard Edition: Başka Bir Arzunuz?Oracle DB Standard Edition: Başka Bir Arzunuz?
Oracle DB Standard Edition: Başka Bir Arzunuz?Gokhan Atil
 
Enterprise Manager 12c ASH Analytics
Enterprise Manager 12c ASH AnalyticsEnterprise Manager 12c ASH Analytics
Enterprise Manager 12c ASH AnalyticsGokhan Atil
 
Using APEX to Create a Mobile User Interface for Enterprise Manager 12c
Using APEX to Create a Mobile User Interface for Enterprise Manager 12cUsing APEX to Create a Mobile User Interface for Enterprise Manager 12c
Using APEX to Create a Mobile User Interface for Enterprise Manager 12cGokhan Atil
 

More from Gokhan Atil (9)

Introduction to Spark with Python
Introduction to Spark with PythonIntroduction to Spark with Python
Introduction to Spark with Python
 
Introduction to Cassandra
Introduction to CassandraIntroduction to Cassandra
Introduction to Cassandra
 
SQL or noSQL - Oracle Cloud Day Istanbul
SQL or noSQL - Oracle Cloud Day IstanbulSQL or noSQL - Oracle Cloud Day Istanbul
SQL or noSQL - Oracle Cloud Day Istanbul
 
TROUG & Turkey JUG Semineri: Veriye erişimin en hızlı yolu
TROUG & Turkey JUG Semineri: Veriye erişimin en hızlı yoluTROUG & Turkey JUG Semineri: Veriye erişimin en hızlı yolu
TROUG & Turkey JUG Semineri: Veriye erişimin en hızlı yolu
 
Oracle 12c Database In Memory DBA SIG
Oracle 12c Database In Memory DBA SIGOracle 12c Database In Memory DBA SIG
Oracle 12c Database In Memory DBA SIG
 
Oracle 12c Database In-Memory
Oracle 12c Database In-MemoryOracle 12c Database In-Memory
Oracle 12c Database In-Memory
 
Oracle DB Standard Edition: Başka Bir Arzunuz?
Oracle DB Standard Edition: Başka Bir Arzunuz?Oracle DB Standard Edition: Başka Bir Arzunuz?
Oracle DB Standard Edition: Başka Bir Arzunuz?
 
Enterprise Manager 12c ASH Analytics
Enterprise Manager 12c ASH AnalyticsEnterprise Manager 12c ASH Analytics
Enterprise Manager 12c ASH Analytics
 
Using APEX to Create a Mobile User Interface for Enterprise Manager 12c
Using APEX to Create a Mobile User Interface for Enterprise Manager 12cUsing APEX to Create a Mobile User Interface for Enterprise Manager 12c
Using APEX to Create a Mobile User Interface for Enterprise Manager 12c
 

Recently uploaded

Large-scale Logging Made Easy: Meetup at Deutsche Bank 2024
Large-scale Logging Made Easy: Meetup at Deutsche Bank 2024Large-scale Logging Made Easy: Meetup at Deutsche Bank 2024
Large-scale Logging Made Easy: Meetup at Deutsche Bank 2024VictoriaMetrics
 
What Goes Wrong with Language Definitions and How to Improve the Situation
What Goes Wrong with Language Definitions and How to Improve the SituationWhat Goes Wrong with Language Definitions and How to Improve the Situation
What Goes Wrong with Language Definitions and How to Improve the SituationJuha-Pekka Tolvanen
 
%in tembisa+277-882-255-28 abortion pills for sale in tembisa
%in tembisa+277-882-255-28 abortion pills for sale in tembisa%in tembisa+277-882-255-28 abortion pills for sale in tembisa
%in tembisa+277-882-255-28 abortion pills for sale in tembisamasabamasaba
 
MarTech Trend 2024 Book : Marketing Technology Trends (2024 Edition) How Data...
MarTech Trend 2024 Book : Marketing Technology Trends (2024 Edition) How Data...MarTech Trend 2024 Book : Marketing Technology Trends (2024 Edition) How Data...
MarTech Trend 2024 Book : Marketing Technology Trends (2024 Edition) How Data...Jittipong Loespradit
 
%+27788225528 love spells in Huntington Beach Psychic Readings, Attraction sp...
%+27788225528 love spells in Huntington Beach Psychic Readings, Attraction sp...%+27788225528 love spells in Huntington Beach Psychic Readings, Attraction sp...
%+27788225528 love spells in Huntington Beach Psychic Readings, Attraction sp...masabamasaba
 
%+27788225528 love spells in new york Psychic Readings, Attraction spells,Bri...
%+27788225528 love spells in new york Psychic Readings, Attraction spells,Bri...%+27788225528 love spells in new york Psychic Readings, Attraction spells,Bri...
%+27788225528 love spells in new york Psychic Readings, Attraction spells,Bri...masabamasaba
 
%+27788225528 love spells in Atlanta Psychic Readings, Attraction spells,Brin...
%+27788225528 love spells in Atlanta Psychic Readings, Attraction spells,Brin...%+27788225528 love spells in Atlanta Psychic Readings, Attraction spells,Brin...
%+27788225528 love spells in Atlanta Psychic Readings, Attraction spells,Brin...masabamasaba
 
WSO2CON 2024 - Cloud Native Middleware: Domain-Driven Design, Cell-Based Arch...
WSO2CON 2024 - Cloud Native Middleware: Domain-Driven Design, Cell-Based Arch...WSO2CON 2024 - Cloud Native Middleware: Domain-Driven Design, Cell-Based Arch...
WSO2CON 2024 - Cloud Native Middleware: Domain-Driven Design, Cell-Based Arch...WSO2
 
%in Bahrain+277-882-255-28 abortion pills for sale in Bahrain
%in Bahrain+277-882-255-28 abortion pills for sale in Bahrain%in Bahrain+277-882-255-28 abortion pills for sale in Bahrain
%in Bahrain+277-882-255-28 abortion pills for sale in Bahrainmasabamasaba
 
WSO2Con2024 - WSO2's IAM Vision: Identity-Led Digital Transformation
WSO2Con2024 - WSO2's IAM Vision: Identity-Led Digital TransformationWSO2Con2024 - WSO2's IAM Vision: Identity-Led Digital Transformation
WSO2Con2024 - WSO2's IAM Vision: Identity-Led Digital TransformationWSO2
 
%in kempton park+277-882-255-28 abortion pills for sale in kempton park
%in kempton park+277-882-255-28 abortion pills for sale in kempton park %in kempton park+277-882-255-28 abortion pills for sale in kempton park
%in kempton park+277-882-255-28 abortion pills for sale in kempton park masabamasaba
 
Announcing Codolex 2.0 from GDK Software
Announcing Codolex 2.0 from GDK SoftwareAnnouncing Codolex 2.0 from GDK Software
Announcing Codolex 2.0 from GDK SoftwareJim McKeeth
 
%+27788225528 love spells in Boston Psychic Readings, Attraction spells,Bring...
%+27788225528 love spells in Boston Psychic Readings, Attraction spells,Bring...%+27788225528 love spells in Boston Psychic Readings, Attraction spells,Bring...
%+27788225528 love spells in Boston Psychic Readings, Attraction spells,Bring...masabamasaba
 
%in tembisa+277-882-255-28 abortion pills for sale in tembisa
%in tembisa+277-882-255-28 abortion pills for sale in tembisa%in tembisa+277-882-255-28 abortion pills for sale in tembisa
%in tembisa+277-882-255-28 abortion pills for sale in tembisamasabamasaba
 
Architecture decision records - How not to get lost in the past
Architecture decision records - How not to get lost in the pastArchitecture decision records - How not to get lost in the past
Architecture decision records - How not to get lost in the pastPapp Krisztián
 
WSO2Con204 - Hard Rock Presentation - Keynote
WSO2Con204 - Hard Rock Presentation - KeynoteWSO2Con204 - Hard Rock Presentation - Keynote
WSO2Con204 - Hard Rock Presentation - KeynoteWSO2
 
WSO2Con2024 - Enabling Transactional System's Exponential Growth With Simplicity
WSO2Con2024 - Enabling Transactional System's Exponential Growth With SimplicityWSO2Con2024 - Enabling Transactional System's Exponential Growth With Simplicity
WSO2Con2024 - Enabling Transactional System's Exponential Growth With SimplicityWSO2
 
%in ivory park+277-882-255-28 abortion pills for sale in ivory park
%in ivory park+277-882-255-28 abortion pills for sale in ivory park %in ivory park+277-882-255-28 abortion pills for sale in ivory park
%in ivory park+277-882-255-28 abortion pills for sale in ivory park masabamasaba
 

Recently uploaded (20)

Large-scale Logging Made Easy: Meetup at Deutsche Bank 2024
Large-scale Logging Made Easy: Meetup at Deutsche Bank 2024Large-scale Logging Made Easy: Meetup at Deutsche Bank 2024
Large-scale Logging Made Easy: Meetup at Deutsche Bank 2024
 
What Goes Wrong with Language Definitions and How to Improve the Situation
What Goes Wrong with Language Definitions and How to Improve the SituationWhat Goes Wrong with Language Definitions and How to Improve the Situation
What Goes Wrong with Language Definitions and How to Improve the Situation
 
%in tembisa+277-882-255-28 abortion pills for sale in tembisa
%in tembisa+277-882-255-28 abortion pills for sale in tembisa%in tembisa+277-882-255-28 abortion pills for sale in tembisa
%in tembisa+277-882-255-28 abortion pills for sale in tembisa
 
MarTech Trend 2024 Book : Marketing Technology Trends (2024 Edition) How Data...
MarTech Trend 2024 Book : Marketing Technology Trends (2024 Edition) How Data...MarTech Trend 2024 Book : Marketing Technology Trends (2024 Edition) How Data...
MarTech Trend 2024 Book : Marketing Technology Trends (2024 Edition) How Data...
 
%+27788225528 love spells in Huntington Beach Psychic Readings, Attraction sp...
%+27788225528 love spells in Huntington Beach Psychic Readings, Attraction sp...%+27788225528 love spells in Huntington Beach Psychic Readings, Attraction sp...
%+27788225528 love spells in Huntington Beach Psychic Readings, Attraction sp...
 
%+27788225528 love spells in new york Psychic Readings, Attraction spells,Bri...
%+27788225528 love spells in new york Psychic Readings, Attraction spells,Bri...%+27788225528 love spells in new york Psychic Readings, Attraction spells,Bri...
%+27788225528 love spells in new york Psychic Readings, Attraction spells,Bri...
 
%+27788225528 love spells in Atlanta Psychic Readings, Attraction spells,Brin...
%+27788225528 love spells in Atlanta Psychic Readings, Attraction spells,Brin...%+27788225528 love spells in Atlanta Psychic Readings, Attraction spells,Brin...
%+27788225528 love spells in Atlanta Psychic Readings, Attraction spells,Brin...
 
Abortion Pills In Pretoria ](+27832195400*)[ 🏥 Women's Abortion Clinic In Pre...
Abortion Pills In Pretoria ](+27832195400*)[ 🏥 Women's Abortion Clinic In Pre...Abortion Pills In Pretoria ](+27832195400*)[ 🏥 Women's Abortion Clinic In Pre...
Abortion Pills In Pretoria ](+27832195400*)[ 🏥 Women's Abortion Clinic In Pre...
 
WSO2CON 2024 - Cloud Native Middleware: Domain-Driven Design, Cell-Based Arch...
WSO2CON 2024 - Cloud Native Middleware: Domain-Driven Design, Cell-Based Arch...WSO2CON 2024 - Cloud Native Middleware: Domain-Driven Design, Cell-Based Arch...
WSO2CON 2024 - Cloud Native Middleware: Domain-Driven Design, Cell-Based Arch...
 
Abortion Pill Prices Tembisa [(+27832195400*)] 🏥 Women's Abortion Clinic in T...
Abortion Pill Prices Tembisa [(+27832195400*)] 🏥 Women's Abortion Clinic in T...Abortion Pill Prices Tembisa [(+27832195400*)] 🏥 Women's Abortion Clinic in T...
Abortion Pill Prices Tembisa [(+27832195400*)] 🏥 Women's Abortion Clinic in T...
 
%in Bahrain+277-882-255-28 abortion pills for sale in Bahrain
%in Bahrain+277-882-255-28 abortion pills for sale in Bahrain%in Bahrain+277-882-255-28 abortion pills for sale in Bahrain
%in Bahrain+277-882-255-28 abortion pills for sale in Bahrain
 
WSO2Con2024 - WSO2's IAM Vision: Identity-Led Digital Transformation
WSO2Con2024 - WSO2's IAM Vision: Identity-Led Digital TransformationWSO2Con2024 - WSO2's IAM Vision: Identity-Led Digital Transformation
WSO2Con2024 - WSO2's IAM Vision: Identity-Led Digital Transformation
 
%in kempton park+277-882-255-28 abortion pills for sale in kempton park
%in kempton park+277-882-255-28 abortion pills for sale in kempton park %in kempton park+277-882-255-28 abortion pills for sale in kempton park
%in kempton park+277-882-255-28 abortion pills for sale in kempton park
 
Announcing Codolex 2.0 from GDK Software
Announcing Codolex 2.0 from GDK SoftwareAnnouncing Codolex 2.0 from GDK Software
Announcing Codolex 2.0 from GDK Software
 
%+27788225528 love spells in Boston Psychic Readings, Attraction spells,Bring...
%+27788225528 love spells in Boston Psychic Readings, Attraction spells,Bring...%+27788225528 love spells in Boston Psychic Readings, Attraction spells,Bring...
%+27788225528 love spells in Boston Psychic Readings, Attraction spells,Bring...
 
%in tembisa+277-882-255-28 abortion pills for sale in tembisa
%in tembisa+277-882-255-28 abortion pills for sale in tembisa%in tembisa+277-882-255-28 abortion pills for sale in tembisa
%in tembisa+277-882-255-28 abortion pills for sale in tembisa
 
Architecture decision records - How not to get lost in the past
Architecture decision records - How not to get lost in the pastArchitecture decision records - How not to get lost in the past
Architecture decision records - How not to get lost in the past
 
WSO2Con204 - Hard Rock Presentation - Keynote
WSO2Con204 - Hard Rock Presentation - KeynoteWSO2Con204 - Hard Rock Presentation - Keynote
WSO2Con204 - Hard Rock Presentation - Keynote
 
WSO2Con2024 - Enabling Transactional System's Exponential Growth With Simplicity
WSO2Con2024 - Enabling Transactional System's Exponential Growth With SimplicityWSO2Con2024 - Enabling Transactional System's Exponential Growth With Simplicity
WSO2Con2024 - Enabling Transactional System's Exponential Growth With Simplicity
 
%in ivory park+277-882-255-28 abortion pills for sale in ivory park
%in ivory park+277-882-255-28 abortion pills for sale in ivory park %in ivory park+277-882-255-28 abortion pills for sale in ivory park
%in ivory park+277-882-255-28 abortion pills for sale in ivory park
 

Oracle Enterprise Manager 12c: EMCLI Crash Course

  • 1. ORACLE ENTERPRISE MANAGER 12C EM CLI CRASH COURSE GÖKHAN ATIL ORACLE ACE, DBA
  • 2. Gökhan Atıl DBA Team Leader Oracle ACE (since 2011) Founding Member and Vice President
 of TROUG (troug.org) Co-author of Expert Oracle Enterprise 
 Manager from Apress Blogger (since 2008) gokhanatil.com 2
  • 3. Agenda Introduction to EM CLI EM CLI Verbs Formatting the Output Fetching Information From EM Repository Sample Bash Scripts EM CLI Interactive Mode and Scripting Mode Fundamentals of Python Sample Python Scripts 3
  • 4. What is EM CLI? Repository EM CLI Agent OMS Web Console 4
  • 5. Why EM CLI? Emotional Reasons: We love text-based tools Practical Reasons: Sometimes it’s faster (less clicks) Good for scripting Web interface of Enterprise Manager is so cool! 5
  • 6. Jump into the action! It’s already installed and configured on OMS server: cd $OMSHOME/bin ./emcli (or emcli.bat on Windows servers) 6
  • 7. How to Install and Configure EM CLI Requires Java version 1.6.0_43 or greater Supported Operating Systems: Windows, Linux, Solaris, HPUX, Tru64, AIX Go to “command line interface” page under “setup” page to download the installation JAR file. Login is not required, so it’s possible to download the JAR file with “wget”. To run EM CLI on Java 1.8 or higher, you need apply patch 17555224 to the weblogic server. Use"-no-check-certificate" parameter with wget. 7
  • 8. How to Install and Configure EM CLI After you download, set JAVA_HOME and install the JAR file: java -jar emcliadvancedkit.jar -install_dir=<home> java -jar emclikit.jar -install_dir=<home> Configure EM CLI: emcli help setup emcli setup -url="https://host:port/em" 
 -username=<emuser> -trustall 8 don’t forget check the syntax
  • 9. Standard vs Scripting There are two different installation kits for EM CLI: EM CLI Standard Kit: This kit supports only the Standard (command line) mode. EM CLI with Scripting mode (option): This “advanced kit” supports Interactive and Script modes in addition to standard mode. 9 What are these modes?
  • 10. 3 modes of EM CLI: Standard mode: This mode provides a simple command-line and executes one verb at a time. emcli get_targets Interactive mode: This mode creates an interactive session. emcli Scripting mode: In Scripting mode, EM CLI runs Jython scripts. emcli @scriptname.py 10 Forget Jython for now, and you’ll be OKAY
  • 11. Understanding EM CLI Syntax In standard mode, EM CLI expect you enter a verb as the first parameter. Verbs may take zero or more arguments as input. Arguments are preceded by a dash. It’s recommended to write values enclosed in quotation marks. emcli verb -1st_argument 
 [ -2nd_ argument="value" ]
 [ -3rd_ argument="value" ] 
 [ -4th_ argument ]
 … 11
  • 12. A less known feature emcli setup - Syntax Error: Ambiguous argument - matches the beginning of each of these argument names: 
 -_newline_, -additionalpostparams, -autologin, 
 -certans, -custom_attrib_file, -dir, -licans, 
 -localdirans, -noautologin, -nocertvalidate, 
 -noregister, -novalidate, -offline, -password, -trustall, 
 -url, -username, -verb_jars_dir emcli setup -ur="https://host:port/em" -us=<emuser> -t 12 error message shows all possible arguments
  • 13. Basic Operational Verbs help: Get help for emcli verbs, usage: emcli help [verb] setup: Configure emcli status: List configuration details sync: Synchronize with the OMS (after updates) version: List emcli verb/client version login: Login to the OMS logout: Logout from the OMS argfile: Execute emcli verbs from a file 13 You need to login first!
  • 14. 400+ Verbs in 76 Categories Add Host Verbs Agent Administration Verbs Agent Upgrade Verbs BI Publisher Reports Verbs Blackout Verbs Credential Verbs Incident Rules Verbs Job Verbs Metric Extension Verbs Monitoring Templates Verbs Oracle Cloud Verbs Provisioning Verbs Self Update Verbs User Administration Verbs 14
  • 15. Find the exact name of a target Target names, target types and even “verbs” are case sensitive, so be sure that you use the exact name and target type: emcli get_targets emcli get_targets -targets="targetname:%" emcli get_targets -targets="targettype" emcli get_targets -targets="targetname:targettype" 15
  • 16. “Grep” is your friend! Some verbs provide own filtering mechanism, 
 but some of them don’t. Using grep will 
 help you to filter the output of emcli. emcli help | grep -i blackout 
 emcli get_target_types | grep -i database 16
  • 17. Format and redirect the output emcli get_targets -format="name:pretty" emcli get_targets -format="name:csv" emcli get_targets -format="name:script" emcli get_targets -script emcli get_targets -script > list_of_targets.txt emcli get_targets -script l parsing_tool 17 Output can be parsed easily by Unix tools
  • 18. Gateway to the EM repository There are more than 70 verbs to help you query information from OMS, but you may still need a more powerful verb. EMCLI list verb can query the Enterprise Manager repository database. The following command will list all resources that you can query using “list” verb: emcli list -help The following command will list the roles defined in EM: emcli list -resource="Roles" 18 Management Views
  • 19. Gateway to the EM repository This command shows the columns of the specified resource: emcli list -resource="Roles" -help You can filter the columns and rows: emcli list -resource="Roles" -columns="ROLE_NAME,DESCRIPTION" 
 -search="ROLE_NAME= 'EM_ALL_ADMINISTRATOR'" 19
  • 20. Gateway to the EM repository On EM 12.1.0.5, “List” verb can query 27 resources. If you can not find the data you need among these resources, you can even run SQL on repository database: emcli list -sql="<query>" 20 You may check
 my blog :)
  • 21. List the targets with critical alerts Get_targets can also be used to monitor if any critical alerts or warnings raised. emcli get_targets -alerts 
 emcli get_targets -alerts -script -noheader | awk '{ if ($5>0) print $4":"$3"t"$5 }' 21 Critical Alerts
  • 22. Sample Script: Blackout/Maintenance emcli login -username="GOKHAN" -password="s3cr3t" emcli create_blackout -name="DEVDB Blackout" 
 -add_targets="DEVDB:oracle_database" 
 -reason="Maintenance work" 
 -schedule=“duration:200”
 …
 …
 emcli stop_blackout -name="DEVDB Blackout"
 emcli delete_blackout -name="DEVDB Blackout"
 emcli logout 22
  • 23. Sample Script: Clear Stateless Alerts login=$(emcli login -username="GOKHAN" 
 -password="s3cr3t" | grep -c “successful")
 
 if [ $login -eq 1 ]; then
 for DBNAME in $(emcli get_targets 
 -targets="oracle_database" -noheader -script | cut -f4);
 do
 emcli clear_stateless_alerts -older_than=0
 -target_type="oracle_database"
 -target_name="$DBNAME"
 done
 emcli logout
 fi 23
  • 24. Sample Script: Delete All Named Credentials login=$(emcli login -username="GOKHAN" 
 -password="s3cr3t" | grep -c "successful")
 
 if [ $login -eq 1 ]; then
 for CN in $(emcli list_named_credentials -script
 -noheader | cut -f1);
 do
 emcli delete_named_credential -cred_name="$CN"
 done
 emcli logout
 fi 24
  • 25. EM CLI with Scripting Mode Run “emcli" without any parameters; … and you find yourself in a Jython world! 25
  • 26. Someone said Jython? Jython is an implementation of the Python programming language designed to run on the Java platform. 26
  • 27. Python: Widely used general-purpose, 
 high-level programming language Supports multiple programming paradigms, including OOP, imperative and functional programming Dynamic type system and 
 automatic memory management Batteries Included (!) 27 You say Jython is Python but what is Python?
  • 28. EM CLI & Python Verbs are defined as Python functions and arguments are entered as function parameters: get_targets -target="oracle_database" get_targets( target="oracle_database") Results of verbs can be formatted as JSON Includes some Python modules (os, gzip, xml, ftplib and more…) Python makes EM CLI scripting easy! 28
  • 29. Fundamentals of Python Variables (dynamic type, no need for declaration but need initialisation): myvar = "TESTDB" myvar = myvar + ":oracle_database" myvar = 10 myvar = myvar + 10 myvar = 10 + "10" TypeError: unsupported operand type(s) for 
 +: 'int' and 'str' 29
  • 30. Fundamentals of Python Conversion between integer and string, conditional jumps and code blocks: myvar = int("2")
 myvar = 2
 myvar = "2" if ( myvar >= 10 ):
 print "myvar is " + str(myvar)
 else:
 print "lower than 10" Code blocks are identified by “indentation” 30
  • 31. Fundamentals of Python Dictionary objects, list objects and iterations: mydict = { 'Name':'Gokhan', 'Age':40 } mydict['Name'] = "Gokhan" mylist = [“Joe","William","Jack","Averell"] mylist[0] = "Joe" for i in mylist:
 print i Looks like JSON It will print all elements in “mylist” 31
  • 32. EM CLI Response Object emcli.response.Response is the response object when you run a emcli verb in scripting or interactive mode. emcli.response.Response error() error text
 exit_code() error code (0=success)
 isJson() is JSON? true/false
 out() JSON or TEXT 32
  • 33. EM CLI Response Object In scripting mode, default output format is JSON. In interactive mode, default output format is TEXT, to make it JSON, run the following command: set_client_property('EMCLI_OUTPUT_TYPE', 'JSON') It’s better to use JSON format because Python dictionary object can perfectly handle JSON format. So there’s no need for extra effort to parse the output. 33
  • 34. EM CLI Response Object Let’s get the response from a verb: mytargets = get_targets( target="oracle_database" ) type(mytargets.out())
 <type 'dict'> mytargets.out() {'data': [{'Status': 'Up', 'Warning': '6', 'Status ID': '0', 'Target Type': 'oracle_database', 'Critical': '64', 'Target Name': ‘TESTDB’},{…}]} 34 returns
 emcli.response.Response object
  • 35. EM CLI Response Object A response always contain a “data” item which is a list object: type(mytargets.out()['data'])
 <type ‘list'> mytargets.out()['data'] [{'Status': 'Up', 'Warning': '6', 'Status ID': '0', 'Target Type': 'oracle_database', 'Critical': '64', 'Target Name': ‘TESTDB’},{…}] 35
  • 36. EM CLI Response Object We can iterate over all items of the list object (so we can process all rows): for DB in mytargets.out()['data']:
 print DB['Target Name'], DB['Status'] 36
  • 37. Sample Script: Clear Stateless Alerts Save the following code in a file (clearalerts.py) and run it as “emcli @clearalerts.py”: if login( username="GOKHAN" ).exit_code()==0: mytargets=get_targets( targets="oracle_database" ) for DB in mytargets.out()['data']:
 clear_stateless_alerts( 
 target_name=DB['Target Name'], 
 target_type=DB['Target Type'], older_than="0" ) 37
  • 38. Sample Script: Change DBSNMP Passwords if len(sys.argv) <> 2:
 print "Usage: emcli @change_dbsnmp_passwords.py oldpwd newpwd"
 exit()
 if login( username="GOKHAN" ).exit_code()==0:
 mytargets=get_targets( targets="%_database" )
 for DB in mytargets.out()['data']:
 try: 
 update_db_password (target_name=DB['Target Name'],
 target_type=DB['Target Type'] ,
 change_at_target="yes",user_name="dbsnmp",
 old_password=sys.argv[0],
 new_password=sys.argv[1],
 retype_new_password=sys.argv[1])
 except emcli.exception.VerbExecutionError, e:
 print e.error() 38
  • 39. Sample Script: Promote Unmanaged Databases lg = login( username="SYSMAN" ) if lg.exit_code() <> 0:
 print lg.error() utargets=get_targets( "unmanaged", "properties", targets="oracle_database" ) for target in utargets.out()['data']:
 add_target( name=target['Target Name'], type=target['Target Type'],
 host=target['Host Info'].split(';')[0].split(':')[1],
 credentials="UserName:dbsnmp;password:xyz;Role:Normal", properties=target[‘Properties'] ) positional parameters 39
  • 40. Thank You for Attending! 40 I’m always open to your questions and comments:
 gokhan at gokhanatil.com
 gokhanatil www.gokhanatil.com