{"id":1724,"date":"2018-05-30T14:28:15","date_gmt":"2018-05-30T12:28:15","guid":{"rendered":"http:\/\/www.ludovicocaldara.net\/dba\/?p=1724"},"modified":"2020-08-18T16:08:37","modified_gmt":"2020-08-18T14:08:37","slug":"oh-mgmt-7","status":"publish","type":"post","link":"https:\/\/www.ludovicocaldara.net\/dba\/oh-mgmt-7\/","title":{"rendered":"Oracle Home Management &#8211; part 7: Putting all together"},"content":{"rendered":"<p>Last part of the blog series&#8230; let&#8217;s see how to put everything together and have a single script that creates and provisions Oracle Home golden images:<\/p>\n<p><strong>Review of the points<\/strong><\/p>\n<p>The scripts will:<\/p>\n<ul>\n<li>let create a golden image based on the current Oracle Home<\/li>\n<li>save the golden image metadata into a repository (an Oracle schema somewhere)<\/li>\n<li>list the avilable golden images and display whether they are already deployed on the current host<\/li>\n<li>let provision an image locally (pull, not push), either with the default name or a new name<\/li>\n<\/ul>\n<p>Todo:<\/p>\n<ul>\n<li>Run as root in order to run root.sh automatically (or let specify the sudo command or a root password)<\/li>\n<li>Manage Grid Infrastructure homes<\/li>\n<\/ul>\n<p><strong>Assumptions<\/strong><\/p>\n<ul>\n<li>There is an available Oracle schema where the golden image metadata will be stored<\/li>\n<li>There is an available NFS share that contains the working copies and golden images<\/li>\n<li>Some variables must be set accordingly to the environment in the script<\/li>\n<li>The <a href=\"https:\/\/www.ludovicocaldara.net\/dba\/oh-mgmt-5\/\">function setoh <\/a>is defined in the environment (it might be copied inside the script)<\/li>\n<li>The Instant Client is installed and &#8220;setoh ic&#8221; correctly sets its environment. This is required because there might be no sqlplus binaries available at the very first deploy<\/li>\n<li>Oracle Home name and path&#8217;s basename are equal for all the Oracle Homes<\/li>\n<\/ul>\n<p><strong>Repository table<\/strong><\/p>\n<p>First we need a metadata table. Let&#8217;s keep it as simple as possible:<\/p>\n<pre class=\"lang:plsql decode:true\">CREATE TABLE \"OH_GOLDEN_IMAGES\"  (\r\n     NAME VARCHAR2(50 BYTE)\r\n   , FULLPATH VARCHAR2(200 BYTE)\r\n   , CREATED TIMESTAMP (6)\r\n   , CONSTRAINT PK_OH_GOLDEN_IMAGES PRIMARY KEY (NAME)\r\n);<\/pre>\n<p><strong>Helpers<\/strong><\/p>\n<p>The script has some functions that check stuff inside the central inventory.<\/p>\n<p>e.g.<\/p>\n<pre class=\"lang:sh decode:true \">F_OH_Installed () {\r\n        CENTRAL_ORAINV=`grep ^inventory_loc \/etc\/oraInst.loc | awk -F= '{print $2}'`\r\n        grep \"&lt;HOME NAME=\\\"$1\\\"\" $CENTRAL_ORAINV\/ContentsXML\/inventory.xml | grep -v \"REMOVED=\\\"T\\\"\" &gt;\/dev\/null\r\n        if [ $? -eq 0 ] ; then\r\n                echo -e \"${colgrn}Installed${colrst}\"\r\n        else\r\n                echo \"Not installed\"\r\n        fi\r\n}<\/pre>\n<p>checks if a specific Oracle Home (name) is present in the central inventory. It is helpful to check, for every golden image in the matadata repository, if it is already provisioned or not:<\/p>\n<pre class=\"lang:sh decode:true\">F_list_OH () {\r\n \r\n        F_colordef\r\n        echo\r\n        echo \"Listing existing golden images:\"\r\n \r\n        RESULT=`$SQLPLUS -S -L ${REPO_CREDENTIALS} &lt;&lt;EOF  | grep \";\"\r\n        set line 200 pages 1000\r\n        set feed off head off\r\n        col name format a32\r\n        alter session set nls_timestamp_format='YYYY-MM-DD';\r\n        select name||';'||created||';'||fullpath from oh_golden_images order by created desc;\r\nEOF\r\n`\r\n        echo\r\n        printf \"%-35s %-10s %-18s\\n\" \"OH_Name\" \"Created\" \"Installed locally?\"\r\n        echo \"----------------------------------- ---------- ------------------\"\r\n \r\n        for line in $RESULT ; do\r\n                L_GI_Name=`echo $line | awk -F\\; '{print $1}'`\r\n                L_GI_Date=`echo $line | awk -F\\; '{print $2}'`\r\n                L_GI_Path=`echo $line | awk -F\\; '{print $3}'`\r\n                L_Installed=`F_OH_Installed \"$L_GI_Name\"`\r\n                printf \"%-35s %-10s %-18s\\n\" \"$L_GI_Name\" \"$L_GI_Date\" \"$L_Installed\"\r\n        done\r\n}<\/pre>\n<p><strong>Variables<\/strong><\/p>\n<p>Some variables must be changed, but in general you might want to adapt the whole script to fit your needs.<\/p>\n<pre class=\"lang:sh decode:true \">REPO_OWNER=scott\r\nREPO_PWD=tiger\r\nREPO_CONN=\"\/\/localhost:1521\/ORCL\"\r\nREPO_CREDENTIALS=${REPO_OWNER}\/${REPO_PWD}@${REPO_CONN}\r\n \r\nPRODUCT_INSTALL_PATH=\"\/u01\/app\/oracle\/product\"\r\nGOLDEN_IMAGE_DEST=\"\/share\/oracle\/oh_repository\/golden_images\"\r\nWORKING_COPY_DEST=\"\/share\/oracle\/oh_repository\/working_copies\"<\/pre>\n<p><strong>Image creation<\/strong><\/p>\n<p>The image creation would be as easy as creating a zip file, but there are some files that we do not want to include in the golden image, therefore we need to create a staging directory (working copy) to clean up everything:<\/p>\n<pre class=\"lang:sh decode:true \">        # Copy to NFS working copy\r\n        echo \"Cleaning previous working copy\"\r\n        WC=$WORKING_COPY_DEST\/$L_New_Name\r\n        [ -d $WC ] &amp;&amp; rm -rf $WC\r\n \r\n        echo \"Copying the OH to the working copy\"\r\n        mkdir -p  $WC\r\n        cp -rp $ORACLE_HOME\/* $WC\/ 2&gt;\/tmp\/ohctl.err\r\n \r\n        # Cleanup files\r\n        echo \"Cleansing files in Working Copy\"\r\n        rm -rf $WC\/log\/$HOSTNAME\r\n        rm -rf $WC\/log\/diag\/rdbms\/*\r\n        rm -rf $WC\/gpnp\/$HOSTNAME\r\n        find $WC\/gpnp -type f -exec rm {} \\; 2&gt;\/dev\/null\r\n        rm -rf $WC\/cfgtoollogs\/*\r\n        rm -rf $WC\/crs\/init\/*\r\n        rm -rf $WC\/cdata\/*\r\n        rm -rf $WC\/crf\/*\r\n        rm -rf $WC\/admin\/*\r\n        rm -rf $WC\/network\/admin\/*.ora\r\n        rm -rf $WC\/crs\/install\/crsconfig_params\r\n        find $WC -name '*.ouibak' -exec rm {} \\; 2&gt;\/dev\/null\r\n        find $WC -name '*.ouibak.1' -exec rm {} \\; 2&gt;\/dev\/null\r\n        # rm -rf $WC\/root.sh\r\n        find $WC\/rdbms\/audit -name '*.aud' -exec rm {} \\; 2&gt;\/dev\/null\r\n        rm -rf $WC\/rdbms\/log\/*\r\n        rm -rf $WC\/inventory\/backup\/*\r\n        rm -rf $WC\/dbs\/*\r\n \r\n        # create zip\r\n        echo \"Creating the Golden Image zip file\"\r\n        [ -f $GOLDEN_IMAGE_DEST\/$L_New_Name.zip ] &amp;&amp; rm $GOLDEN_IMAGE_DEST\/$L_New_Name.zip\r\n        pushd $WC\r\n        zip -r $GOLDEN_IMAGE_DEST\/$L_New_Name.zip . &gt;\/dev\/null\r\n        popd $OLDPWD<\/pre>\n<p><strong>Home provisioning<\/strong><\/p>\n<p>Home provisioning requires, beside some checks, a <em>runInstaller -clone <\/em>command, eventually a relink, eventually a setasmgid, eventually some other tasks, but definitely\u00a0 run root.sh. This last task is not automated yet in my deployment script.<\/p>\n<pre class=\"lang:sh decode:true \">        # ... some checks ...\r\n        # if no new OH name specified, get the golden image name\r\n        ...\r\n        # - check if image to install exists\r\n        ...\r\n        # - check if OH name to install is not already installed\r\n        ...\r\n        # - check if the zip exists\r\n        ...\r\n        # - check if the destination directory exist\r\n        ...\r\n\r\n        L_Clone_Command=\"$RUNINST -clone -waitForCompletion -silent ORACLE_HOME=$ORACLE_HOME ORACLE_BASE=$ORACLE_BASE ORACLE_HOME_NAME=$L_New_Name\"\r\n \r\n        echo $L_Clone_Command\r\n        $L_Clone_Command\r\n \r\n        if [ $? -eq 0 ] ; then\r\n                echo \"Clone command completed successfully.\"\r\n        else\r\n                echo \"There was a problem during the clone command. The script will exit.\"\r\n                exit 1\r\n        fi\r\n \r\n        if [ \"${L_Link_RAC}\" == \"yes\" ] ; then\r\n                pushd $ORACLE_HOME\/rdbms\/lib\r\n                make -f ins_rdbms.mk rac_on\r\n                make -f ins_rdbms.mk ioracle\r\n                popd\r\n        fi\r\n \r\n        # - run setasmgid\r\n        if [ -x \/etc\/oracle\/setasmgid ] ; then\r\n                echo \"setasmgid found: running it on Oracle binary\"\r\n                \/etc\/oracle\/setasmgid oracle_binary_path=$ORACLE_HOME\/bin\/oracle\r\n        else\r\n                echo \"setasmgid not found: ignoring\"\r\n        fi\r\n \r\n        # - create symlinks for ldap, sqlnet and tnsnames.ora\r\n        TNS_ADMIN=${TNS_ADMIN:-\/var\/opt\/oracle}\r\n        ln -s $TNS_ADMIN\/sqlnet.ora   $ORACLE_HOME\/network\/admin\/sqlnet.ora\r\n        ln -s $TNS_ADMIN\/tnsnames.ora $ORACLE_HOME\/network\/admin\/tnsnames.ora\r\n        ln -s $TNS_ADMIN\/ldap.ora     $ORACLE_HOME\/network\/admin\/ldap.ora\r\n \r\n# ... other checks ...<\/pre>\n<p>&nbsp;<\/p>\n<p><strong>Usage<\/strong><\/p>\n<pre class=\"lang:sh highlight:0 decode:true\">Purpose : Management of Golden Images (Oracle Homes)\r\n \r\n        Usage   : To list the available images:\r\n                    ohctl -l\r\n                  To install an image on the localhost:\r\n                    ohctl -i goldenimage [-n newname] [-r]\r\n                  To create an image based on the current OH:\r\n                    ohctl -c [-n newname] [ -f ]\r\n                  To remove a golden image from the repository:\r\n                    ohctl -d goldenimage [ -f ]\r\n \r\n        Options : -l                    List the available Oracle Homes in the golden image repository\r\n                  -i goldenimage        Installs locally the specified golden image. (If already deployed, an error is thrown)\r\n                                        if the option -l is given, the list action has the priority over the deploy.\r\n                  -n newname            Specify a new name for the Oracle Home: use it in case you need to patch\r\n                                        and create a new Golden Image from it or if you want to change the Golden Image name\r\n                                        for the current Oracle Home you are converting to Image.\r\n                                        When creating a new Image (-c), it takes the basename of the OH by default, and not the\r\n                                        OHname inside the inventory.\r\n                  -c                    Creates a new Golden Image from the current Oracle Home.\r\n                  -d goldenimage        Removes the golden image from the repository\r\n                  -f                    If the Golden Image to be created exists, force the overwrite.\r\n                  -r                    Relink with RAC option (install only)\r\n \r\n        Example : ohctl -i DB12_1_0_2_BP170718_home1 -n DB12_1_0_2_BP171018_home1\r\n                                        installs the Oracle Home DB12_1_0_2_BP170718_home1 with new name DB12_1_0_2_BP171018_home1\r\n                                        in order to apply the Bundle Patch 171018 on it\r\n \r\n                  ohctl -i DB12_1_0_2_BP170718_home1\r\n                                        installs the Oracle Home DB12_1_0_2_BP170718_home1 for normal usage\r\n \r\n                  ohctl -c -n DB12_1_0_2_BP180116\r\n                                        Creates a new Golden Image named DB12_1_0_2_BP180116 from the current ORACLE_HOME\r\n \r\n                  ohctl -c -f\r\n                                        Creates a new Golden Image with the name of the current OH basename, overwriting\r\n                                        the eventual existing image.\r\n                                        E.g. if the current OH is \/ccv\/app\/oracle\/product\/DB12_1_0_2_BP180116, the new GI name\r\n                                         will be \"DB12_1_0_2_BP180116\"<\/pre>\n<p><strong>Examples<\/strong><\/p>\n<p>List installed homes:<\/p>\n<pre class=\"lang:sh highlight:0 decode:true\"># [ oracle@myserver:\/u01\/app\/oracle\/scripts [17:43:04] [12.1.0.2.0 SID=GRID] 0 ] #\r\n# lsoh\r\n\r\nHOME                        LOCATION                                                VERSION      EDITION\r\n--------------------------- ------------------------------------------------------- ------------ ---------\r\nOraGI12Home1                \/u01\/app\/grid\/product\/grid                              12.1.0.2.0   GRID\r\nOraDB12Home1                \/u01\/app\/oracle\/product\/12.1.0.2                        12.1.0.2.0   DBMS EE\r\nagent12c1                   \/u01\/app\/oracle\/product\/agent12c\/core\/12.1.0.5.0        12.1.0.5.0   AGT\r\nOraDb11g_home1              \/u01\/app\/oracle\/product\/11.2.0.4                        11.2.0.4.0   DBMS EE\r\nOraDB12Home2                \/u01\/app\/oracle\/product\/12.1.0.2_BP170718               12.1.0.2.0   DBMS EE<\/pre>\n<p>Create a golden image 12_1_0_2_BP170718 from the Oracle Home named OraDB12Home2 (tha latter having been installed manually without naming convention):<\/p>\n<pre class=\"lang:sh highlight:0 decode:true\"># [ oracle@myserver:\/u01\/app\/oracle\/scripts [17:43:07] [12.1.0.2.0 SID=GRID] 0 ] #\r\n# setoh OraDB12Home2\r\n\r\n# [ oracle@myserver:\/u01\/app\/oracle\/scripts [17:43:04] [12.1.0.2.0 SID=GRID] 0 ] #\r\n# ohctl -c -n 12_1_0_2_BP170718 -f\r\nImage 12_1_0_2_BP170718 already exists but -f specified. The script will continue.\r\n\r\n\r\nCreating the new Golden Image 12_1_0_2_BP170718\r\n\r\nCleaning previous working copy\r\nCopying the OH to the working copy\r\nCleansing files in Working Copy\r\nCreating the Golden Image zip file\r\n\r\n# [ oracle@myserver:\/u01\/app\/oracle\/scripts [17:52:09] [12.1.0.2.0 SID=GRID] 0 ] #\r\n#<\/pre>\n<p>List the new golden image from the metadata repository:<\/p>\n<pre class=\"lang:sh highlight:0 decode:true\"># [ oracle@myserver:\/u01\/app\/oracle\/scripts [17:57:46] [12.1.0.2.0 SID=GRID] 0 ] #\r\n# ohctl -l\r\n\r\nListing existing golden images:\r\n\r\nOH_Name                             Created    Installed locally?\r\n----------------------------------- ---------- ------------------\r\n12_1_0_2_BP170718                   2018-02-06 Not installed<\/pre>\n<p>Reinstalling the same home with the new naming convention:<\/p>\n<pre class=\"lang:sh highlight:0 decode:true \"># ohctl -i 12_1_0_2_BP170718\r\nOK, the image exists.\r\nZip file exists.\r\nThe unzip completed successfully.\r\n\/u01\/app\/oracle\/product\/12_1_0_2_BP170718\/oui\/bin\/runInstaller -clone -waitForCompletion -silent ORACLE_HOME=\/u01\/app\/oracle\/product\/12_1_0_2_BP170718 ORACLE_BASE=\/u01\/app\/oracle ORACLE_HOME_NAME=12_1_0_2_BP170718\r\nStarting Oracle Universal Installer...\r\n\r\nChecking swap space: must be greater than 500 MB.   Actual 16383 MB    Passed\r\nPreparing to launch Oracle Universal Installer from \/tmp\/OraInstall2018-02-06_06-04-33PM. Please wait ...Oracle Universal Installer, Version 12.1.0.2.0 Production\r\nCopyright (C) 1999, 2014, Oracle. All rights reserved.\r\n\r\nYou can find the log of this install session at:\r\n \/u01\/app\/oracle\/oraInventory\/logs\/cloneActions2018-02-06_06-04-33PM.log\r\n.................................................................................................... 100% Done.\r\n\r\n\r\n\r\nInstallation in progress (Tuesday, February 6, 2018 6:04:41 PM CET)\r\n................................................................................                                                80% Done.\r\nInstall successful\r\n\r\nLinking in progress (Tuesday, February 6, 2018 6:04:44 PM CET)\r\n.                                                                81% Done.\r\nLink successful\r\n\r\nSetup in progress (Tuesday, February 6, 2018 6:05:01 PM CET)\r\n..........                                                      100% Done.\r\nSetup successful\r\n\r\nSaving inventory (Tuesday, February 6, 2018 6:05:01 PM CET)\r\nSaving inventory complete\r\nConfiguration complete\r\n\r\nEnd of install phases.(Tuesday, February 6, 2018 6:05:22 PM CET)\r\nWARNING:\r\nThe following configuration scripts need to be executed as the \"root\" user.\r\n\/u01\/app\/oracle\/product\/12_1_0_2_BP170718\/root.sh\r\nTo execute the configuration scripts:\r\n    1. Open a terminal window\r\n    2. Log in as \"root\"\r\n    3. Run the scripts\r\n\r\nThe cloning of 12_1_0_2_BP170718 was successful.\r\nPlease check '\/u01\/app\/oracle\/oraInventory\/logs\/cloneActions2018-02-06_06-04-33PM.log' for more details.\r\nClone command completed successfully.\r\nsetasmgid found: running it on Oracle binary\r\nThe image 12_1_0_2_BP170718 has been installed and exists in the inventory.\r\n\r\nInstallation completed. Please run \/u01\/app\/oracle\/product\/12_1_0_2_BP170718\/root.sh as root before using the new home.\r\n\r\n# [ oracle@myserver:\/u01\/app\/oracle\/scripts [18:05:24] [12.1.0.2.0 SID=GRID] 0 ] #\r\n#\r\n\r\n# and manually...\r\n-bash-4.2$ sudo \/u01\/app\/oracle\/product\/12_1_0_2_BP170718\/root.sh\r\nCheck \/u01\/app\/oracle\/product\/12_1_0_2_BP170718\/install\/root_myserver_2018-02-06_18-06-07.log for the output of root script<\/pre>\n<p>Installing the same home in a new path for manual patching from 170718 to 180116:<\/p>\n<pre class=\"lang:sh highlight:0 decode:true\"># [ oracle@myserver:\/u01\/app\/oracle\/scripts [12:48:36] [12.1.0.2.0 SID=GRID] 0 ] #\r\n# ohctl -i 12_1_0_2_BP170718 -n 12_1_0_2_BP180116\r\nOK, the image exists.\r\nZip file exists.\r\nThe unzip completed successfully.\r\n\/u01\/app\/oracle\/product\/12_1_0_2_BP180116\/oui\/bin\/runInstaller -clone -waitForCompletion -silent ORACLE_HOME=\/u01\/a                                           pp\/oracle\/product\/12_1_0_2_BP180116 ORACLE_BASE=\/u01\/app\/oracle ORACLE_HOME_NAME=12_1_0_2_BP180116\r\nStarting Oracle Universal Installer...\r\n\r\nChecking swap space: must be greater than 500 MB.   Actual 16383 MB    Passed\r\nPreparing to launch Oracle Universal Installer from \/tmp\/OraInstall2018-02-07_12-49-50PM. Please wait ...Oracle Univers                                           al Installer, Version 12.1.0.2.0 Production\r\nCopyright (C) 1999, 2014, Oracle. All rights reserved.\r\n\r\nYou can find the log of this install session at:\r\n \/u01\/app\/oracle\/oraInventory\/logs\/cloneActions2018-02-07_12-49-50PM.log\r\n.................................................................................................... 100% Done.\r\n\r\n\r\n\r\nInstallation in progress (Wednesday, February 7, 2018 12:49:58 PM CET)\r\n................................................................................                                                                                           80% Done.\r\nInstall successful\r\n\r\nLinking in progress (Wednesday, February 7, 2018 12:50:00 PM CET)\r\n.                                                                81% Done.\r\nLink successful\r\n\r\nSetup in progress (Wednesday, February 7, 2018 12:50:17 PM CET)\r\n..........                                                      100% Done.\r\nSetup successful\r\n\r\nSaving inventory (Wednesday, February 7, 2018 12:50:17 PM CET)\r\nSaving inventory complete\r\nConfiguration complete\r\n\r\nEnd of install phases.(Wednesday, February 7, 2018 12:50:38 PM CET)\r\nWARNING:\r\nThe following configuration scripts need to be executed as the \"root\" user.\r\n\/u01\/app\/oracle\/product\/12_1_0_2_BP180116\/root.sh\r\nTo execute the configuration scripts:\r\n    1. Open a terminal window\r\n    2. Log in as \"root\"\r\n    3. Run the scripts\r\n\r\nThe cloning of 12_1_0_2_BP180116 was successful.\r\nPlease check '\/u01\/app\/oracle\/oraInventory\/logs\/cloneActions2018-02-07_12-49-50PM.log' for more details.\r\nClone command completed successfully.\r\nsetasmgid found: running it on Oracle binary\r\nThe image 12_1_0_2_BP180116 has been installed and exists in the inventory.\r\n\r\nInstallation completed. Please run \/u01\/app\/oracle\/product\/12_1_0_2_BP180116\/root.sh as root before using the new home.<\/pre>\n<p>New home situation:<\/p>\n<pre class=\"lang:plsql decode:true \"># [ oracle@myserver:\/u01\/app\/oracle\/scripts [12:50:41] [12.1.0.2.0 SID=GRID] 0 ] #\r\n# lsoh\r\n\r\nHOME                        LOCATION                                                VERSION      EDITION                                                          \r\n--------------------------- ------------------------------------------------------- ------------ --------                                                         -\r\nOraGI12Home1                \/u01\/app\/grid\/product\/grid                              12.1.0.2.0   GRID                                                             \r\nOraDB12Home1                \/u01\/app\/oracle\/product\/12.1.0.2                        12.1.0.2.0   DBMS EE                                                          \r\nagent12c1                   \/u01\/app\/oracle\/product\/agent12c\/core\/12.1.0.5.0        12.1.0.5.0   AGT                                                              \r\nOraDb11g_home1              \/u01\/app\/oracle\/product\/11.2.0.4                        11.2.0.4.0   DBMS EE                                                          \r\nOraDB12Home2                \/u01\/app\/oracle\/product\/12.1.0.2_BP170718               12.1.0.2.0   DBMS EE\r\n12_1_0_2_BP170718           \/u01\/app\/oracle\/product\/12_1_0_2_BP170718               12.1.0.2.0   DBMS EE                                                          \r\n12_1_0_2_BP180116           \/u01\/app\/oracle\/product\/12_1_0_2_BP180116               12.1.0.2.0   DBMS EE<\/pre>\n<p>Patch manually the home named\u00a0 12_1_0_2_BP180116 with the January bundle patch:<\/p>\n<pre class=\"lang:sh highlight:0 decode:true\"># [ oracle@myserver:\/u01\/app\/oracle\/scripts [18:07:00] [12.1.0.2.0 SID=GRID] 0 ] #\r\n# setoh 12_1_0_2_BP170718\r\n\r\n# [ oracle@myserver:\/share\/oracle\/database\/patches\/12c\/12.1.0.2.BP180116\/27010930\/26925263 [12:55:58] [12.1.0.2.0 SID=GRID] 0 ] #\r\n# opatch apply\r\nOracle Interim Patch Installer version 12.2.0.1.12\r\nCopyright (c) 2018, Oracle Corporation.  All rights reserved.\r\n\r\n\r\nOracle Home       : \/u01\/app\/oracle\/product\/12_1_0_2_BP180116\r\nCentral Inventory : \/u01\/app\/oracle\/oraInventory\r\n   from           : \/u01\/app\/oracle\/product\/12_1_0_2_BP180116\/oraInst.loc\r\nOPatch version    : 12.2.0.1.12\r\nOUI version       : 12.1.0.2.0\r\nLog file location : \/u01\/app\/oracle\/product\/12_1_0_2_BP180116\/cfgtoollogs\/opatch\/opatch2018-02-07_12-                                                         54-50PM_1.log\r\n\r\nVerifying environment and performing prerequisite checks...\r\nOPatch continues with these patches:   26609798  26717470  26925263\r\n\r\nDo you want to proceed? [y|n]\r\ny\r\nUser Responded with: Y\r\nAll checks passed.\r\n\r\nPlease shutdown Oracle instances running out of this ORACLE_HOME on the local system.\r\n(Oracle Home = '\/u01\/app\/oracle\/product\/12_1_0_2_BP180116')\r\n\r\n\r\nIs the local system ready for patching? [y|n]\r\ny\r\nUser Responded with: Y\r\nBacking up files...\r\nApplying sub-patch '26609798' to OH '\/u01\/app\/oracle\/product\/12_1_0_2_BP180116'\r\n\r\nPatching component oracle.oracore.rsf, 12.1.0.2.0...\r\n\r\nPatching component oracle.rdbms, 12.1.0.2.0...\r\n\r\nPatching component oracle.rdbms.rsf, 12.1.0.2.0...\r\nApplying sub-patch '26717470' to OH '\/u01\/app\/oracle\/product\/12_1_0_2_BP180116'\r\nApplySession: Optional component(s) [ oracle.oid.client, 12.1.0.2.0 ] , [ oracle.has.crs, 12.1.0.2.0 ]  n                                                         ot present in the Oracle Home or a higher version is found.\r\n\r\nPatching component oracle.ldap.client, 12.1.0.2.0...\r\n\r\nPatching component oracle.rdbms.crs, 12.1.0.2.0...\r\n\r\nPatching component oracle.rdbms.deconfig, 12.1.0.2.0...\r\n\r\nPatching component oracle.xdk, 12.1.0.2.0...\r\n\r\nPatching component oracle.tfa, 12.1.0.2.0...\r\n\r\nPatching component oracle.rdbms, 12.1.0.2.0...\r\n\r\nPatching component oracle.rdbms.dbscripts, 12.1.0.2.0...\r\n\r\nPatching component oracle.nlsrtl.rsf, 12.1.0.2.0...\r\n\r\nPatching component oracle.xdk.parser.java, 12.1.0.2.0...\r\n\r\nPatching component oracle.xdk.rsf, 12.1.0.2.0...\r\n\r\nPatching component oracle.rdbms.rsf, 12.1.0.2.0...\r\n\r\nPatching component oracle.rdbms.rman, 12.1.0.2.0...\r\n\r\nPatching component oracle.rdbms.rman, 12.1.0.2.0...\r\n\r\nPatching component oracle.has.deconfig, 12.1.0.2.0...\r\nApplying sub-patch '26925263' to OH '\/u01\/app\/oracle\/product\/12_1_0_2_BP180116'\r\nApplySession: Optional component(s) [ oracle.has.crs, 12.1.0.2.0 ]  not present in the Oracle Home or a h                                                         igher version is found.\r\n\r\nPatching component oracle.network.rsf, 12.1.0.2.0...\r\n\r\nPatching component oracle.rdbms.crs, 12.1.0.2.0...\r\n\r\nPatching component oracle.rdbms.util, 12.1.0.2.0...\r\n\r\nPatching component oracle.rdbms, 12.1.0.2.0...\r\n\r\nPatching component oracle.rdbms.dbscripts, 12.1.0.2.0...\r\n\r\nPatching component oracle.rdbms.rsf, 12.1.0.2.0...\r\n\r\nPatching component oracle.rdbms.rman, 12.1.0.2.0...\r\nComposite patch 26925263 successfully applied.\r\nSub-set patch [22652097] has become inactive due to the application of a super-set patch [26925263].\r\nPlease refer to Doc ID 2161861.1 for any possible further required actions.\r\nLog file location: \/u01\/app\/oracle\/product\/12_1_0_2_BP180116\/cfgtoollogs\/opatch\/opatch2018-02-07_12-5                                                         4-50PM_1.log\r\n\r\nOPatch succeeded.\r\n\r\n# [ oracle@myserver:\/share\/oracle\/database\/patches\/12c\/12.1.0.2.BP180116\/27010930\/26925263 [12:55:47] [12.1.0.2.0 SID=GRID] 0 ] #\r\n# opatch lspatches\r\n26925263;Database Bundle Patch : 12.1.0.2.180116 (26925263)\r\n22243983;\r\n\r\nOPatch succeeded.<\/pre>\n<p>Create the new golden image from the home patched with January bundle patch:<\/p>\n<pre class=\"lang:sh highlight:0 decode:true \"># [ oracle@myserver:\/u01\/app\/oracle\/scripts [18:07:00] [12.1.0.2.0 SID=GRID] 0 ] #\r\n# setoh 12_1_0_2_BP180116\r\n\r\n# [ oracle@myserver:\/u01\/app\/oracle\/scripts [12:57:24] [12.1.0.2.0 SID=GRID] 1 ] #\r\n# ohctl -c -f\r\nCreating the new Golden Image 12_1_0_2_BP180116\r\n\r\nCleaning previous working copy\r\nCopying the OH to the working copy\r\nCleansing files in Working Copy\r\nCreating the Golden Image zip file\r\n\r\n\r\n# [ oracle@myserver:\/u01\/app\/oracle\/scripts [13:04:57] [12.1.0.2.0 SID=GRID] 0 ] #\r\n# ohctl -l\r\nListing existing golden images:\r\n\r\nOH_Name                             Created    Installed locally?\r\n----------------------------------- ---------- ------------------\r\n12_1_0_2_BP180116                   2018-02-07 Installed\r\n12_1_0_2_BP170718                   2018-02-06 Installed\r\n<\/pre>\n<p><strong>Full source code<\/strong><\/p>\n<p><a href=\"https:\/\/www.ludovicocaldara.net\/dba\/source-code\/ohctl\/\">Full source code of ohctl<\/a><\/p>\n<p>I hope you find it useful! The cool thing is that once you have the golden images ready in the golden image repository, then the provisioning to all the servers is striaghtforward and requires just a couple of minutes, from nothing to a full working and patched Oracle Home.<\/p>\n<p><strong>Why applying the patch manually?<\/strong><\/p>\n<p>If you read everything carefully, I automated the golden image creation and provisioning, but the patching is still done manually.<\/p>\n<p>The aim of this framework is not to patch all the Oracle Homes with the same patch, but to install the patch ONCE and then deploy the patched home everywhere. Because each patch has different conflicts, bugs, etc, it might be convenient to install it manually the first time and then forget it. At least this is my opinion \ud83d\ude42<\/p>\n<p>Of course, patch download, conflict detection, etc. can also be automated (and it is a good idea, if you have the time to implement it carefully and bullet-proof).<\/p>\n<p>In the addendum blog post, I will show some scripts made by\u00a0<span class=\"il\">Hutchison<\/span> Austria and why I find them really useful in this context.<\/p>\n<p><strong>Blog posts in this series:<\/strong><\/p>\n<p><a href=\"https:\/\/www.ludovicocaldara.net\/dba\/oh-mgmt-1\">Oracle Home Management \u2013 part 1: Patch soon, patch often vs. reality<\/a><br \/>\n<a href=\"https:\/\/www.ludovicocaldara.net\/dba\/oh-mgmt-2\"> Oracle Home Management \u2013 part 2: Common patching patterns<\/a><br \/>\n<a href=\"https:\/\/www.ludovicocaldara.net\/dba\/oh-mgmt-3\">Oracle Home Management \u2013 part 3: Strengths and limitations of Rapid Home Provisioning<\/a><br \/>\n<a href=\"https:\/\/www.ludovicocaldara.net\/dba\/oh-mgmt-4\">Oracle Home Management \u2013 part 4: Challenges and opportunities of the New Release Model<\/a><br \/>\n<a href=\"https:\/\/www.ludovicocaldara.net\/dba\/oh-mgmt-5\"> Oracle Home Management \u2013 part 5: Oracle Home Inventory and Naming Conventions<\/a><br \/>\n<a href=\"https:\/\/www.ludovicocaldara.net\/dba\/oh-mgmt-6\"> Oracle Home Management \u2013 part 6: Simple Golden Image blueprint<\/a><br \/>\n<a href=\"https:\/\/www.ludovicocaldara.net\/dba\/oh-mgmt-7\"> Oracle Home Management \u2013 part 7: Putting all together<\/a><br \/>\nOracle Home Management \u2013 Addendum: Managing and controlling the patch level (berx\u2019s work)<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Last part of the blog series&#8230; let&#8217;s see how to put everything together and have a single script that creates and provisions Oracle Home golden images: Review of the points The scripts will: let create a golden image based on &hellip; <a href=\"https:\/\/www.ludovicocaldara.net\/dba\/oh-mgmt-7\/\">Continue reading <span class=\"meta-nav\">&rarr;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"om_disable_all_campaigns":false,"_monsterinsights_skip_tracking":false,"_monsterinsights_sitenote_active":false,"_monsterinsights_sitenote_note":"","_monsterinsights_sitenote_category":0,"footnotes":""},"categories":[321,336,326,3,330,132],"tags":[],"class_list":["post-1724","post","type-post","status-publish","format-standard","hentry","category-aced","category-devops","category-oracle","category-oracledb","category-oracle-inst-upg","category-triblog"],"aioseo_notices":[],"_links":{"self":[{"href":"https:\/\/www.ludovicocaldara.net\/dba\/wp-json\/wp\/v2\/posts\/1724","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.ludovicocaldara.net\/dba\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.ludovicocaldara.net\/dba\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.ludovicocaldara.net\/dba\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.ludovicocaldara.net\/dba\/wp-json\/wp\/v2\/comments?post=1724"}],"version-history":[{"count":10,"href":"https:\/\/www.ludovicocaldara.net\/dba\/wp-json\/wp\/v2\/posts\/1724\/revisions"}],"predecessor-version":[{"id":1811,"href":"https:\/\/www.ludovicocaldara.net\/dba\/wp-json\/wp\/v2\/posts\/1724\/revisions\/1811"}],"wp:attachment":[{"href":"https:\/\/www.ludovicocaldara.net\/dba\/wp-json\/wp\/v2\/media?parent=1724"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.ludovicocaldara.net\/dba\/wp-json\/wp\/v2\/categories?post=1724"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.ludovicocaldara.net\/dba\/wp-json\/wp\/v2\/tags?post=1724"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}