The enterprise manager command line interface2
-
Upload
kellyn-potvin-gorman -
Category
Documents
-
view
1.523 -
download
11
description
Transcript of The enterprise manager command line interface2
![Page 1: The enterprise manager command line interface2](https://reader030.fdocuments.us/reader030/viewer/2022013105/554b996ab4c905764c8b4928/html5/thumbnails/1.jpg)
![Page 2: The enterprise manager command line interface2](https://reader030.fdocuments.us/reader030/viewer/2022013105/554b996ab4c905764c8b4928/html5/thumbnails/2.jpg)
Kellyn Pot’Vin,
Westminster, Colorado
Oracle ACE, Sr. Technical Specialist at Enkitec
Finishing up EM12c book and starting EM CLI book
Specialize in performance and management of large enterprise environments.
Board of directors for RMOUG, Director of Training Days 2013, KSCOPE DB Track Lead 2013
Blog: DBAKevlar.com
Twitter: @DBAKevlar
![Page 3: The enterprise manager command line interface2](https://reader030.fdocuments.us/reader030/viewer/2022013105/554b996ab4c905764c8b4928/html5/thumbnails/3.jpg)
What to Include?
What to Exclude?
What are the most important areas of
the EM CLI?
What commands are best covered to
create the best educational introduction
to the topic?
![Page 4: The enterprise manager command line interface2](https://reader030.fdocuments.us/reader030/viewer/2022013105/554b996ab4c905764c8b4928/html5/thumbnails/4.jpg)
Enterprise Manager Command Line
Interface History
How EM12c has changed level of
knowledge requirements for the
administrator
The Command Line Interface Basics
Enterprise Manager commands
EM CLI Procedure Scripting
![Page 5: The enterprise manager command line interface2](https://reader030.fdocuments.us/reader030/viewer/2022013105/554b996ab4c905764c8b4928/html5/thumbnails/5.jpg)
Introduced in Oracle 9i with very limited use.
Access to EM functionality from text based consoles.
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.
![Page 6: The enterprise manager command line interface2](https://reader030.fdocuments.us/reader030/viewer/2022013105/554b996ab4c905764c8b4928/html5/thumbnails/6.jpg)
Create Jobs, schedule jobs, delete jobs
Administer groups, members, targets
Administer users and credentials.
Upload patches, delete patches-create patch plans.
Execute host and sql commands.
Get information about all targets, monitoring.
Over 30 verb “groups” and 250 commands that I have documented “so far”.
![Page 7: The enterprise manager command line interface2](https://reader030.fdocuments.us/reader030/viewer/2022013105/554b996ab4c905764c8b4928/html5/thumbnails/7.jpg)
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 Manager.
emcli help <verb>
![Page 8: The enterprise manager command line interface2](https://reader030.fdocuments.us/reader030/viewer/2022013105/554b996ab4c905764c8b4928/html5/thumbnails/8.jpg)
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 connection mode.)
emcli login –username=<username>
Syncronize the EMCLI with the OMS:
emcli sync
![Page 9: The enterprise manager command line interface2](https://reader030.fdocuments.us/reader030/viewer/2022013105/554b996ab4c905764c8b4928/html5/thumbnails/9.jpg)
Check connection mode, if complete,
then offline the EM CLI emcli get_connection_mode
emcli set_connection_mode -mode="offline“
emcli get_jobs
Set back to online mode if wanting to proceed.
![Page 10: The enterprise manager command line interface2](https://reader030.fdocuments.us/reader030/viewer/2022013105/554b996ab4c905764c8b4928/html5/thumbnails/10.jpg)
emcli
<verb>
1st_argument[-name, -procedure, -
instance, -guid, -argfile, -
input_file, -type, -targets, -
action…] = <value>
2nd_argument [-xml, -tailLength, -
info, -analyze, -grants, -
scheduler, -notification] =
<value>
![Page 11: The enterprise manager command line interface2](https://reader030.fdocuments.us/reader030/viewer/2022013105/554b996ab4c905764c8b4928/html5/thumbnails/11.jpg)
Redirection example of output, (similar to
Unix):
emcli get_procedure_xml –
procedure=“PROC_GUID” >
test_proc.xml
![Page 12: The enterprise manager command line interface2](https://reader030.fdocuments.us/reader030/viewer/2022013105/554b996ab4c905764c8b4928/html5/thumbnails/12.jpg)
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 alerts
Argfile: File of verbs to execute from the emcli.
![Page 13: The enterprise manager command line interface2](https://reader030.fdocuments.us/reader030/viewer/2022013105/554b996ab4c905764c8b4928/html5/thumbnails/13.jpg)
EM CLI for EM12c support
› Checking Incidents
› Retrieve Targets Monitored
› Retrieve Agent Properties
› Agent Deployment
› Platform support
› Creating/Stopping Blackouts
› Executing Host Commands
![Page 14: The enterprise manager command line interface2](https://reader030.fdocuments.us/reader030/viewer/2022013105/554b996ab4c905764c8b4928/html5/thumbnails/14.jpg)
emcli get_resolution_states
![Page 15: The enterprise manager command line interface2](https://reader030.fdocuments.us/reader030/viewer/2022013105/554b996ab4c905764c8b4928/html5/thumbnails/15.jpg)
What database targets are being monitored, both single instance and RAC?
emcli get_targets -targets="%database%"
![Page 16: The enterprise manager command line interface2](https://reader030.fdocuments.us/reader030/viewer/2022013105/554b996ab4c905764c8b4928/html5/thumbnails/16.jpg)
emcli get_supported_platforms
![Page 17: The enterprise manager command line interface2](https://reader030.fdocuments.us/reader030/viewer/2022013105/554b996ab4c905764c8b4928/html5/thumbnails/17.jpg)
emcli get_agentimage -
destination=/home/oracle -
platform="Microsoft Windows x64
(64-bit)" –version="12.1.0.1.0"
![Page 18: The enterprise manager command line interface2](https://reader030.fdocuments.us/reader030/viewer/2022013105/554b996ab4c905764c8b4928/html5/thumbnails/18.jpg)
emcli get_targets
emcli delete_target –name="<trg_nm>“
emcli import_update –file="file_nm" –
omslocal
emcli deploy_plugin_on_server -
plugin=oracle.sysman.db –
sys_password=<passwd>
emcli deploy_plugin_on_agent –
plugin="oracle.sysman.db" –
agent_name="<dbname>:<port>"
![Page 19: The enterprise manager command line interface2](https://reader030.fdocuments.us/reader030/viewer/2022013105/554b996ab4c905764c8b4928/html5/thumbnails/19.jpg)
emcli set_credential -
target_type=oracle_database -target_name="<preferred_nm>"-
credential_set=DBCredsMonitoring -
user=sysman
-column="Role:SYSDBA;UserName:sys;pass
word:<passwd>"-monitoring
![Page 20: The enterprise manager command line interface2](https://reader030.fdocuments.us/reader030/viewer/2022013105/554b996ab4c905764c8b4928/html5/thumbnails/20.jpg)
Save off Templates
Inventory Existing Jobs
Create secure credentials for targets
Create administrator groups to ease
administration.
Reuse templates, post creating first one,
easy updates!
![Page 21: The enterprise manager command line interface2](https://reader030.fdocuments.us/reader030/viewer/2022013105/554b996ab4c905764c8b4928/html5/thumbnails/21.jpg)
emcli create_blackout -name="Linux
Patch 120612" -reason="Needs to be
Done" -
add_targets="emrep12:oracle_databa
se" -schedule="duration::60“
How fast could you blackout entire environment for maintenance window with this scripted?
![Page 22: The enterprise manager command line interface2](https://reader030.fdocuments.us/reader030/viewer/2022013105/554b996ab4c905764c8b4928/html5/thumbnails/22.jpg)
Simply state the name of the blackout and the agent will issue a stop to the OMS:
emcli stop_blackout
-name="Linux Patch 120612“
How quickly could you end a blackout of
environment post maintenance?
![Page 23: The enterprise manager command line interface2](https://reader030.fdocuments.us/reader030/viewer/2022013105/554b996ab4c905764c8b4928/html5/thumbnails/23.jpg)
![Page 24: The enterprise manager command line interface2](https://reader030.fdocuments.us/reader030/viewer/2022013105/554b996ab4c905764c8b4928/html5/thumbnails/24.jpg)
emcli execute_hostcmd –cmd=“ls -ltr
/home/oracle”
-credential_set_name=“HostCredsPriv”
-targets=“<host>.com:host”
![Page 25: The enterprise manager command line interface2](https://reader030.fdocuments.us/reader030/viewer/2022013105/554b996ab4c905764c8b4928/html5/thumbnails/25.jpg)
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 tasks.
Retain EM12c security and single console
monitoring if required.
![Page 26: The enterprise manager command line interface2](https://reader030.fdocuments.us/reader030/viewer/2022013105/554b996ab4c905764c8b4928/html5/thumbnails/26.jpg)
Need to verify job information
emcli get_jobs
![Page 27: The enterprise manager command line interface2](https://reader030.fdocuments.us/reader030/viewer/2022013105/554b996ab4c905764c8b4928/html5/thumbnails/27.jpg)
emcli get_job_execution_detail -
execution=C07388B855B44C38B5953B8C
3C7C6A5E -xml
![Page 28: The enterprise manager command line interface2](https://reader030.fdocuments.us/reader030/viewer/2022013105/554b996ab4c905764c8b4928/html5/thumbnails/28.jpg)
Assumption is that patches are
downloaded via EM12c.
Process:
› Verify Patch Available.
› Create Patch Plan
› Schedule Patches in Patch Plan
› Deploy Patch Plan
![Page 29: The enterprise manager command line interface2](https://reader030.fdocuments.us/reader030/viewer/2022013105/554b996ab4c905764c8b4928/html5/thumbnails/29.jpg)
list_aru_languages -- List ARU Language information.
list_aru_platforms -- List ARU platform information.
list_aru_products -- List ARU Product information.
list_aru_releases -- List ARU Release information.
list_patch_plans -- List existing Patch Plans.
search_patches -- Search patches from ARU site or Software
![Page 30: The enterprise manager command line interface2](https://reader030.fdocuments.us/reader030/viewer/2022013105/554b996ab4c905764c8b4928/html5/thumbnails/30.jpg)
emcli search_patches
-patch_name="patch number"
-platform="platform id“
emcli search_patches
–patch_name=“5875660” (BI
Publisher)
–platform=“233” (Windows 64 bit)
![Page 31: The enterprise manager command line interface2](https://reader030.fdocuments.us/reader030/viewer/2022013105/554b996ab4c905764c8b4928/html5/thumbnails/31.jpg)
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
Interface.
![Page 32: The enterprise manager command line interface2](https://reader030.fdocuments.us/reader030/viewer/2022013105/554b996ab4c905764c8b4928/html5/thumbnails/32.jpg)
emcli submit_procedure
-name='<Procedure Name>'
-input_file="<data:path to file>"
-instance_name="<Procedure
Instance>"
-schedule=start_time:yyyy/mm/dd
HH:mm;
![Page 33: The enterprise manager command line interface2](https://reader030.fdocuments.us/reader030/viewer/2022013105/554b996ab4c905764c8b4928/html5/thumbnails/33.jpg)
emcli submit_procedure -
input_file=data:data.xml -
procedure=3D7F4D139E70453CB56D7621
BB56D390
-schedule="start_time:2012/12/03
21:00; tz:America/Central" -
grants="KPOTVIN:VIEW_JOB;
SYSMAN:FULL_JOB" -
notification="action required,
failed"
![Page 34: The enterprise manager command line interface2](https://reader030.fdocuments.us/reader030/viewer/2022013105/554b996ab4c905764c8b4928/html5/thumbnails/34.jpg)
Create a template to use for your new
properties file, sourced from a procedure
definition.
Fill in all pertinent information for the
target lists.
Submit the procedure, using the
properties file as part or whole of the
entry at the command line.
Verify all was successful.
![Page 35: The enterprise manager command line interface2](https://reader030.fdocuments.us/reader030/viewer/2022013105/554b996ab4c905764c8b4928/html5/thumbnails/35.jpg)
emcli get_procedures –type=DBPROV
Example Output
$>BFC71D3485629B93E04014AC08001B7D
, DBPROV, DBREPLAYCLIENTDP_NG,
Provision Oracle Database Client,
6.2, ORACLE
BFC71D3485599B93E04014AC08001B7D,
DBPROV, SIHA_SIDB_PROC, Provision
Oracle Database, 1.1, ORACLE
![Page 36: The enterprise manager command line interface2](https://reader030.fdocuments.us/reader030/viewer/2022013105/554b996ab4c905764c8b4928/html5/thumbnails/36.jpg)
Using the GUID, (or the procedure
<NAME>, we can then generate a
properties file template:
emcli describe_procedure_input –
procedure=
BFC71D3485629B93E04014AC08001B7D >
dbreplay_tst.properties
$> Verifying parameters…
$>
![Page 37: The enterprise manager command line interface2](https://reader030.fdocuments.us/reader030/viewer/2022013105/554b996ab4c905764c8b4928/html5/thumbnails/37.jpg)
Edit the new template properties file and
add the new values for the following:
$ vi dbreplay_tst.properties
Source and Reference Host Data
Agent Info
Oracle Home
Credentials
![Page 38: The enterprise manager command line interface2](https://reader030.fdocuments.us/reader030/viewer/2022013105/554b996ab4c905764c8b4928/html5/thumbnails/38.jpg)
![Page 39: The enterprise manager command line interface2](https://reader030.fdocuments.us/reader030/viewer/2022013105/554b996ab4c905764c8b4928/html5/thumbnails/39.jpg)
emcli submit_procedure –name=test_dbrpl_job
-owner=sys_jobs
-procedure= C23E10B1F427B4EEE040578CD74442G4
-input_file=/u01/emjobs/emcli/dbreplay_tst.properties
-notification="action required, failed"
-grants=“KPOTVIN:VIEW_JOB; SYSMAN:FULL_JOB"
-schedule= "start_time:2012/12/06 01:00:00; tz:America/Denver"
![Page 40: The enterprise manager command line interface2](https://reader030.fdocuments.us/reader030/viewer/2022013105/554b996ab4c905764c8b4928/html5/thumbnails/40.jpg)
emcli get_instance_status -
instance=C23E10B1F427B4EEE040578CD
74442G4
-details -showJobOutput
Output: C23E10B1F427B4EEE040578CD74442G4
, test_job, test_job, SUCCESSFUL
![Page 41: The enterprise manager command line interface2](https://reader030.fdocuments.us/reader030/viewer/2022013105/554b996ab4c905764c8b4928/html5/thumbnails/41.jpg)
Rob Zoeteweij, Patching with EM12c
http://oemgc.wordpress.com/tag/oem-gc-12c/
Laurent Leturgez, Useful EMCLI Commands
http://laurentleturgez.wordpress.com/2012/06/11/useful-emcli-commands-in-em-cloud-control-12c/
Laurent Schneider, The EM CLI
http://laurentschneider.com/wordpress/2011/11/enterprise-manager-command-line-interface.html
![Page 42: The enterprise manager command line interface2](https://reader030.fdocuments.us/reader030/viewer/2022013105/554b996ab4c905764c8b4928/html5/thumbnails/42.jpg)
http://enkitec.com
http://dbakevlar.com