Creating a New Properties File for Patching Targets

If you are creating the patch plan from scratch, then you need to create the properties file afresh, and submit this properties file as input for creating the plan. To do so, follow these steps:

  1. Select the targets that need to be patched. To do so, run the following EM CLI command:

    emcli get_targets
            [-targets="[name1:]type1;[name2:]type2;..."]
    
    For example:
    emcli get_targets -targets=oracle_emd
    
    Output:
    Displays all the Management Agent targets.
    Status ID Status Target Type Target Name

    2

    Metric collection on Error

    oracle_emd

    h1.us.example.com:5125

    2

    Metric collection on Error

    oracle_emd

    h2.us.example.com:5125

    1

    Up

    oracle_emd

    slc01nha.us.example.com:11852

    1

    Up

    oracle_emd

    slc00bng.us.example.com:1833

    1

    Up

    oracle_emd

    adc2101349.us.example.com:1832

  2. Search for the patches that you want to apply. To find the relevant patches for your plan, you either need to use the Patch ID (Basic Search), or use a combination of Release ID, Platform ID, and Product ID (Advanced Search) and drill down to the patches required. To do so, run the following EM CLI command:

    emcli search_patches
            [-swlib] 
            [-patch_name="patch_name"] 
            [-product="product id" [-include_all_products_in_family]] 
            [-release="release id"] 
            [-platform="platform id" | -language="language id"]
            [-type="patch | patchset"] 
            [-noheader]
            [-script | -xml | -format=
                                      [name:<pretty|script|csv>];
                                      [column_separator:"column_sep_string"]; 
                                      [row_separator:"row_sep_string"]; 
            ] 

    Note:

    You can search for patches in one of the following locations:

    • ARU Site

    • Software Library

    If you have internet connectivity, then you are in online mode, and by default can look for patches on the ARU site. However, if you are in offline mode, then you must ensure that the patches are already uploaded to Software Library so you can use them.

    You can perform searches in one of the following modes using EM CLI:

    • Simple Search: This mode allows you to search the ARU site or Software Library using the patch ID information.

    • Advanced Search: This mode allows you to provide a combination of key values like platform ID, Language ID, Release ID, and/or product ID to drill down to the patch that you are looking for.

    You can use the following syntax, and the corresponding examples to perform simple and advanced search using EM CLI commands:

    1. (Basic Search) To search for the patches using the Patch ID, do the following:

      emcli search_patches
              [-swlib] 
              [-patch_name="patch_name"] 
              [-product="product id" [-include_all_products_in_family]] 
              [-release="release id"] 
              [-platform="platform id" | -language="language id"]
              [-type="patch | patchset"] 
              [-noheader]
              [-script | -xml | -format=
                                        [name:<pretty|script|csv>];
                                        [column_separator:"column_sep_string"]; 
                                        [row_separator:"row_sep_string"]; 
              ] 
      Example 1: Basic Search (Online Mode)
      To search for patches on My Oracle Support using the Patch ID:
      emcli search_patches -patch_name=11993573 
      
      Output:
      11993573        Agent Plugin PATCH      Cloud Control (Agent) 12.1.0.1.0        Linux x86-64    American English        General Enterprise Manager Base Platform - Plugin
      
      Example 2: Basic Search (Offline Mode)
      To search for patches on Software Library using the patch ID:
      emcli search_patches -patch_name=11993573 -swlib -script
      
      Output:
      11993573        Agent Plugin PATCH      Cloud Control (Agent) 12.1.0.1.0        Linux x86-64    American English        General Enterprise Manager Base Platform - Plugin
      
    2. (Advanced Search) Use the Product ID, Release ID, and Plaform ID (or Language ID) to get the patch details that you want to add to the patch plan.

      Example:
      To search for patches using a combination of Product ID, Release ID, and Platform ID (obtained from the earlier steps):
      emcli search_patches -product=12383 -release=9800371121010   -platform=226
      
      Output:
      13491785        ENTERPRISE MANAGER BASE PLATFORM  - AGENT 12.1.0.1.0 BP1 (PORT) Cloud Control (Agent) 12.1.0.1.0        Linux x86-64    American English        Recommended     Enterprise Manager Base Platform13481721        WRONG ERROR MESSAGE RETURNED FROM NMO   Cloud Control (Agent) 12.1.0.1.0        Linux x86-64    American English        General Enterprise Manager Base Platform
      
  3. Create a patch-target map (stored in the properties file) using any editor, and supply information like Patch ID, Release ID, Platform ID, and Language ID. Here is a sample properties file:

    vi demo.props
    
    patch.0.patch_id=13426630
    patch.0.release_id=9800371121010
    patch.0.platform_id=2000
    patch.0.language_id=0
    patch.0.target_name=abc1.example.com:1836
    patch.0.target_type=oracle_emd
    patch.1.patch_id=13426630
    patch.1.release_id=9800371121010
    patch.1.platform_id=2000
    patch.1.language_id=0
    patch.1.target_name=abc2.us.example.com:1839
    patch.1.target_type=oracle_emd
    
  4. Run the create_patch_plan command to create the plan, and supply the newly created properties file (demo.props) as input:

    emcli create_patch_plan
            -name="name"
            -input_file=data:"file_path" 
            [-impact_other_targets="add_all | add_original_only | cancel"] 
    
    Example:
    emcli create_patch_plan -name=demo_agent -input_file=data:demo.props -impact_other_targets=add_all
    

    Note:

    If the selected target impacts other targets, then you need to add impact_other_targets with the value "add_all". For example, if one of the agents running on the NFS home is selected for patching, other agent based on the same NFS home will also be impacted while patching, so they are all required to present in the patch plan.

  5. After you have created the patch plan with all the relevant data, you can submit your patch plan in the Analyze mode to verify if the plan is deployable or not. To do so, run the follwing command:

    emcli submit_patch_plan -name=demo_agent -action=analyze
    
    Output:
    The action "analyze" is successfully submitted on the Patch Plan "demo_agent", now "analyze" is in progress.
    

    The Analyze mode facilitates the plan to perform all the validations to ensure that the plan is deployable. Only once the analysis is successful you should deploy the plan.

  6. To verify the status of the patch plan, run the following EM CLI command:

    emcli show_patch_plan -name=demo_agent -info | grep plan_status
    
    Output:
    <plan_status>CONFLICTS</plan_status>
    

    If you see any conflicts, then you must resolve them before deploying the plan. You can use the User Interface to resolve the issues, and then rerun the plan until the status is CLEAN.

  7. After a successful analysis, you can deploy the patch plan. To do so, run the following command with action deploy:

    emcli submit_patch_plan -name=agent_demo -action=deploy
    
    Output:
    The action "deploy" is successfully submitted on the Patch Plan "demo_agent", now "deploy" is in progress

  8. To verify the status of the plan, run the EM CLI command show_patch_plan as mentioned in step 6. Only when the output of the command is DEPLOY_SUCCESS, it means that the plan has been successfully deployed, and the targets mentioned in the patch plan have been patched.

    emcli show_patch_plan -name=demo_agent -info
    
    Output:
    <plan>
      <planDetails>
    <plan_id>79CAF6A6DAFCFEE6654C425632F19411</plan_id>
    <name>demo</name>
    <type>PATCH</type>
    <description/>
    <conflict_check_date>Tue Feb 21 18:04:04 PST 2012</conflict_check_date>
    <conflict_check_date_ms>1329876244000</conflict_check_date_ms>
    <is_deployable>1</is_deployable>
    <plan_status>CONFLICTS</plan_status>
    <review_status>CONFLICT_FREE</review_status>
    <created_date>Tue Feb 21 17:40:47 PST 2012</created_date>
    <created_date_ms>1329874847000</created_date_ms>
    <created_by>SYSMAN</created_by>
    <last_updated_date>Tue Feb 21 17:58:29 PST 2012</last_updated_date>
    <last_updated_date_ms>1329875909000</last_updated_date_ms>
    <last_updated_by>SYSMAN</last_updated_by>
    <grant_priv>yes</grant_priv>
    <user_plan_privilege>FULL</user_plan_privilege>
    <see_all_targets>N</see_all_targets>
    <homogeneousGroupLabel>Database Instance 10.2.0.1.0 (Linux x86-64)</homogeneousGroupLabel>
    <executeGuid/>
    <executeUrl/>
    <planDetails/>
    
  9. To get the details of the patching procedure/job that you submitted, use the GUID of the execution in the command get_job_execution_details as follows:

     emcli get_job_execution_detail
            -execution={execution_id}
            [-xml  [-showOutput [-tailLength={length}]]]
    
    For Example:
    emcli get_job_execution_detail -execution=79CAF6A6DAFCFEE6654C425632F19411 -xml