Kscope emcli kpotvin


Published on

KSCOPE 2013 EMCLI Presentation

  • Be the first to comment

  • Be the first to like this

No Downloads
Total views
On SlideShare
From Embeds
Number of Embeds
Embeds 0
No embeds

No notes for slide

Kscope emcli kpotvin

  1. 1. The Enterprise ManagerCommand Line InterfaceKellyn Pot’VinSr. Technical Consultant Enkitec
  2. 2. About Me Kellyn Pot’Vin, Westminster, Colorado Oracle ACE Director, Sr. Technical Specialist atEnkitec Finishing up EM12c book and starting EM CLI book Specialize in performance and management of largeenterprise environments. Board of directors for RMOUG, Director of TrainingDays Conference, KSCOPE DB Track Lead 2013 Blog: DBAKevlar.com Twitter: @DBAKevlar
  3. 3. Challenges of Topic What to Include? What to Exclude? What are the most important areas of the EMCLI? What commands are best covered to create thebest educational introduction to the topic?
  4. 4. Agenda Enterprise Manager Command Line InterfaceHistory How EM12c has changed level of knowledgerequirements for the administrator The Command Line Interface Basics Enterprise Manager commands EM CLI Procedure Scripting
  5. 5. EM CLI Introduced in Oracle 9i with very limited use. Access to EM functionality from text basedconsoles. 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 throughcommand line interface.
  6. 6. What We Can Do- Create Jobs, schedule jobs, delete jobs Administer groups, members, targets Administer users and credentials. Upload patches, delete patches-create patchplans. Execute host and SQL commands. Get information about all targets, monitoring. Over 30 verb “groups” and 250 commands thatI have documented “so far”.
  7. 7. EM CLI Terminology EM CLI Login- Online or Offline? “Verbs” grant the administrator initialcommands for the interface. May Require one or more arguments. Can utilize a argument file, aka properties file. Syntax often changes with version of EnterpriseManager.emcli help <verb>
  8. 8. Must be Logged in… The Command Line must be logged into for the firsttime before commands will be accepted, (logindependent upon EM security time out feature orconnection mode.)emcli login –username=<username> Syncronize the EMCLI with the OMS:emcli sync
  9. 9. Unless You Set to “Offline” Check connection mode, if complete, then offlinethe EM CLIemcli get_connection_modeemcli set_connection_mode -mode="offline“emcli get_jobsSet back to online mode if wanting to proceed.
  10. 10. EM CLI Syntaxemcli<verb>1st_argument[-name, -procedure,-instance, -guid, -argfile,-input_file, -type, -targets,-action…] = <value>2nd_argument [-xml, -tailLength,-info, -analyze, -grants,-scheduler, -notification] = <value>
  11. 11. Redirection Redirection example of output, (similar to Unix):emcli get_procedure_xml –procedure=“PROC_GUID” >test_proc.xml
  12. 12. 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 statelessalerts Argfile: File of verbs to execute from the emcli.
  13. 13. 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
  14. 14. Checking the Incidents in EM12cemcli get_resolution_states
  15. 15. Simple EM CLI Command What database targets are being monitored, bothsingle instance and RAC?emcli get_targets -targets="%database%"
  16. 16. What’s Platforms are Supported?emcli get_supported_platforms
  17. 17. Download for Agent Deployemcli get_agentimage-destination=/home/oracle-platform="Microsoft Windows x64(64-bit)" –version=""
  18. 18. Agent Deployment Stepsemcli get_targetsemcli delete_target –name="<trg_nm>“emcli import_update –file="file_nm"–omslocalemcli deploy_plugin_on_server-plugin=oracle.sysman.db –sys_password=<passwd>emcli deploy_plugin_on_agent –plugin="oracle.sysman.db" –agent_name="<dbname>:<port>"
  19. 19. Final Configuration of Targetemcli set_credential-target_type=oracle_database-target_name="<preferred_nm>"-credential_set=DBCredsMonitoring -user=sysman-column="Role:SYSDBA;UserName:sys;password:<passwd>"-monitoring
  20. 20. Tips For Success Save off Templates Inventory Existing Jobs Create secure credentials for targets Create administrator groups to easeadministration. Reuse templates, post creating first one, easyupdates!
  21. 21. Create a Blackoutemcli create_blackout -name="LinuxPatch 120612" -reason="Needs to beDone"-add_targets="emrep12:oracle_database" -schedule="duration::60“How fast could you blackout an entireenvironment for maintenance window withthis scripted?
  22. 22. Stop BlackoutSimply state the name of the blackout and theagent will issue a stop to the OMS:emcli stop_blackout-name="Linux Patch 120612“How quickly could you end a blackout ofenvironment post maintenance?
  23. 23. “get_blackout_reasons”
  24. 24. Executing Host Commandsemcli execute_hostcmd –cmd=“ls-ltr /home/oracle”-credential_set_name=“HostCredsPriv”-targets=“<host>.com:host”
  25. 25. Why jobs from EM CLI? Simplify management of large number oftargets with simple script vs. multiple stepsthrough EM12c console. This simplicity includes creating, managing,editing and purging of jobs and patching jobtasks. Retain EM12c security and single consolemonitoring if required.
  26. 26. Verify Details of Job Execution Need to verify job informationemcli get_jobs
  27. 27. Details Based off Executionemcli get_job_execution_detail-execution=C07388B855B44C38B5953B8C3C7C6A5E -xml
  28. 28. Patching Simplified through the EM CLI Assumption is that patches are downloaded viaEM12c. Process:● Verify Patch Available.● Create Patch Plan● Schedule Patches in Patch Plan● Deploy Patch Plan
  29. 29. Power of List_aru_xx cmds list_aru_languages -- List ARU Languageinformation. list_aru_platforms -- List ARU platforminformation. list_aru_products -- List ARU Product information. list_aru_releases -- List ARU Releaseinformation. list_patch_plans -- List existing Patch Plans. search_patches -- Search patches from ARUsite or Software
  30. 30. Search Available Patchesemcli search_patches-patch_name="patch number"-platform="platform id“emcli search_patches–patch_name=“5875660” (BI Publisher)–platform=“233” (Windows 64 bit)
  31. 31. Procedural Scripting in EM CLI Multi-step, multi-tasked or chained scriptingthrough the EM CLI. Ability to execute SQL, Perl, OS Commandsfrom one procedure. Ability to use properties file to simplify work andreuse with other procedures. EM Console access through Job ActivityInterface.
  32. 32. Submitting an EM CLI procedureemcli submit_procedure-name=<Procedure Name>-input_file="<data:path to file>"-instance_name="<ProcedureInstance>"-schedule=start_time:yyyy/mm/ddHH:mm;
  33. 33. Example of Submit Procedure- EM Jobemcli submit_procedure-input_file=data:data.xml-procedure=3D7F4D139E70453CB56D7621BB56D390-schedule="start_time:2012/12/0321:00; tz:America/Central"-grants="KPOTVIN:VIEW_JOB;SYSMAN:FULL_JOB"-notification="action required,failed"
  34. 34. Properties Files Create a template to use for your newproperties file, sourced from a proceduredefinition. Fill in all pertinent information for the targetlists. Submit the procedure, using the properties fileas part or whole of the entry at the commandline. Verify all was successful.
  35. 35. Get the Procedure Nameemcli get_procedures –type=DBPROVExample Output:$>BFC71D3485629B93E04014AC08001B7D,DBPROV, DBREPLAYCLIENTDP_NG,Provision Oracle Database Client,6.2, ORACLEBFC71D3485599B93E04014AC08001B7D,DBPROV, SIHA_SIDB_PROC, ProvisionOracle Database, 1.1, ORACLE
  36. 36. Creating a TemplateUsing the GUID, (or the procedure <NAME>, wecan then generate a properties file template:emcli describe_procedure_input –procedure=BFC71D3485629B93E04014AC08001B7D >dbreplay_tst.properties$> Verifying parameters…$>
  37. 37. Updating with a New TargetEdit the new template properties file and add thenew values for the following:$ vi dbreplay_tst.propertiesSource and Reference Host DataAgent InfoOracle HomeCredentials
  38. 38. Submit your Procedure with PropertiesFileemcli 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/0601:00:00; tz:America/Denver"
  39. 39. Verify from EM CLIemcli get_instance_status-instance=C23E10B1F427B4EEE040578CD74442G4-details -showJobOutputOutput:C23E10B1F427B4EEE040578CD74442G4, test_job, test_job, SUCCESSFUL
  40. 40. Want to Read More?Rob Zoeteweij, Patching with EM12chttp://oemgc.wordpress.com/tag/oem-gc-12c/Laurent Leturgez, Useful EMCLI Commandshttp://laurentleturgez.wordpress.com/2012/06/11/useful-emcli-commands-in-em-cloud-control-12c/Laurent Schneider, The EM CLIhttp://laurentschneider.com/wordpress/2011/11/enterprise-manager-command-line-interface.html
  41. 41. Thank you!http://enkitec.comhttp://dbakevlar.comdbakevlar@gmail.comkpotvin@enkitec.com