Have you ever added your RAC cluster to OEM, thinking that you entered all the target properties at the right places?  But after it’s done, you realize that there are still targets that have their properties left unset?  The problem is more prevalent with Exadata, since it has many more targets.  Or have you ever changed your monitoring hierarchy and you need to change the properties for a lot of targets?  If it’s more than 10 targets, you’d be better off scripting it.  This article illustrates mass updating OEM target properties through generating the emcli utility commands from dynamic SQL.

Definitely, there are other ways to do this, but this method seems easier than many of these articles online.  Nevertheless, I will link to them at the bottom.

Command Syntax

This is what the command looks like:

cd $OMS_HOME/bin
emcli set_target_property_value -subseparator=property_records="@@" -property_records="{Target Name}@@{Target Type}@@{Property Name}@@{Property Value}"

Execute this command as the oracle user on the Oracle Management Services(OMS) boxes.

In order do this repetitively, we are going to use dynamic SQL to compose these statements for many targets all at once.

First of all, we’ll have to go over each of these 4 elements and understand what the appropriate values are.  Each of these four fields are delimited using a colon by default.  But you can change the delimitor using the -subseparator= parameter.

For the Agent targets(oracle_emd) and the Agent Oracle Home targets(oracle_home), there are colons already in the target names.  Using colon as the separator would mess up the delimitation.  Therefore, you see the use of the @@ separator below.




Target Name

The Target Name is just the name of the target you’re trying to update.

Target Type

The Target Type parameter value can be queried in the SYSMAN.EM_TARGET_TYPES table on the OMR Database as follows.  You need to know these target types if you need to update certain types of targets.

set lines 200 pages 10000
col target_type format a50
col type_display_name format a60
select type_display_name, target_type
from sysman.em_target_types
order by 1;

Target TypesTarget Types (Display Value)
apm_ba_serviceBusiness Application
asm_diskgroup_componentASM Disk Group Component
bea_alsbOracle Service Bus
casm_diskgroup_componentCluster ASM Disk Group Component
cloud_resource_providerCloud Resource Provider
cloud_serviceCloud Service
clusterCluster
compositeGroup
composite_application_systemOracle Composite Application
coreid_access_sysAccess Manager – Access System
coreid_identity_sysAccess Manager – Identity System
exa_rackExalogic Rack
exalogic_controlExalogic Control System
exalogic_systemExalogic Elastic Cloud
exalytics_machineExalytics Machine
exalytics_systemExalytics System
formsappformsapp
gds_cloudGlobal Data Services
gds_gsmGlobal Service Manager
gds_poolGlobal Data Services Pool
generic_apacheApache HTTP Server
generic_idm_systemIdentity and Access System
generic_redundancy_groupRedundancy Group
generic_serviceGeneric Service
generic_systemGeneric System
glassfish_clusterOracle GlassFish Cluster
glassfish_domainOracle GlassFish Domain
glassfish_j2eeserverOracle GlassFish Server
hasOracle High Availability Service
hostHost
host_groupHost Group
j2ee_applicationApplication Deployment
j2ee_application_clusterClustered Application Deployment
j2ee_application_domainDomain Application Deployment
java_virtual_machineJava Virtual Machine
java_virtual_machine_alltargetsJVM Pools
java_virtual_machine_poolJava Virtual Machine Pool
jboss_domainFusion Middleware JBoss J2ee Domain
jboss_j2eeserverJBoss Application Server
jboss_partitionJBoss Partition
jee_webserviceJEE Web Service
jrf_webserviceOracle Infrastructure Web Service
jvmJVM
metadata_repositoryMetadata Repository
netapp_filerNetwork Appliance Filer
oc4jOC4J
oc4j_clusterOC4J Cluster
oc4jjvmOC4J JVM
oracle_activitygraphActivity Graph
oracle_analyticsAnalytics
oracle_apacheOracle HTTP Server
oracle_apache_clusterHTTP Server Cluster
oracle_apmOracle Authorization Policy Manager
oracle_applicationOracle Application
oracle_apps_systemOracle Apps
oracle_bc4jADF Business Components for Java
oracle_beaconBeacon
oracle_bi_ansOracle BI Analytics Server (10g)
oracle_bi_ccOracle BI Cluster Controller (10g)
oracle_bi_cluster_controllerOracle BI Cluster Controller
oracle_bi_dacOracle BI DAC Server
oracle_bi_instanceOracle BI Instance
oracle_bi_java_hostOracle BI JavaHost
oracle_bi_presentation_servicesOracle BI Presentation Server
oracle_bi_psOracle BI Presentation Server (10g)
oracle_bi_schOracle BI Scheduler (10g)
oracle_bi_schedulerOracle BI Scheduler
oracle_bi_serverOracle BI Server
oracle_bi_suiteOracle BI Suite EE
oracle_bi_webOracleBI Web Plug-in
oracle_bpelprocessOracle BPEL PRocess
oracle_btm_sphereBTM Sphere Engine
oracle_btm_sysBTM System
oracle_camm_managerOCAMM Manager
oracle_cefConnector Extension Framework
oracle_cef_clusterConnector Extension Framework Cluster
oracle_cloudOracle Cloud
oracle_coherenceOracle Coherence Cluster
oracle_coherence_cacheOracle Coherence Cache
oracle_coherence_nodeOracle Coherence Node
oracle_coreid_access_serverAccess Manager – Access Server
oracle_coreid_identity_serverAccess Manager – Identity Server
oracle_csa_collectorCSA Collector
oracle_dasDelegated Administration Services
oracle_das_serverDelegated Administration Server
oracle_databaseDatabase Instance
oracle_database_groupDatabase Group
oracle_dbmachineOracle Database Machine
oracle_dbsvcSchema Service
oracle_dbsysDatabase System
oracle_discussionDiscussion
oracle_dseeOracle Directory Server Enterprise Edition Server
oracle_dsee_entDirectory Server Enterprise
oracle_dsee_grpDirectory Server Enterprise Group
oracle_em_serviceEM Service
oracle_emdAgent
oracle_emd_proxyAgent proxy
oracle_emrepOMS and Repository
oracle_emsvrs_sysEM Servers System
oracle_ep_serviceService Entry Point
oracle_epsDirectory Integration Platform
oracle_eps_serverDirectory Integration Platform Server
oracle_essbaseEssbase Server
oracle_essbaseappEssbase Application
oracle_exa_cisco_switchOracle Engineered System Cisco Switch
oracle_exa_ilomOracle Engineered System ILOM Server
oracle_exa_kvmOracle Exadata KVM
oracle_exa_pduOracle Engineered System PDU
oracle_exadataOracle Exadata Storage Server
oracle_exadata_dbsysOracle Database Exadata Storage Server System
oracle_exadata_gridOracle Exadata Storage Server Grid
oracle_federationIdentity Federation Server
oracle_federation_sysIdentity Federation System
oracle_formsForms
oracle_homeOracle Home
oracle_iasOracle Application Server
oracle_ias_clusterOracle Application Server Cluster
oracle_ias_farmOracle Fusion Middleware Farm
oracle_ias_jmx_clusterOracle Application Server 10.1.3 Cluster
oracle_ibnetworkOracle Infiniband Network
oracle_ibswitchOracle Infiniband Switch
oracle_idmIdentity Management
oracle_idm_reposIdentity Manager Repository
oracle_idm_serverIdentity Manager Server
oracle_idm_systemIdentity Manager System
oracle_integrationbpmOracle BPEL Process Manager
oracle_irmOracle Information Rights Management
oracle_jservJServ
oracle_ldapOracle Internet Directory
oracle_listenerListener
oracle_oaamOracle Adaptive Access Manager
oracle_oaam_clusterOracle Adaptive Access Manager Cluster
oracle_oamOracle Access Management Server
oracle_oam_clusterOracle Access Management Cluster
oracle_odi_j2eeagentODI Java EE Agent
oracle_odi_standaloneagentODI Standalone Agent
oracle_oidInternet Directory
oracle_oimOracle Identity Manager
oracle_oim_clusterOracle Identity Manager Cluster
oracle_omsOracle Management Service
oracle_oms_consoleOMS Console
oracle_oms_pbsOMS Platform
oracle_otd_clusterTraffic Director Configuration
oracle_otd_instanceTraffic Director Instance
oracle_ovdOracle Virtual Directory
oracle_pdbPluggable Database
oracle_personalizationPersonalization
oracle_portalOracle Portal
oracle_portaltoolsPortlet Producers
oracle_repappOracle Reports Application
oracle_repbrdOracle Reports Bridge
oracle_repservOracle Reports Server
oracle_reptoolsOracle Reports Tools
oracle_ruei_reporterRUEI Reporter Engine
oracle_ruei_sysRUEI System
oracle_sdpmessagingdriverUser Messaging Driver
oracle_sdpmessagingdriver_emailEmail Driver
oracle_sdpmessagingdriver_proxyProxy Driver
oracle_sdpmessagingdriver_smppSMPP Driver
oracle_sdpmessagingdriver_voicexmlVoiceXML Driver
oracle_sdpmessagingdriver_worklistWorklist Driver
oracle_sdpmessagingdriver_xmppXMPP Driver
oracle_sdpmessagingserverUser Messaging Service
oracle_soa_compositeSOA Composite
oracle_soa_composite_sysOracle SOA Composite Sys
oracle_soa_folderSOA Partition
oracle_soainfraSOA Infrastructure
oracle_soainfra_clusterOracle SOA Infra Cluster
oracle_soainfra_sysOracle SOA Infra Sys
oracle_socialOracle Social Network
oracle_social_clusterOracle Social Network Application Cluster
oracle_social_instanceOracle Social Network Instance
oracle_ssoSingle Sign-On
oracle_sso_serverSingle Sign-On Server
oracle_ucmOracle Universal Content Management
oracle_webcacheWeb Cache
oracle_webcenterOracle WebCenter Portal
osb_business_serviceOSB Business Service
osb_pipelineOSB Pipeline
osb_proxy_serviceOSB Proxy Service
osb_serverOracle Secure Backup
osb_splitjoinOSB Split Join
osm_clusterCluster ASM
osm_instanceAutomatic Storage Management
osm_ioserverAsm IO Server
osm_proxyAsm Proxy
rac_databaseCluster Database
rest_webserviceRESTful Web Service
scheduler_serviceScheduler Service
scheduler_service_groupScheduler Service Group
soa_composite_componentSOA Composite Component
soa_composite_referenceSOA Composite Reference
soa_composite_serviceSOA Composite Service
soainfra_engineSOA Infrastructure Engine
wbem_cimomWbem CIM Object Manager
webcache_clusterWebCache Cluster
webcenter_portal_appwebcenter_portal_app
weblogic_clusterOracle WebLogic Cluster
weblogic_domainOracle WebLogic Domain
weblogic_domain_groupOracle WebLogic Domain Group
weblogic_j2eeserverOracle WebLogic Server
websiteWeb Application
websphere_cellIBM WebSphere Application Server Cell
websphere_clusterIBM WebSphere Application Server Cluster
websphere_j2eeserverIBM WebSphere Application Server
wmqIBM WebSphere MQ Queue Manager
wmq_clusterIBM WebSphere MQ Cluster

Some of these target type names aren’t very straightforward.  For example, the Agent target type is “oracle_emd”.



Property Name

The Property Name is the property that you want to change.  A list of these property names can be found in mgmt$all_target_prop_defs:

select property_display_name, property_name
from mgmt$all_target_prop_defs;

Property Name(display)Property Name
Commentorcl_gtp_comment
Contactorcl_gtp_contact
Cost Centerorcl_gtp_cost_center
Customer Service Identifierorcl_gtp_csi
Departmentorcl_gtp_department
Deployment Typeorcl_gtp_deployment_type
Lifecycle Statusorcl_gtp_lifecycle_status
Line of Businessorcl_gtp_line_of_bus
Locationorcl_gtp_location
Operating Systemorcl_gtp_os
Platformorcl_gtp_platform
Target Versionorcl_gtp_target_version
Ownerudtp_1

Property Value

The Property Value is where you specify the value.  Most properties accept any value, except for Lifecycle Status, which accepts only:

    • None
    • Development
    • Test
    • Staging
    • Production
    • Mission Critical

Monitoring Hierarchy

In order to figure out what to update, you do need to have a solid understanding on how your targets hierarchy is structured.

If you adopt the very common monitoring hierarchy, you’d have something like this:

where the root group is divided into the Lifecycle Status: Development, Test, Staging, Production, and Mission Critical.  And then each of those is divided into Cost Centers, which can be your organization’s teams or departments.

In your organization, you can have many other ways of organizing the targets, but you’d just have to know how the structure is laid out.

Based on this, let’s say we’re changing the properties of Lifecycle Status to “Production” and Cost Center to “BLAH” of some targets.



Procedures

From the OMR database, you’d run a query to dynamically generate the commands from data.  Several points:

  1. Specify a where clause to narrow down to only the targets you want to update
  2. Exclude certain target types that you simply don’t use, like the cloud types and composite
Cost Center
select './emcli set_target_property_value -subseparator=property_records="@@" -property_records="' || target_name || '@@' || target_type || '@@Cost Center@@BLAH"'
from mgmt$target
where target_name || ',' || target_type not in (
select target_name || ',' || target_type from mgmt$target_properties
where property_name = 'orcl_gtp_cost_center'   <-- specifying the cost center property
)
and target_name like '%......%'  ← Use your own criteria to match the targets you want to update
and target_type not in ('composite', 'cloud', 'oracle_cloud', 'oracle_vm_cloud')   <-- excluding some targets
order by target_type, target_name;
Lifecycle Status
select './emcli set_target_property_value -subseparator=property_records="@@" -property_records="' || target_name || '@@' || target_type || '@@Lifecycle Status@@Production"'
from mgmt$target
where target_name || ',' || target_type not in (
select target_name || ',' || target_type from mgmt$target_properties
where property_name = 'orcl_gtp_lifecycle_status'  <-- specifying the Lifecycle Status property
)
and target_name like '%......%'  ← Use your own criteria to match the targets you want to update
and target_type not in ('composite', 'cloud', 'oracle_cloud', 'oracle_vm_cloud')   <-- excluding some targets
order by target_type, target_name;

Examples

The following are some examples of the generated commands, including some for Exadata targets.

Lifecycle Status
# Cluster ASM
./emcli set_target_property_value -subseparator="@@" -property_records="+ASM_lax1-XXXX@@osm_cluster@@Lifecycle Status@@Production"

# Automatic Storage Management
./emcli set_target_property_value -subseparator="@@" -property_records="+ASM1_lax1-XXXX-dbadm01.domain.com@@osm_instance@@Lifecycle Status@@Production"

# Oracle Database Exadata Storage Server System
./emcli set_target_property_value -subseparator="@@" -property_records="usXXXX_cellsys@@oracle_exadata_dbsys@@Lifecycle Status@@Production"

# Cluster Database
./emcli set_target_property_value -subseparator="@@" -property_records="usXXXX@@rac_database@@Lifecycle Status@@Production"

# Oracle Home
./emcli set_target_property_value -subseparator="@@" -property_records="agent12c1_3_lax1-XXXX-dbadm01.domain.com@@oracle_home@@Lifecycle Status@@Production"

#Oracle High Availability Service
./emcli set_target_property_value -subseparator="@@" -property_records="has_lax1-XXXX-dbadm01.domain.com@@has@@Lifecycle Status@@Production"

# Cluster
./emcli set_target_property_value -subseparator="@@" -property_records="lax1-XXXX@@cluster@@Lifecycle Status@@Production"

# Oracle Exadata Storage Server
./emcli set_target_property_value -subseparator="@@" -property_records="lax1-XXXX-celadm01.domain.com@@oracle_exadata@@Lifecycle Status@@Production"

# Host
./emcli set_target_property_value -subseparator="@@" -property_records="lax1-XXXX-dbadm01.domain.com@@host@@Lifecycle Status@@Production"

# Agent
./emcli set_target_property_value -subseparator="@@" -property_records="lax1-XXXX-dbadm01.domain.com:3872@@oracle_emd@@Lifecycle Status@@Production"

# Oracle Engineered System ILOM Server
./emcli set_target_property_value -subseparator="@@" -property_records="lax1-XXXX-dbadm01-ilom.domain.com@@oracle_exa_ilom@@Lifecycle Status@@Production"

# Oracle Engineered System Cisco Switch
./emcli set_target_property_value -subseparator="@@" -property_records="lax1-XXXX-sw-adm01.domain.com@@oracle_exa_cisco_switch@@Lifecycle Status@@Production"

# Oracle Infiniband Switch
./emcli set_target_property_value -subseparator="@@" -property_records="lax1-XXXX-sw-iba1.domain.com@@oracle_ibswitch@@Lifecycle Status@@Production"

# Oracle Engineered System PDU
./emcli set_target_property_value -subseparator="@@" -property_records="lax1-XXXX-sw-pdua01.domain.com@@oracle_exa_pdu@@Lifecycle Status@@Production"

# Listener
./emcli set_target_property_value -subseparator="@@" -property_records="LISTENER_lax1-XXXX-dbadm01.domain.com@@oracle_listener@@Lifecycle Status@@Production"

# Oracle Home
./emcli set_target_property_value -subseparator="@@" -property_records="OraDb11g_home1_2_lax1-XXXX-dbadm01.domain.com@@oracle_home@@Lifecycle Status@@Production"

# Database System
./emcli set_target_property_value -subseparator="@@" -property_records="usXXXX_lax1-XXXX_sys@@oracle_dbsys@@Lifecycle Status@@Production"

# Oracle Engineered System Healthchecks
./emcli set_target_property_value -subseparator="@@" -property_records="lax1-XXXX-dbadm01.domain.com@@oracle_exadata_hc@@Lifecycle Status@@Production"
Cost Center
# Cluster ASM
./emcli set_target_property_value -subseparator="@@" -property_records="+ASM_lax1-XXXX:osm_cluster:Cost Center:BLAH"

# Automatic Storage Management
./emcli set_target_property_value -subseparator="@@" -property_records="+ASM1_lax1-XXXX-dbadm01.domain.com:osm_instance:Cost Center:BLAH"

# Oracle Database Exadata Storage Server System
./emcli set_target_property_value -subseparator="@@" -property_records="usXXXX_cellsys:oracle_exadata_dbsys:Cost Center:BLAH"

# Cluster Database
./emcli set_target_property_value -subseparator="@@" -property_records="usXXXX:rac_database:Cost Center:BLAH"

# Oracle Home
./emcli set_target_property_value -subseparator="@@" -property_records="agent12c1_3_lax1-XXXX-dbadm01.domain.com:oracle_home:Cost Center:BLAH"

#Oracle High Availability Service
./emcli set_target_property_value -subseparator="@@" -property_records="has_lax1-XXXX-dbadm01.domain.com:has:Cost Center:BLAH"

# Cluster
./emcli set_target_property_value -subseparator="@@" -property_records="lax1-XXXX:cluster:Cost Center:BLAH"

# Oracle Exadata Storage Server
./emcli set_target_property_value -subseparator="@@" -property_records="lax1-XXXX-celadm01.domain.com:oracle_exadata:Cost Center:BLAH"

# Host
./emcli set_target_property_value -subseparator="@@" -property_records="lax1-XXXX-dbadm01.domain.com:host:Cost Center:BLAH"

# Agent
./emcli set_target_property_value -subseparator="@@" -property_records="lax1-XXXX-dbadm01.domain.com:3872@@oracle_emd@@Cost Center@@BLAH"

# Oracle Engineered System ILOM Server
./emcli set_target_property_value -subseparator="@@" -property_records="lax1-XXXX-dbadm01-ilom.domain.com:oracle_exa_ilom:Cost Center:BLAH"

# Oracle Engineered System Cisco Switch
./emcli set_target_property_value -subseparator="@@" -property_records="lax1-XXXX-sw-adm01.domain.com:oracle_exa_cisco_switch:Cost Center:BLAH"

# Oracle Infiniband Switch
./emcli set_target_property_value -subseparator="@@" -property_records="lax1-XXXX-sw-iba1.domain.com:oracle_ibswitch:Cost Center:BLAH"

# Oracle Engineered System PDU
./emcli set_target_property_value -subseparator="@@" -property_records="lax1-XXXX-sw-pdua01.domain.com:oracle_exa_pdu:Cost Center:BLAH"

# Listener
./emcli set_target_property_value -subseparator="@@" -property_records="LISTENER_lax1-XXXX-dbadm01.domain.com:oracle_listener:Cost Center:BLAH"

# Oracle Home
./emcli set_target_property_value -subseparator="@@" -property_records="OraDb11g_home1_2_lax1-XXXX-dbadm01.domain.com:oracle_home:Cost Center:BLAH"

# Database System
./emcli set_target_property_value -subseparator="@@" -property_records="usXXXX_lax1-XXXX_sys:oracle_dbsys:Cost Center:BLAH"

# Oracle Engineered System Healthchecks
./emcli set_target_property_value -subseparator="@@" -property_records="lax1-XXXX-dbadm01.domain.com:oracle_exadata_hc:Cost Center:BLAH"

References

https://www.krenger.ch/blog/target-types-in-oracle-em-cloud-control-12c
https://blogs.oracle.com/oem/using-em-cli-for-mass-update-of-lifecycle-status-property-value-v2
https://mjgangler.wordpress.com/2013/06/26/em12c-changing-target-properties-in-mass/
https://blog.toadworld.com/2017/04/19/using-emcli-for-mass-update-a-property-value

Brian Wong Oracle, Technology , ,

One Comment

Leave a Reply

Your email address will not be published. Required fields are marked *