The Enterprise Manager Command Line by Kellyn Pot'Vin
The Enterprise Manager
Command Line Interface
Sr. Technical Consultant Enkitec
Oracle ACE Director, Sr. Technical Specialist at
Finishing up EM12c book and starting EM CLI book
Specialize in performance and management of large
Board of directors for RMOUG, Director of Training
Days Conference, KSCOPE DB Track Lead 2013
Challenges of Topic
What to Include?
What to Exclude?
What are the most important areas of the EM
What commands are best covered to create the
best educational introduction to the topic?
Enterprise Manager Command Line Interface
How EM12c has changed level of knowledge
requirements for the administrator
The Command Line Interface Basics
Enterprise Manager commands
EM CLI Procedure Scripting
Introduced in Oracle 9i with very limited use.
Access to EM functionality from text based
Ability to incorporate scripts, including SQL*Plus,
Perl, Shell, Python, etc.
Fully integrated as part of the EM environment,
including same security.
Ability to simplify multi-target tasks through
command line interface.
What We Can Do-
Create Jobs, schedule jobs, delete jobs
Administer groups, members, targets
Administer users and credentials.
Upload patches, delete patches-create patch
Execute host and SQL commands.
Get information about all targets, monitoring.
Over 30 verb “groups” and 250 commands that
I have documented “so far”.
EM CLI Terminology
EM CLI Login- Online or Offline?
“Verbs” grant the administrator initial
commands for the interface.
May Require one or more arguments.
Can utilize a argument file, aka properties file.
Syntax often changes with version of Enterprise
emcli help <verb>
Must be Logged in…
The Command Line must be logged into for the first
time before commands will be accepted, (login
dependent upon EM security time out feature or
emcli login –username=<username>
Syncronize the EMCLI with the OMS:
Unless You Set to “Offline”
Check connection mode, if complete, then offline
the EM CLI
emcli set_connection_mode -mode="offline“
Set back to online mode if wanting to proceed.
Redirection example of output, (similar to Unix):
emcli get_procedure_xml –
Common Verbs(aka arguments)
get_resolution_states - Incident Information
stop/start_agent - Manage Agents
create/stop_blackout - Manage Blackouts
clone_database_home - Clone home
execute_sql - Execute SQL
get_jobs - Get a list of jobs
clear_stateless_alerts - Clears stateless
Argfile: File of verbs to execute from the emcli.
Agenda: Baby Steps
EM CLI for EM12c support
● Checking Incidents
● Retrieve Targets Monitored
● Retrieve Agent Properties
● Agent Deployment
● Platform support
● Creating/Stopping Blackouts
● Executing Host Commands
Checking the Incidents in EM12c
Simple EM CLI Command
What database targets are being monitored, both
single instance and RAC?
emcli get_targets -targets="%database%"
What’s Platforms are Supported?
Download for Agent Deploy
emcli get_agentimage -
platform="Microsoft Windows x64 (64-
Final Configuration of Target
emcli set_credential -
Tips For Success
Save off Templates
Inventory Existing Jobs
Create secure credentials for targets
Create administrator groups to ease
Reuse templates, post creating first one, easy
Create a Blackout
emcli create_blackout -name="Linux
Patch 120612" -reason="Needs to be
How fast could you blackout entire
environment for maintenance window with
Simply state the name of the blackout and the
agent will issue a stop to the OMS:
-name="Linux Patch 120612“
How quickly could you end a blackout of
environment post maintenance?
Why jobs from EM CLI?
Simplify management of large number of
targets with simple script vs. multiple steps
through EM12c console.
This simplicity includes creating, managing,
editing and purging of jobs and patching job
Retain EM12c security and single console
monitoring if required.
Verify Details of Job Execution
Need to verify job information
Details Based off Execution
emcli get_job_execution_detail -
Patching Simplified through the EM CLI
Assumption is that patches are downloaded via
● Verify Patch Available.
● Create Patch Plan
● Schedule Patches in Patch Plan
● Deploy Patch Plan
Power of List_aru_xx cmds
list_aru_languages -- List ARU Language
list_aru_platforms -- List ARU platform
list_aru_products -- List ARU Product information.
list_aru_releases -- List ARU Release
list_patch_plans -- List existing Patch Plans.
search_patches -- Search patches from ARU
site or Software
Search Available Patches
–patch_name=“5875660” (BI Publisher)
–platform=“233” (Windows 64 bit)
Procedural Scripting in EM CLI
Multi-step, multi-tasked or chained scripting
through the EM CLI.
Ability to execute SQL, Perl, OS Commands
from one procedure.
Ability to use properties file to simplify work and
reuse with other procedures.
EM Console access through Job Activity
Submitting an EM CLI procedure
-input_file="<data:path to file>"
Example of Submit Procedure- EM Job
emcli submit_procedure -
21:00; tz:America/Central" -
Create a template to use for your new
properties file, sourced from a procedure
Fill in all pertinent information for the target
Submit the procedure, using the properties file
as part or whole of the entry at the command
Verify all was successful.
Get the Procedure Name
emcli get_procedures –type=DBPROV
Provision Oracle Database Client,
DBPROV, SIHA_SIDB_PROC, Provision
Oracle Database, 1.1, ORACLE
Creating a Template
Using the GUID, (or the procedure <NAME>, we
can then generate a properties file template:
emcli describe_procedure_input –
$> Verifying parameters…
Updating with a New Target
Edit the new template properties file and add the
new values for the following:
$ vi dbreplay_tst.properties
Source and Reference Host Data
Verify from EM CLI
emcli get_instance_status -
, test_job, test_job, SUCCESSFUL
Want to Read More?
Rob Zoeteweij, Patching with EM12c
Laurent Leturgez, Useful EMCLI Commands
Laurent Schneider, The EM CLI