Typically, Oracle Homes are discovered and promoted as targets automatically along with guided flows for addition of primary targets like databases, weblogic domains, etc, but there might be instances (not very often) where you need to discover the Homes standalone.
There are two ways to do this – from the GUI and using EMCLI verbs
A. From GUI
The steps are as follows:
- Goto Enterprise->Job->Activity menu item
- Here select the job type ‘Discover Promote Oracle Home Target’ and click Go
- Provide the obvious inputs like name, list of hosts, etc, but the most important tab is that of ‘Parameters’. Here you are required to provide 3 inputs:
- Path to Oracle Home/Inventory/Composite Home/Middleware Home you want to manage
- The type of entity you want to manage. Your options are – Oracle Home, Inventory, Composite Home, or Middleware Home
- The action – discover and promote, or just discover [I almost always select the former]
That’s it. All remaining tabs are optional. Once the job is submitted, it usually takes a few seconds to complete. The output of the job clearly lists all the Oracle Homes discovered and the target names created for these Homes in EM.
B. Using EMCLI
1. First we describe the job type to get the list of required inputs
./emcli describe_job_type -job_type=discoverPromoteOHTargets > inputs.prop
If the explanation of the required fields is not sufficient, you can additionally pass the -verbose flag to get more details.
Now update the inputs.prop file with the relevant values. My file looks like this (changed values in red):
# Description: (Optional) The user specified name of the job name=promote_OH # Description: (Optional) The job type for this job type=discoverPromoteOHTargets # Description: (Optional) The user specified description of the job description= # Description: The job owner. The job owner is the user who creates the job. # Default: the logged in user # The job owner information displayed here is for documentation only # and user is not expected to change it. owner= # Description: (Optional) The kind of job # Legal Values: active, library kind=active # Fill in the target list before submitting. # For Example: # target_list=MyTarget:cluster target_list=abc.example.com:host # Description: The type of targets to use for this job targetType=host # Description: (Required) Enter the action you want to perform. # To run only discovery on the target, use : disc.To run discovery # and promotion on target to managed status, use : promote variable.loc_action=promote # Description: (Required) Enter the type of search to be performed. # All the homes in the Inventory/Middleware Home will be managed. # For discovering Oracle Home, use : oh.For discovering Oracle Home's # in inventory , use : inv.For discovering Oracle Home's in # middleware home, use : mwh variable.loc_type=inv # Description: (Optional) Enter Path to Oracle Home/Inventory/ # Composite Home/Middleware Home you want to manage. variable.location=/u01/foo/oraInventory # Description: (Optional) Notify the job owner when a selected state occurs # Allowed Values: SCHEDULED, RUNNING, ACTION_REQUIRED, SUSPENDED, SUCCEEDED, PROBLEMS notification=
Note, i submit my job against a single host target, but you can provide a long comma separated list of <target_name>:<target_type>. Now we submit the job by passing the above inputs.prop file as input.
emcli create_job -input_file=property_file:inputs.prop Creation of job "PROMOTE_OH" was successful.
Since the EM12c job system is asynchronous, the emcli verb will submit the job and return control almost instantly. We need to run different set of emcli verbs to get job progress.
emcli get_jobs -name=PROMOTE_OH Name Type Job ID Execution ID Scheduled Completed TZ Offset Status Status ID Owner Target Type Target Name PROMOTE_OH discoverPromoteOHTargets 10FBD71FF8C70205E050F00A07B46726 10FBD71FF8C90205E050F00A07B46726 2015-03-10 22:34:33 2015-03-10 22:34:37 GMT-07:00 Succeeded 5 SYSMAN host abc.example.com
The output is ill formatted, but the only 2 fields we care about are – Execution ID and the Status. Since this is a fairly quick job, the status is shown as Succeeded. If i wanted to view the output, i would run another emcli command, and for this we need the execution ID.
emcli get_job_execution_detail -execution=10FBD71FF8C90205E050F00A07B46726 -xml -showOutput <?xml version = '1.0' encoding = 'UTF-8'?> <jobExecution jobOwner="SYSMAN" status="5" startTime="2015-03-11 05:34:34.0" id="10FBD71FF8C90205E05 0F00A07B46726" jobName="PROMOTE_OH" statusBucket="-5"> <TargetList> <target name="abc.example.com" type="host" hostName="abc.example.com"/> </TargetList> <steps> <step command="DiscoverAndPromoteOH" status="5" name="RunCustomDiscovery" startTime="2015.03.1 0 22:34:34" endTime="2015.03.10 22:34:37" timezoneRegion="-07:00" stepId="825682" stepType="1" jobTy pe="discoverPromoteOHTargets" stepNlsId="discoverPromoteOHTargets_RunCustomDiscovery" stepDefaultNam e="RunCustomDiscovery" target=""> <stepOutput> <output>Discovered Oracle Home Target 'OraDB12Home1_11_abc.example.com' with home location - /u01/db12/product/12.1.0/dbhome_1 in Inventory /u01/foo/oraInventory. Successfully created 1 new Oracle Home Targets. Succesfully added discovered homes matching given criteria.</output> </stepOutput> </step> </steps> </jobExecution>
The output clearly states the outcome of the job, and if i check my all targets page, i will find the new Oracle Home target.
In summary, while there may not be many reasons to just discover and promote standalone Oracle Homes, if you ever need to do it, this blog tells you how to do it both via the GUI and EMCLI.