Create a Gold Image Using EMCLI

You can create Gold Images using EMCLI

To begin creating Gold Images using EMCLI, you will need to use the db_software_maintenance verb, see the following example:
emcli db_software_maintenance -createSoftwareImage -input_file="data:/tmp/create_gldimg.properties"

Where the create_gldimg.properties input file contains the variables explained below. For a complete description of input variables for db_software_maintenance family of verbs, see db_software_maintenance in the Enterprise Manager Command Line Reference Guide.

Description of the Input Variables

The input variables are described below:
  • IMAGE_NAME: The name of the Gold Image. This name must be unique across images.
  • IMAGE_DESCRIPTION: A description of the image.
  • REF_TARGET_NAME: The Oracle home target that will be used to create this Gold Image. This is the Database or Grid Infrastructure Oracle Home from the existing environment on which the desired set of patches have been applied. For example, if we intend to patch our 18c Fleet of databases with the latest Release Update (RU), we need to specify the Oracle Home target name for a reference Oracle Home where 18c RU has already been applied. To find the reference target name, enter the following query on the Enterprise Manager repository:
    SELECT distinct target_name FROM mgmt$target_properties WHERE target_name IN
    SELECT target_name FROM mgmt_targets WHERE target_type='oracle_home' AND host_name=<Host Name of this Oracle Home> 
    AND property_name='INSTALL_LOCATION' AND property_value=<path of Oracle Home>
  • IMAGE_SWLIB_LOC: Path in software library where the payload of the Gold Image will be stored.
  • REF_HOST_CREDENTIALS: This is applicable for Database Gold Image only. This must be entered in the format <Named Credential: Credential Owner> where:
    • <Named Credential>: Is the named credentials for the host on which the reference Oracle Home is located. This user must be the owner of Oracle home.
    • <Credential Owner>: Is the Enterprise Manager user who owns this Named Credential.

      Note:

      The REF_HOST_CREDENTIALS parameter is applicable for database gold images only. For Grid Infrastructure or Oracle Restart Homes, this parameter is listed as REF_GI_CREDENTIALS.
  • workingDirectory: The temporary location on the host of reference Oracle home target.
  • STORAGE_TYPE_FOR_SWLIB: The Software Library storage type. This can be OMS Shared, OMS Agent File system, or NFS (

    Note:

    NFS is available for Enterprise Manager deployments 13.5 Release Update 13 (13.5.0.13) and higher.
  • STORAGE_NAME_FOR_SWLIB: The storage name for the Software Library.
    To retrieve the storage name: from the Enterprise menu,
    1. From the Enterprise menu select Provisioning and Patching, then select Software Library.
    2. In the Software Library page, from the Actions menu select Administration.
    3. Check the value in the Name column, this is the storage name for the Software Library.
  • NFS_LOCAL_MOUNT: The absolute path for the NFS local mount, if this parameter is not specified the workingDirectory location will be used as default instead.

    NFS is available for Enterprise Manager deployments 13.5 Release Update 13 (13.5.0.13) and higher.

    Tip:

    This field is only required for NFS storage, it is not required for OMS Storage options.
  • VERSION_NAME: An image can have multiple versions. A default version of the image is created and more versions can be added.

Sample Output

The following output is displayed:
'Create Gold Image Profile deployment procedure has been submitted successfully with the instance name: 'CreateGoldImageProfile_TESTSUPERADMIN_12_08_2015_05_09_AM' and execution_guid='25F92D9A00164A45E053D903C40A9B4B

The operation is performed using a deployment procedure, and user needs to wait for its completion before performing next steps. Status of the Gold Image creation can be checked using the following command:

emcli get_instance_status -exec=25F92D9A00164A45E053D903C40'

Creating Gold Images by Patching Oracle Homes

You can also create Gold Images by patching Oracle Homes. Once the patch list is identified and downloaded, you as administrator can create a Gold Image version of the in one of the following scenarios:
  1. Create a new version from an existing deployment. As the administrator you have an existing test environment in which has deployed all the required patches. You point to a prepared Oracle home that contains all desired patches, and copies them into a new Gold Image Oracle Home.
    To begin, point to a prepared Oracle home that contains all desired patches:
    emcli db_software_maintenance -createSoftwareImage -input_file="data:/home/user/input_file"
    In this use case input_file must contain the following:
    IMAGE_ID=<ID of existing Gold Image in which a new version is to be created>
    REF_TARGET_NAME=<ORACLE_HOME source target>
    IMAGE_SWLIB_LOC=<Image Location>
    REF_HOST_CREDENTIALS=USER:TESTSUPERADMIN 
    workingDirectory=/u01/tmp
    DESTN_SAME_AS_SRC=<True/False>
    STORAGE_TYPE_FOR_SWLIB=OmsShared
    STORAGE_NAME_FOR_SWLIB=swlib
    PATCH_LIST=<List of patches to deploy, comma separated>
    VERSION_NAME=Version1
  2. In this use case, you as the administrator do not want to the modify the test environment. For this use case you will have to clone the home, apply patches and then create a Gold Image. The original test environment home is NOT modified. In this use case, the task is to clone the test environment, apply the patches and then create the Gold Image.
    To begin, point to a prepared Oracle home that contains all desired patches:
    emcli db_software_maintenance -createSoftwareImage -input_file="data:/home/user/input_file"
    For this use case two examples for the input_file will be given, one for RAC and one for GRID:
    • Input file for cloning, patching and creating Gold Image for a RAC home :
      IMAGE_NAME=<Unique name to identify operation>
      IMAGE_DESCRIPTION=<Description of image>
      REF_TARGET_NAME=<Oracle_Home source target>
      IMAGE_SWLIB_LOC=<Image Location>
      REF_HOST_CREDENTIALS=USER:TESTSUPERADMIN 
      REF_HOST_ROOT_CREDENTIALS=USER_ROOT:TESTSUPERADMIN 
      workingDirectory=/u01/tmp
      STORAGE_TYPE_FOR_SWLIB=OmsShared
      STORAGE_NAME_FOR_SWLIB=sl
      VERSION_NAME=<Patch version name>
      PATCH_LIST=<List of patches to deploy, comma separated>
      DESTN_HOME_LOCATION=<Location of the destination Oracle Home target>
    • Input file for cloning, patching and creating Gold Image for a GRID Home:
      IMAGE_NAME=<Unique name to identify operation>
      IMAGE_DESCRIPTION=<Description of image>
      REF_TARGET_NAME=<Oracle_Home source target>
      REF_GI_CREDENTIALS=USER:TESTSUPERADMIN
      IMAGE_SWLIB_LOC=<Image Location>
      REF_HOST_CREDENTIALS=USER:TESTSUPERADMIN
      REF_HOST_ROOT_CREDENTIALS=USER_ROOT:TESTSUPERADMIN
      workingDirectory=/u01/tmp
      STORAGE_TYPE_FOR_SWLIB=OmsShared
      STORAGE_NAME_FOR_SWLIB=sl
      VERSION_NAME=<Patch version name>
      DESTN_HOME_LOCATION=<Location of the destination Oracle Home target>
      PATCH_LIST=<List of patches to deploy, comma separated>
  3. Modify the test environment itself. In this case, you as the administrator will have to apply patches to specified home and then create the Gold Image.
    To begin, point to an Oracle home that will be patched with the new patches to create the new Gold Image
    emcli db_software_maintenance -createSoftwareImage -input_file="data:/home/user/input_file"
    Input file where both source and destination will be modified:
    IMAGE_NAME=<Unique name to identify operation>
    IMAGE_DESCRIPTION=<Description of image>
    REF_TARGET_NAME=<Oracle_Home source target>
    IMAGE_SWLIB_LOC=<Image Location>
    REF_HOST_CREDENTIALS=USER:TESTSUPERADMIN
    REF_HOST_ROOT_CREDENTIALS=USER_ROOT:TESTSUPERADMIN
    workingDirectory=/u01/tmp
    STORAGE_TYPE_FOR_SWLIB=OmsShared
    STORAGE_NAME_FOR_SWLIB=sl
    VERSION_NAME=<Patch version name>
    PATCH_LIST=<List of patches to deploy, comma separated>
    DESTN_SAME_AS_SRC=true
  4. Enterprise Manager deployments that have no exclusive Stage or Test environments. In this use case you will deploy the CURRENT (default) version of the image, apply patches and then create a Gold Image.
    To begin, point to a prepared Oracle home that contains all desired patches:
    emcli db_software_maintenance -createSoftwareImage -input_file="data:/home/user/input_file"
    Input file sample for a no test environment use case:
    IMAGE_ID=<ID of existing Gold Image in which a new version is to be created>
    DESTN_HOME_LOCATION=<Location of the destination Oracle Home target>
    DESTN_HOST=<host target name> 
    DISPATCHER_LOCATION=<Dispatch location of the scripts>                         
    SKIP_PREREQUISITE_CHECKS=<true/false>
    SKIP_CVU_CHECK=<true/false>                                            
    REF_HOST_CREDENTIALS=USER:SUPERADMIN
    workingDirectory=/u01/tmp
    IMAGE_SWLIB_LOC=<Image Location>
    STORAGE_TYPE_FOR_SWLIB=OmsShared
    STORAGE_NAME_FOR_SWLIB=swlib
    VERSION_NAME=<Patch version name>
    PATCH_LIST=<List of patches to deploy, comma separated>