Data … as usual

All things about data by Laurent Leturgez

Useful emcli commands in EM Cloud Control 12c

If like me, you are addicted to command line, this post will help you to realize useful operation in EM Cloud Control 12c using emcli tool rather than GUI.

You can use emcli when you need to implement batch scripts on your Oracle Management Server (OMS).

  • Login to EM
$ emcli login -username=sysman
Enter password :
Login successful

OR

$ emcli login -username=sysman -password=XXXXXX
Login successful
  • Synchronize emcli with the OMS
$ emcli sync
Synchronized successfully
  • Logout EM
$ emcli logout
Logout successful
  • List all the targets already promoted
$ emcli get_targets
Status  Status           Target Type           Target Name
 ID
-9      n/a              group                 OFM
1       Up               host                  xxxdb-prod3.mydomain.com
1       Up               host                  xxxdb-prod2.mydomain.com
1       Up               host                  xxxlgc-prod2.mydomain.com
1       Up               host                  xxxdb-prod1.mydomain.com
1       Up               j2ee_application      /EMGC_GCDomain/GCDomain/EMGC_OMS1/e
                                               mgc
1       Up               j2ee_application      /EMGC_GCDomain/GCDomain/EMGC_OMS1/O
                                               CMRepeater
1       Up               j2ee_application      /EMGC_GCDomain/GCDomain/EMGC_OMS1/e
                                               mpbs
-9      n/a              metadata_repository   /EMGC_GCDomain/GCDomain/EMGC_ADMINS
                                               ERVER/mds-sysman_mds
-9      n/a              metadata_repository   /EMGC_GCDomain/GCDomain/EMGC_ADMINS
                                               ERVER/mds-owsm
1       Up               oracle_apache         /EMGC_GCDomain/instance1/ohs1
1       Up               oracle_apm            /EMGC_GCDomain/GCDomain/EMGC_OMS1/o
                                               racle.security.apm(11.1.1.3.0)
1       Up               oracle_beacon         EM Management Beacon
1       Up               oracle_em_service     EM Console Service
1       Up               oracle_em_service     EM Jobs Service
1       Up               oracle_emd            xxxdb-prod1.mydomain.com:1830
1       Up               oracle_emd            xxxdb-prod3.mydomain.com:1830
1       Up               oracle_emd            xxxlgc-prod2.mydomain.com:3872
1       Up               oracle_emd            xxxdb-prod2.mydomain.com:1830
1       Up               oracle_emrep          Management Services and Repository
-9      n/a              oracle_home           agent12g1_9_xxxlgc-prod2
-9      n/a              oracle_home           WebLogicServer10_3_5_0_0_xxxlgc-pro
                                               d2
-9      n/a              oracle_home           oms12g1_3_xxxlgc-prod2
-9      n/a              oracle_home           webtier12g1_20_xxxlgc-prod2
-9      n/a              oracle_ias_farm       EMGC_GCDomain
1       Up               oracle_oms            xxxlgc-prod2.mydomain.com:4889_Managem
                                               ent_Service
1       Up               oracle_oms_console    xxxlgc-prod2.mydomain.com:4889_Managem
                                               ent_Service_CONSOLE
1       Up               oracle_oms_pbs        xxxlgc-prod2.mydomain.com:4889_Managem
                                               ent_Service_PBS
-9      n/a              weblogic_domain       /EMGC_GCDomain/GCDomain
1       Up               weblogic_j2eeserver   /EMGC_GCDomain/GCDomain/EMGC_OMS1
1       Up               weblogic_j2eeserver   /EMGC_GCDomain/GCDomain/EMGC_ADMINSERVER
  • Delete a specific target
$ emcli delete_target -name="/wlstest_wlstest/wlstest/myServer_jvm" -type="java_virtual_machine"
  • Delete an agent and its targets
$ emcli delete_target -name="xxxlgc-prod2.mydomain.com:3872" -type="oracle_emd" -delete_monitored_targets
  • Follow a plugin deployment (on the OMS / on an agent)
-- Oracle Database plugin
$ emcli get_plugin_deployment_status -plugin_id=oracle.sysman.db
-- Oracle Fusion Middleware plugin
$ emcli get_plugin_deployment_status -plugin_id=oracle.sysman.emas
-- My Oracle Support plugin
$ emcli get_plugin_deployment_status -plugin_id=oracle.sysman.mos
  • Import an update (for example: a plugin update) into the software library.
$ emcli import_update -file="p14018177_112000_Generic.zip" -omslocal
  • Deploy a plugin on the OMS
$ emcli deploy_plugin_on_server -plugin=oracle.sysman.db -sys_password=XXXXX
  • Deploy a plugin on EM agent(s)
$ emcli deploy_plugin_on_agent -plugin="oracle.sysman.db"  -agent_names="xxxdb-prod1.mydomain.com:3872;xxxdb-prod2.mydomain.com:3872"
  • 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 = Linux x86
-----------------------------------------------
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="Microsoft Windows x64 (64-bit)" -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:/u02/Middleware/oms
calling pulloneoffs with arguments:/u02/Middleware/oms/u02/softLibrary/32/C0C9BF40C6A36668E0439D33010AE58512.1.0.1.0windows_x64
Check this logs for more information: /u02/Middleware/oms/sysman/prov/agentpush/logs
  • Set monitoring credentials for a specific target (example given for an Oracle database instance)
$ emcli set_credential -target_type=oracle_database -target_name="prod1" -credential_set=DBCredsMonitoring -user=sysman -column="Role:SYSDBA;UserName:sys;password:XXXXX" -monitoring
Advertisement

12 responses to “Useful emcli commands in EM Cloud Control 12c

  1. jd October 17, 2012 at 7:34 PM

    very nice and concise. much thanks.

  2. billybobbainb January 4, 2013 at 3:43 PM

    Very helpful. You might add:
    $ emcli undeploy_plugin_from_server -plugin=[pluginid]
    $ emcli undeploy_plugin_from_agent -plugin=[pluginid] -agent_names=[agent1;agent2;…;agentn]

  3. mahe June 4, 2013 at 6:54 PM

    thank you. It was useful for me during 12.1.0.2 PSU update.

  4. Sebastin December 9, 2014 at 6:15 PM

    Hi Laurent,

    Thanks for this post and it is very useful.

    Could you please share me how to change the dbsnmp password in database & grid control?

    • Laurent December 31, 2014 at 11:16 AM

      Hi,

      In the target database, just perform an alter user idenfied by NEWPASSWORD, and then in EM, as explained in the MOS Note 1592390.1, run emcli command with update_db_password verb : emcli update_db_password -target_name=”” -target_type=”oracle_database” -user_name=”dbsnmp” -change_at_target=yes -old_password=”” -new_password=”” -retype_new_password=””

  5. Sebastin January 29, 2015 at 5:16 PM

    Hi,

    Thanks for the info.

    I need to update the sysman password 12c Grid control repository instance and I should update in OEM, but should we have the same password in all other targets? Please suggest. Thanks.

    Regars,
    S. Sebastin

  6. jasonbrown264 June 17, 2015 at 4:36 AM

    Reblogged this on @dba_jay and commented:
    This is very useful for quick EM Commands. Thanks, Laurent

  7. Pingback: Emcli Login | LOGINSPENT

  8. Pingback: Emcli Login | Instans Login

  9. Pingback: Emcli Login - Login Place

  10. Pingback: oracle oem emcli com Login Sign In Account Page Guide http - trustba.com

Leave a Reply to jd Cancel reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.

%d bloggers like this: