Oracle Fusion Middleware & Application Server

Wednesday, May 31, 2017

How to install and configure Oracle Forms & Reports 12c fully unattended - Part 1

Today, I will have a novelty on my blog. This blogpost is driven by a joint venture between 3 consultants based in 2 countries (Switzerland and Germany) and working for 3 different consulting companies (Robert Crames = Edorex, Jan-Peter Timmermann = AuraPlayer and myself = Trivadis).

As we three consultants, Robert Crames (https://robertcrames.blogspot.ch), Jan-Peter Timmermann (https://jan-peter.me ) and myself are intensively working with Oracle Fusion Middleware Products, which also covers Oracle Forms & Reports, we’re stumbling over following problem with Oracle Forms & Reports 12c:

  • Missing possibility during the WebLogic Domain creation for Forms & Reports to use a “record” Feature
Different contacts with Oracle and researches within My Oracle Support, confirmed that the “record” feature is no longer available within Oracle Forms & Reports 12c.
Therefore, in case you will have to create on several servers Oracle Forms & Reports environments, you will need a lot of patience while clicking through the Configuration Wizard for WebLogic Domain creation. So automation is quite impossible for a complete installation and configuration ☹

So, the joint venture (Robert, Jan-Peter and myself) we were pooling our knowledge and created a script set for “How to install and configure an Oracle Forms & Reports 12c environment completely unattended and silent”.

Here I will present the first part:
  • Installation of JDK
  • Installation of Oracle WebLogic Server Infrastructure 12.2.1.2.0
  • Installation of Oracle Forms & Reports 12.2.1.2.0
The above steps are requiring following files:
  • setLocalEnv.sh
    • here we define all necessary values for the installation, e.g. ORACLE_BASE, JDK Release, ORACLE_HOME and so on
  • silent_jdk.sh
    • installs under the Oracle Software Owner a private JDK
  • silent_wls_infra.sh
    • Install the Oracle WebLogic Server Infrastructure 12.2.1.2.0
    • Requires setLocalEnv.sh, oraInst.loc and response_file_wls_infra.rsp
  • silent_forms.sh
    • Installs the Oracle Forms & Reports 12.2.1.2.0 over the prior installed Oracle WebLogic Server Infrastructure
    • Requires setLocalEnv.sh, oraInst.loc and response_file_forms.rsp
Place the following files all under one directory, e.g. /u00/app/oracle/install.


Download the required Oracle Software Installation sources and place them as well in the same directory as the script set
First lets have a quick look on the setLocalEnv.sh. I will just explain the for now required variables, the remaining variables will be described in Robert’s Blogpost

For the first steps, we need to have a look on following environment variables in the setLocalEnv.sh
  • JDK_SOURCE: here we define the JDK installation source file (tar.gz)
  • JDK_REL: is the JDK Release, the syntax is for JDK 8 = 1.8.0_<updateversion>
  • ORACLE_BASE: defines our ORACLE_BASE
  • INT_ORACLE_HOME: defines our target ORACLE_HOME
  • The remaining variables will be explained in Robert's second Blogpost
# Location to the directory in which the create Domain scripts are residing
export SCRIPT_HOME=$PWD

export JDK_SOURCE=jdk-8u131-linux-x64.tar.gz
export JDK_REL=1.8.0_131

# Directories
export ORACLE_BASE=/appl/oracle
export INT_ORACLE_HOME=$ORACLE_BASE/product/fmw-fr-12.2.1.2.0
export WL_HOME=$INT_ORACLE_HOME/wlserver
export WLST_HOME=$INT_ORACLE_HOME/oracle_common/common/bin
export MW=$INT_ORACLE_HOME
export DOMAIN_BASE=$ORACLE_BASE/user_projects/domains
export APPLICATION_BASE=$ORACLE_BASE/user_projects/applications
export APP_VZ=$APPLICATION_BASE

# install forms true / false
export FORMS12C=true
# install reports true / false
export REPORTS12C=true
# install OHS true / false
export WEBTIER12C=true
export OHS_COMPONENTNAME=ohs1
export OHS_LISTENPORT=7777
export OHS_SSLPORT=4443

# Domain specific
export TEMPLATE=$WL_HOME/common/templates/wls/wls.jar
export DOMAIN_NAME=FRTEST

# AdminServer
export AS_NAME=FRTESTAdminServer
export ADM_USER=weblogic
export ADM_PWD=welcome1
export ADMINPORT=7001 
export ADMINPORTSSL=7101
export AS_HOST=`hostname -f`

# Name and Port for the Forms Managed Server
export FORMS_MS_NAME=MS_FORMS
export FORMS12C_MS_PORT=9001

# Name and Port for the Reports Managed Server
export REPORTS_MS_NAME=MS_REPORTS
export REPORTS12C_MS_PORT=9002

# Move Reports Application into WLS_FORMS (true or false)
export REPORTS_IN_FORMS=false

# NodeManager
export NM_LISTENADDRESS=`hostname -f`
export NM_TYPE=SSL
export NM_PORT=5556
export NM_USERNAME=nodemanager
export NM_PWD=welcome1

# Repository Connect
export DBUSER=sys
export DBPWD=
export DBROLE=SYSDBA
export COMPONENTPWD=
export SCHEMA_PREFIX=$DOMAIN_NAME
export DB_HOST=
export DB_PORT=
export DB_SERVICE=
export DB_OMF=true
export DB_USER_PW=welcome1
export PWDFILE=$SCRIPT_HOME/passwords.txt

The first script to execute is the silent_jdk.sh, this script simply unpacks the JDK under the defined $ORACLE_BASE/product/jdk$JDK_REL
silent_jdk.sh

#!/bin/bash
#=====================================================================
#
# $Id: silent_jdk.sh $
#
# PURPOSE: Script to install JDK
#
# PARAMETERS: none
#
# NOTES:   setLocalEnv.sh must be present and aligned
#
# AUTHOR:  Dirk Nachbar, https://dirknachbar.blogspot.com
#
# MODIFIED:
#
#
#=====================================================================

source setLocalEnv.sh

mkdir -p ${ORACLE_BASE}/product/
cp ${JDK_SOURCE} ${ORACLE_BASE}/product/
cd ${ORACLE_BASE}/product/
gunzip ${JDK_SOURCE}
tar -xvf ${JDK_SOURCE}
rm ${ORACLE_BASE}/product/${JDK_SOURCE}


The next step is to install the Oracle WebLogic Server Infrastructure 12.2.1.2.0, here we are using the silent installation option with a response file and an oraInst.loc file

silent_wls_infra.sh

#!/bin/sh
#=====================================================================
#
# $Id: silent_wls_infra.sh $
#
# PURPOSE: Script to install WebLogic Infrastructure
#
# PARAMETERS: none
#
# NOTES:   setLocalEnv.sh must be present and aligned
#
# AUTHOR:  Dirk Nachbar, https://dirknachbar.blogspot.com
#
# MODIFIED:
#
#
#=====================================================================

source setLocalEnv.sh

export JAVA_HOME=${ORACLE_BASE}/product/jdk${JDK_REL}
export PATH=$JAVA_HOME/bin:$PATH

java -jar fmw_12.2.1.2.0_infrastructure.jar -silent -responseFile ${SCRIPT_HOME}/response_file_wls_infra.rsp -jreLoc ${JAVA_HOME} -invPtrLoc ${SCRIPT_HOME}/oraInst.loc


The referenced response file for the silent_wls_infra.sh Installation script looks as follows
response_file_wls_infra.rsp

[ENGINE]
#DO NOT CHANGE THIS.
Response File Version=1.0.0.0.0
[GENERIC]
#Set this to true if you wish to skip software updates
DECLINE_AUTO_UPDATES=true
#My Oracle Support User Name
MOS_USERNAME=
#My Oracle Support Password
MOS_PASSWORD=<SECURE VALUE>
#If the Software updates are already downloaded and available on your local system, then specify the path to the directory where these patches are available and set SPECIFY_DOWNLOAD_LOCATION to true
AUTO_UPDATES_LOCATION=
#Proxy Server Name to connect to My Oracle Support
SOFTWARE_UPDATES_PROXY_SERVER=
#Proxy Server Port
SOFTWARE_UPDATES_PROXY_PORT=
#Proxy Server Username
SOFTWARE_UPDATES_PROXY_USER=
#Proxy Server Password
SOFTWARE_UPDATES_PROXY_PASSWORD=<SECURE VALUE>
#The oracle home location. This can be an existing Oracle Home or a new Oracle Home
ORACLE_HOME=/appl/oracle/product/fmw-fr-12.2.1.2.0
#Set this variable value to the Installation Type selected. e.g. Fusion Middleware Infrastructure, Fusion Middleware Infrastructure With Examples.
INSTALL_TYPE=Fusion Middleware Infrastructure
#Provide the My Oracle Support Username. If you wish to ignore Oracle Configuration Manager configuration provide empty string for user name.
MYORACLESUPPORT_USERNAME=
#Provide the My Oracle Support Password
MYORACLESUPPORT_PASSWORD=<SECURE VALUE>
#Set this to true if you wish to decline the security updates. Setting this to true and providing empty string for My Oracle Support username will ignore the Oracle Configuration Manager configuration
DECLINE_SECURITY_UPDATES=true
#Set this to true if My Oracle Support Password is specified
SECURITY_UPDATES_VIA_MYORACLESUPPORT=false
#Provide the Proxy Host
PROXY_HOST=
#Provide the Proxy Port
PROXY_PORT=
#Provide the Proxy Username
PROXY_USER=
#Provide the Proxy Password
PROXY_PWD=<SECURE VALUE>
#Type String (URL format) Indicates the OCM Repeater URL which should be of the format [scheme[Http/Https]]://[repeater host]:[repeater port]
COLLECTOR_SUPPORTHUB_URL=

The referenced oraInst.loc file for the silent_wls_infra.sh Installation script looks as follows
oraInst.loc
inst_group=oinstall
inventory_loc=/u00/app/oracle/oraInventory

The last step is to install the Oracle Forms & Reports 12.2.1.2.0 components over the prior installed Oracle WebLogic Server Infrastructure 12.2.1.2.0.
With this step is one speciality, I am replacing the originally provided frmconfighelper.sh script with my modified version described in my Blogpost https://dirknachbar.blogspot.ch/2017/05/oracle-forms-12c-frmconfighelper.html

For this installation step we are using the silent_forms.sh, which is referencing a corresponding response file and the same oraInst.loc as we used before for the Oracle WebLogic Server Infrastructure installation

silent_forms.sh

#!/bin/sh
#=====================================================================
#
# $Id: silent_forms.sh $
#
# PURPOSE: Script to install Oracle Forms and Reports
#           on top of existing WebLogic Server Infrastructure Installation
#
# PARAMETERS: none
#
# NOTES:   setLocalEnv.sh must be present and aligned
#          Modified frmconfighelper.sh will be provided
#                   with more functions
#
# AUTHOR:  Dirk Nachbar, https://dirknachbar.blogspot.com
#
# MODIFIED:
#
#
#=====================================================================

source setLocalEnv.sh

export JAVA_HOME=${ORACLE_BASE}/product/jdk${JDK_REL}

./fmw_12.2.1.2.0_fr_linux64.bin -silent -responseFile ${SCRIPT_HOME}/response_file_forms.rsp -jreLoc ${JAVA_HOME} -invPtrLoc ${SCRIPT_HOME}/oraInst.loc

mv ${MW}/forms/provision/frmconfighelper.sh ${MW}/forms/provision/frmconfighelper.sh.org
cp ${SCRIPT_HOME}/frmconfighelper.sh ${MW}/forms/provision/
chmod +x ${MW}/forms/provision/frmconfighelper.sh


The referenced response file response_file_forms.rsp for the silent_forms.sh Installation script looks as follows

[ENGINE]
#DO NOT CHANGE THIS.
Response File Version=1.0.0.0.0
[GENERIC]
#Set this to true if you wish to skip software updates
DECLINE_AUTO_UPDATES=true
#My Oracle Support User Name
MOS_USERNAME=
#My Oracle Support Password
MOS_PASSWORD=<SECURE VALUE>
#If the Software updates are already downloaded and available on your local system, then specify the path to the directory where these patches are available and set SPECIFY_DOWNLOAD_LOCATION to true
AUTO_UPDATES_LOCATION=
#Proxy Server Name to connect to My Oracle Support
SOFTWARE_UPDATES_PROXY_SERVER=
#Proxy Server Port
SOFTWARE_UPDATES_PROXY_PORT=
#Proxy Server Username
SOFTWARE_UPDATES_PROXY_USER=
#Proxy Server Password
SOFTWARE_UPDATES_PROXY_PASSWORD=<SECURE VALUE>
#The oracle home location. This can be an existing Oracle Home or a new Oracle Home
ORACLE_HOME=/u00/app/oracle/product/fmw-fr-12.2.1.2.0
#Set this variable value to the Installation Type selected as either Standalone Forms Builder OR Forms and Reports Deployment
INSTALL_TYPE=Forms and Reports Deployment

Putting all together, just create all the above described files into one directory on your Linux Server, e.g. /u00/app/oracle/install. Make the *.sh scripts executable (chmod +x *.sh) and execute them in following order:
cd /u00/app/oracle/install
chmod +x *.sh
./silent_jdk.sh
./silent_wls_infra.sh
./silent_forms.sh

Now, you have the base for the next steps, described by Robert Crames in his Blogpost http://robertcrames.blogspot.ch/2017/05/how-to-install-and-configure-oracle.html

After you are done with reading and applying Robert’s Part, stay tuned for my next Blogpost “How to automate Multiple Managed Servers for Oracle Forms”


Tuesday, May 16, 2017

Oracle Forms 12c: frmconfighelper - enable_ohs

Yesterday I was blogging about how to create new Forms Managed Servers and how to deploy a new formsapp into them with the frmconfighelper tool (http://dirknachbar.blogspot.com/2017/05/oracle-forms-122120-multiple-managed.html).

Today I was testing the function enable_ohs from the frmconfighelper tool, which is mainly dedicated to generate a forms.conf file in your Oracle HTTP Server which contains the directives for your Forms Environment.

oracle@server> cd $ORACLE_HOME/forms/provision
oracle@server> ./frmconfighelper.sh
using log file /home/oracle/frmconfighelper/logs/frmconfighelper_2017_05_15_20_49_31.log ..........
-----------------------------------------------------------------
   Forms configuration helper script                             
-----------------------------------------------------------------
 This script helps administrators perform some of the Forms      
 related configuration tasks                                     
                                                                 
**Important**: - Please backup the Weblogic domain before        
                 performing any administration tasks on it using 
                 this script.                                    
               - You can run enable_sso, enable_webgate          
                 and enable_sso_ssl options  only once.          
                                                                 
 frmconfighelper.sh <option> <arguments>                         
                                                                 
 options:                                                        
    - enable_ohs <domain-home> <ohs-instance> <forms-managed-server1-host> 
                 <forms-managed-server1-port> [<forms-managed-server2-host> 
                 <forms-managed-server2-port>..]                    
. . .
. . .

As you can see from the above listing, the tool will generate a forms.conf file under the $DOMAIN_HOME/config/fmwconfig/components/OHS/<OHS_INSTANCE>/moduleconf with your provided Servers on which your Forms Managed Servers are running and their Port.
But the disadvantage of the function enable_ohs is, that:

  • the Location tag in the forms.conf is hardcoded with /forms
  • the directive is only for a Forms Cluster Environment
In case you have just a single Managed Server, you can not use it.
In case you have created a new Managed Server with an own defined Context Root (see my blogpost from 15th May 2017) you can not use it.
So, I had a closer look on the frmconfighelper.sh and did some modifications, so that I have now 2 functions for enable_ohs:
  • enable_ohs_cluster
  • enable_ohs_single
You can find my modified frmconfighelper.sh here for download, as its too long to provided here as inline text: https://drive.google.com/file/d/0Bziqha1Q1rglcng4dGhDM0p6TDA/view?usp=sharing
Transfer the new version to your target server, make a backup copy of the original frmconfighelper.sh under $ORACLE_HOME/forms/provision and place my modified frmconfighelper.sh in the same location.

The enable_ohs_cluster is mainly the same as the original version, just extended for one parameter for the Root-Context of your Formsapp

oracle@server> ./frmconfighelper.sh
. . .
. . .
 enable_ohs_cluster:                                             
    - domain-home    : Domain Home directory                     
    - ohs-instance   : OHS instance name (example ohs1)          
    - Forms Context  : Root Context (example forms)              
    - forms-managed-server(n)-host : Forms managed server host   
    - forms-managed-server(n)-port : Forms managed server port   
. . .
. . .
 examples:                                                       
                                                                 
  enable ohs cluster routing to forms managed servers                    
 ./frmconfighelper.sh enable_ohs_cluster /scratch/user_projects/domain/base_domain ohs1 sales wlshost.example.com 9001 wlshost.example.com 9010

The enable_ohs_single is newly added and will generate you a forms.conf with the correct directive for a single Forms Managed Server and the flexibility to provide your own Root-Context.
oracle@server> ./frmconfighelper.sh
. . .
. . .
 enable_ohs_single:                                              
    - domain-home    : Domain Home directory                     
    - ohs-instance   : OHS instance name (example ohs1)          
    - Forms Context  : Root Context (example forms)              
    - forms-managed-server-host : Forms managed server host      
    - forms-managed-server-port : Forms managed server port   
. . .
. . .
 examples: 

  enable ohs single routing to forms managed server              
  ./frmconfighelper.sh enable_ohs_single /scratch/user_projects/domain/base_domain ohs1 finance wlshost.example.com 9020

After you have executed either the enable_ohs_cluster or enable_ohs_single function, keep in mind that you have to restart your OHS, so that the newly added config file will be captured by the OHS.

Monday, May 15, 2017

Oracle Forms 12.2.1.2.0 - Multiple Managed Servers via frmconfighelper

In October 2016 I was blogging how to create multiple Oracle Forms 12c Multiple Managed Servers.
In case you are already on the latest Oracle Forms 12.2.1.2.0 Release, you can now create in a really comfortable way multiple Oracle Forms Managed Servers and deploy the necessary formsapp into your newly created Managed Server.

Since Oracle Forms 12.2.1 there is a small not really well know tool added to Oracle Forms - frmconfighelper. According the documentation (12.2.1.0.0 / 12.2.1.1.0 / 12.2.1.2.0) the frmconfighelper tool contains 5 functions (http://docs.oracle.com/middleware/12212/formsandreports/deploy-forms/GUID-AE8C9D19-BC55-4AD7-A6F0-A36843E3FE83.htm#FSDEP860) :
  • enable_ohs
  • deploy_app
  • update_app
  • enable_sso
  • enable_webgate
But when you call the frmconfighelper in Forms 12.2.1.2.0 you will find some functions which are not documented :-)

oracle@server> cd $ORACLE_HOME/forms/provision
oracle@server> ./frmconfighelper
using log file /home/oracle/frmconfighelper/logs/frmconfighelper_2017_05_15_20_49_31.log ..........
-----------------------------------------------------------------
   Forms configuration helper script                             
-----------------------------------------------------------------
 This script helps administrators perform some of the Forms      
 related configuration tasks                                     
                                                                 
**Important**: - Please backup the Weblogic domain before        
                 performing any administration tasks on it using 
                 this script.                                    
               - You can run enable_sso, enable_webgate          
                 and enable_sso_ssl options  only once.          
                                                                 
 frmconfighelper.sh <option> <arguments>                         
                                                                 
 options:                                                        
    - enable_ohs <domain-home> <ohs-instance> <forms-managed-server1-host> 
                 <forms-managed-server1-port> [<forms-managed-server2-host> 
                 <forms-managed-server2-port>..]                    
                                                                 
    - create_machine <wls-machine-name> <machine-host-name>      
                                                                 
    - create_managed_server <managed-server-name> <wls-machine-name> 
                            <managed-server-port> <standalone>   
                                                                 
    - deploy_app <new-context-root> <new-servlet-alias> <target>
                                                                 
    - update_app <new-context-root> <new-servlet-alias>
                                                                 
    - enable_sso <oam-host> <oam-port> <ohs-host> <ohs-port>     
                 <domain-home> <ohs-instance>                    
                                                                 
    - enable_sso_ssl <oam-host> <oam-port> <ohs-host> <ohs-ssl-port> 
                     <ohs-non-ssl-port> <domain-home> <ohs-instance> 
                                                                 
    - enable_webgate <domain home> <ohs-instance> 
                                                                 
    - help (or no option): prints help                           
                                                                 
-----------------------------------------------------------------
 options description:                                            
                                                                 
. . .
. . .

As you can see, under Oracle Forms 12.2.1.2.0 the frmconfighelper contains in reality 8 functions, so 3 more than documented:
  • create_machine
  • create_managed_server
  • enable_sso_ssl
Within this blogpost I will focus on the create_managed_server function in combination with the function deploy_app.

Lets say, you have a running Oracle Forms & Reports 12.2.1.2.0 environment with the 2 classical Managed Servers MS_FORMS & MS_REPORTS.
Now you are having the requirements to create a new Managed Server called MS_HR_APP for an independent Oracle Forms Application. Under Forms 11g you can achieve this by following the MOS Note 955822.1 which was not really straight forward. Now with Oracle Forms 12.2.1.2.0 you just need 2 commands :-)

The first command is using the function create_managed_server, which comes with following options:

  • create_managed_server:
    • managed-server-name: Managed server name - wls-machine-name : WLS machine name
    • managed-server-port: Managed server port number
    • standalone (optional): indicates standalone managed server which is not part of any cluster.
oracle@server> cd $ORACLE_HOME/forms/provision
oracle@server> ./frmconfighelper.sh create_managed_server MS_HR_APP AdminServerMachine 9010 standalone

running frmconfighelper.sh create_managed_server
using log file /home/oracle/frmconfighelper/logs/frmconfighelper_2017_05_15_21_33_56.log ..........

Initializing WebLogic Scripting Tool (WLST) ...

Welcome to WebLogic Server Administration Scripting Shell

Type help() for help on available commands

frmconfighelper.py output
-------------------------------b-e-g-i-n--------------------------------------------
Please enter your username :weblogic
Please enter your password :
Please enter your server URL [t3://localhost:7001] :
Connecting to t3://localhost:7001 with userid weblogic ...
Successfully connected to Admin Server "AS_FRDEVEL" that belongs to domain "FRDEVEL".

Warning: An insecure protocol was used to connect to the server. 
To ensure on-the-wire security, the SSL port or Admin port should be used instead.

processCreateManagedServer
processing createManagedServer MS_HR_APP
createServer MBean: [MBeanServerInvocationHandler]com.bea:Name=MS_HR_APP,Type=Server
configuring standalone managed server
Target JRF components to "MS_HR_APP"
Copying JRF configuration files from /u00/app/oracle/product/fmw-fr-12.2.1.2.0/oracle_common/modules to /u00/app/oracle/user_projects/domains/FRDEVEL/config/fmwconfig/servers/MS_HR_APP
Update JRF changes to domain /u00/app/oracle/user_projects/domains/FRDEVEL in online mode
frmconfighelper.py script returning ...
------------------------------------------------------------------------------------
command :createManagedServer succeeded... 

-------------------------------e-n-d------------------------------------------------

Now we have created a new standalone Managed Server for our next step to deploy the formsapp into it by using an own context root and an own servlet alias. To deploy the formsapp we will use the function deploy_app from the frmconfighelper:
oracle@server> cd $ORACLE_HOME/forms/provision
oracle@server> ./frmconfighelper.sh deploy_app hrapp hrappservlet MS_HR_APP

running frmconfighelper.sh deploy_app
using log file /home/oracle/frmconfighelper/logs/frmconfighelper_2017_05_15_21_39_59.log ..........

Initializing WebLogic Scripting Tool (WLST) ...

Welcome to WebLogic Server Administration Scripting Shell

Type help() for help on available commands

frmconfighelper.py output
-------------------------------b-e-g-i-n--------------------------------------------
Please enter your username :weblogic
Please enter your password :
Please enter your server URL [t3://localhost:7001] :
Connecting to t3://localhost:7001 with userid weblogic ...
Successfully connected to Admin Server "AS_FRDEVEL" that belongs to domain "FRDEVEL".

Warning: An insecure protocol was used to connect to the server. 
To ensure on-the-wire security, the SSL port or Admin port should be used instead.

processDeployApp
deploying the formsapp.dependencies library to target MS_HR_APP
<May 15, 2017 9:40:19 PM CEST> <Info> <J2EE Deployment SPI> <BEA-260121> <Initiating deploy operation for application, oracle.formsapp.dependencieslib#12.2.1@12.2.1 [archive: /u00/app/oracle/product/fmw-fr-12.2.1.2.0/forms/j2ee/formsapp_deps.jar], to MS_HR_APP .> 
deploying custom Forms JavaEE application hrappapp
<May 15, 2017 9:40:20 PM CEST> <Info> <J2EE Deployment SPI> <BEA-260121> <Initiating deploy operation for application, hrappapp [archive: /u00/app/oracle/product/fmw-fr-12.2.1.2.0/forms/j2ee/hrapp.ear], to MS_HR_APP .> 
frmconfighelper.py script returning ...
------------------------------------------------------------------------------------
command :deployApp succeeded... 

-------------------------------e-n-d------------------------------------------------
<May 15, 2017 9:40:23 PM CEST> <Warning> <JNDI> <BEA-050001> <WLContext.close() was called in a different thread than the one in which it was created.> 

When you login to your WebLogic Server Console, you will find under Domain Structure / Environment / Servers your newly created Managed Server MS_HR_APP, assigned to the Machine AdminServerMachine.



Under Domain Structure / Deployments you will find the newly deploy formsapp called hrappapp, which is targeted to the above created Managed Server MS_HR_APP:


Just start the above create Managed Server MS_HR_APP, the deployment will become active and you can open a browser and point to: http://servername:9010/hrapp/hrappservlet


Under the $DOMAIN_HOME/config/fmwconfig/servers/MS_HR_APP/applications/hrappapp_12.2.1/config directory you will find the standard configuration files for your Forms Applications, e.g. formsweb.cfg, default.env

Also you can configure your new formsapp via the Enterprise Manager Fusion Middleware Control http://servername:7001/em

Navigate via the Target Navigation to the Forms Tree and click on forms


And you will find the new formsapp called hrappapp:


The function create_managed_server in combination with deploy_app enables you to created quickly and stable and bullet-proofed multiple Oracle Forms Managed Servers including the required formsapp deployment including context root naming and alias servlet naming.



Tuesday, May 9, 2017

Fully unintended CPU Patch Download for Oracle WebLogic Server

In case you are owning different versions of Oracle WebLogic Server, e.g. 10.3.6, 12.1.3, 12.2.1.2 and so on and you are regularly applying the Oracle Critical Patch Updates, you will have to download various different Patches.

Mainly you will have to click through different Websites and My Oracle Support Notes until you can download the required patches.

For this purpose I have developed a handy script, with which you can perform a fully unintended download of the latest Oracle WebLogic Server CPU Patches.

All what you need is:

Instructions

At first generate the required folder structure on your Linux Server:

root@server> cd /
root@server> mkdir -p CPU_TOOL/em_catalog
root@server> mkdir -p CPU_TOOL/archive
root@server> mkdir CPU_PATCHES

Create in the directory CPU_TOOL the following 2 files:
patch_download.ksh (afterwards make it executable chmod +x patch_download.ksh

#!/bin/ksh
# Author: Dirk Nachbar, http://dirknachbar.blogspot.com
#
# Purpose:    Wrapper Script for automated Critical Patch Update
#             download from My Oracle Suppurt (MOS)
#             
# Requirements: getMOSPatch, Author: Maris Elsins
#               Source: https://github.com/MarisElsins/getMOSPatch
#
#
# Parameters: -i <PropertiesFile> 
#       e.g.: -i mos.properties
#
#
# Exit Codes:
#             - 1 = Exit Code of Usage Function
#             - 2 = Missing Property or Value in configfile
#
#---------------------------------------------------------------------


#---------------------------------------------------------------------
# CONSTANTS
#---------------------------------------------------------------------

MyName="$(basename $0)"
StartDate="$(date '+%Y-%m-%d_%H:%M:%S')"
LogDir=/work/logs
WorkDir=`pwd`

#---------------------------------------------------------------------
Usage()
#
# PURPOSE: Displays the Usage of the script
#---------------------------------------------------------------------
{
cat << EOF
Usage: patch_download.ksh -i <ConfigFile>
       Wrapper Script for automated Critical Patch Update
       download from My Oracle Support (MOS)
       for Oracle WebLogic Server Release 10.3.6, 12.1.x, 12.2.x

Parameters:
   -i: config file with required parameters

EOF
exit 1
}

#---------------------------------------------------------------------
DoMsg()
#
# PURPOSE: Displays the TimeStamp in front of each status line
#---------------------------------------------------------------------
{
    if [ "${DoAppend}" = "TRUE" ]; then
        echo "`date +%Y-%m-%d_%H:%M:%S` `printf "%05d" $$` ${1}" | tee -a ${LogFile}
    else
        echo "`date +%Y-%m-%d_%H:%M:%S` `printf "%05d" $$` ${1}"
    fi

    shift

    while [ "${1}" != "" ]; do

        if [ "${DoAppend}" = "TRUE" ]; then
            echo "                     ${1}" | tee -a ${LogFile}
        else
            echo "                     ${1}"
        fi

        shift
    done
}


#---------------------------------------------------------------------
CheckParams()
#
# PURPOSE: Checks the input Parmeter -i
#---------------------------------------------------------------------
{
    if [ "${ConfigFile}" = "" ] ; then
        DoMsg "  ERR: Missing parameter(s), the flags -i must be used."
        Usage
    fi
}


#---------------------------------------------------------------------
ReadParams()
#
# PURPOSE: Reads the Parmeters of the Configfile and validate them
#---------------------------------------------------------------------
{
DoMsg "Reading provided Configuration File"
DoMsg "..."

TheMOSUser="$(cat ${ConfigFile} | grep -i "^MOSUser=" | head -n 1 | cut -d= -f2-)"
TheMOSPassword="$(cat ${ConfigFile} | grep -i "^MOSPassword=" | head -n 1 | cut -d= -f2-)"
TheUploadDir="$(cat ${ConfigFile} | grep -i "^UploadDir=" | head -n 1 | cut -d= -f2-)"

    if [ "${TheMOSUser}" = "" ] ; then
        echo "  ERR: Missing value MOSUser in the provided Config File."
        exit 2
    fi

    if [ "${TheMOSPassword}" = "" ] ; then
        echo "  ERR: Missing value MOSPassword in the provided Config File."
        exit 2
    fi

    if [ "${TheUploadDir}" = "" ] ; then
        echo "  ERR: Missing value UploadDir in the provided Config File."
        exit 2
    fi
}


#---------------------------------------------------------------------
DownloadEMCatalog()
#
# PURPOSE: Download of actual Patch List from MOS
#---------------------------------------------------------------------
{

DoMsg "Starting to download latest Version of em_catalog.zip from My Oracle Support"

# Cleanup the em_catalog directory from previous executions
rm -f ${WorkDir}/em_catalog/*.*

TheCookieFile=/tmp/$$.cookies
TheEM_CatalogLogFile=${LogDir}/wget_em_catalog_download_${StartDate}.log

# Contact updates site so that we can get SSO Params for logging in
SSO_Response=`wget https://updates.oracle.com/Orion/Services/download 2>&1|grep Location`

# Extract request parameters for SSO
SSO_Token=`echo $SSO_Response| cut -d '=' -f 2|cut -d ' ' -f 1`
SSO_Server=`echo $SSO_Response| cut -d ' ' -f 2|cut -d 'p' -f 1,2`
SSO_Auth_URL=sso/auth
Auth_Data="ssousername=${TheMOSUser}&password=${TheMOSPassword}&site2pstoretoken=$SSO_Token"

wget --post-data $Auth_Data --save-cookies=${TheCookieFile} --keep-session-cookies $SSO_Server$SSO_Auth_URL >> ${TheEM_CatalogLogFile} 2>&1
wget  --load-cookies=${TheCookieFile} --save-cookies=${TheCookieFile} --keep-session-cookies "https://updates.oracle.com/download/em_catalog.zip" -O em_catalog.zip >> ${TheEM_CatalogLogFile} 2>&1

# Cleanup the Cookie File
rm -f ${TheCookieFile}
rm -f auth

# Extract the em_catalog.zip
unzip ${WorkDir}/em_catalog.zip -d ${WorkDir}/em_catalog/

mv ${WorkDir}/em_catalog.zip ${WorkDir}/archive/em_catalog_${StartDate}.zip

DoMsg "Done to download latest Version of em_catalog.zip from My Oracle Support"

}

#---------------------------------------------------------------------
#
DownloadPatches()
# PURPOSE: Download the actual Patches for Oracle WLS
#---------------------------------------------------------------------
{

# Calculate actual Quarter Year
TheQYear=`echo $(date +%Y)_Q$(( ($(date +%-m)-1)/3+1 ))`
TheDownloadLogFile=${LogDir}/download_patches_${StartDate}.log
DoMsg "Starting to download Oracle WLS CPU's" | tee -a ${TheDownloadLogFile}


# Patch Download for WLS 10.3.6
PatchNumber=`grep -B 2 "<psu_bundle>WLS 10.3" em_catalog/patch_recommendations.xml | grep "<name>" | sed -e 's,.*<name>\([^<]*\)</name>.*,\1,g'`

ThePatchDir=${TheUploadDir}/WLS10.3.6.0/${TheQYear}/${PatchNumber}
mkdir -p ${ThePatchDir}
cd ${ThePatchDir}

DoMsg "Downloading CPU Patch ${PatchNumber} for WLS 10.3.6" | tee ${TheDownloadLogFile}

java -jar ${WorkDir}/getMOSPatch/getMOSPatch.jar MOSUser=${TheMOSUser} MOSPass=${TheMOSPassword} patch=${PatchNumber} regexp=.*Generic.* download=all platform=1234P >> ${TheDownloadLogFile}

cd ${TheUploadDir}/WLS10.3.6.0
rm -f actual
ln -s ${ThePatchDir} actual
cd ${WorkDir}

# Patch Download for WLS 12.1.2
PatchNumber=`grep -B 2 "<psu_bundle>WLS 12.1.2" em_catalog/patch_recommendations.xml | grep "<name>" | sed -e 's,.*<name>\([^<]*\)</name>.*,\1,g'`

ThePatchDir=${TheUploadDir}/WLS12.1.2.0.0/${TheQYear}/${PatchNumber}
mkdir -p ${ThePatchDir}
cd ${ThePatchDir}

DoMsg "Downloading CPU Patch ${PatchNumber} for WLS 12.1.2" | tee -a ${TheDownloadLogFile}

java -jar ${WorkDir}/getMOSPatch/getMOSPatch.jar MOSUser=${TheMOSUser} MOSPass=${TheMOSPassword} patch=${PatchNumber} regexp=.*Generic.* download=all platform=1234P >> ${TheDownloadLogFile}

cd ${TheUploadDir}/WLS12.1.2.0.0
rm -f actual
ln -s ${ThePatchDir} actual
cd ${WorkDir}

# Patch Download for WLS 12.1.3
PatchNumber=`grep -B 2 "<psu_bundle>Oracle WebLogic Server 12.1.3" em_catalog/patch_recommendations.xml | grep "<name>" | sed -e 's,.*<name>\([^<]*\)</name>.*,\1,g'`

ThePatchDir=${TheUploadDir}/WLS12.1.3.0.0/${TheQYear}/${PatchNumber}
mkdir -p ${ThePatchDir}
cd ${ThePatchDir}

DoMsg "Downloading CPU Patch ${PatchNumber} for WLS 12.1.3" | tee -a ${TheDownloadLogFile}

java -jar ${WorkDir}/getMOSPatch/getMOSPatch.jar MOSUser=${TheMOSUser} MOSPass=${TheMOSPassword} patch=${PatchNumber} regexp=.*Generic.* download=all platform=1234P >> ${TheDownloadLogFile}

cd ${TheUploadDir}/WLS12.1.3.0.0
rm -f actual
ln -s ${ThePatchDir} actual
cd ${WorkDir}

# Patch Download for WLS 12.2.1.0
PatchNumber=`grep -B 2 "<psu_bundle>Oracle WebLogic Server 12.2.1.0" em_catalog/patch_recommendations.xml | grep "<name>" | sed -e 's,.*<name>\([^<]*\)</name>.*,\1,g'`

ThePatchDir=${TheUploadDir}/WLS12.2.1.0.0/${TheQYear}/${PatchNumber}
mkdir -p ${ThePatchDir}
cd ${ThePatchDir}

DoMsg "Downloading CPU Patch ${PatchNumber} for WLS 12.2.1.0" | tee -a ${TheDownloadLogFile}

java -jar ${WorkDir}/getMOSPatch/getMOSPatch.jar MOSUser=${TheMOSUser} MOSPass=${TheMOSPassword} patch=${PatchNumber} regexp=.*Generic.* download=all platform=1234P >> ${TheDownloadLogFile}

cd ${TheUploadDir}/WLS12.2.1.0.0
rm -f actual
ln -s ${ThePatchDir} actual
cd ${WorkDir}

# Patch Download for WLS 12.2.1.1
PatchNumber=`grep -B 2 "<psu_bundle>Oracle WebLogic Server 12.2.1.1" em_catalog/patch_recommendations.xml | grep "<name>" | sed -e 's,.*<name>\([^<]*\)</name>.*,\1,g'`

ThePatchDir=${TheUploadDir}/WLS12.2.1.1.0/${TheQYear}/${PatchNumber}
mkdir -p ${ThePatchDir}
cd ${ThePatchDir}

DoMsg "Downloading CPU Patch ${PatchNumber} for WLS 12.2.1.1" | tee -a ${TheDownloadLogFile}

java -jar ${WorkDir}/getMOSPatch/getMOSPatch.jar MOSUser=${TheMOSUser} MOSPass=${TheMOSPassword} patch=${PatchNumber} regexp=.*Generic.* download=all platform=1234P >> ${TheDownloadLogFile}

cd ${TheUploadDir}/WLS12.2.1.1.0
rm -f actual
ln -s ${ThePatchDir} actual
cd ${WorkDir}

# Patch Download for WLS 12.2.1.2
PatchNumber=`grep -B 2 "<psu_bundle>Oracle WebLogic Server 12.2.1.2" em_catalog/patch_recommendations.xml | grep "<name>" | sed -e 's,.*<name>\([^<]*\)</name>.*,\1,g'`

ThePatchDir=${TheUploadDir}/WLS12.2.1.2.0/${TheQYear}/${PatchNumber}
mkdir -p ${ThePatchDir}
cd ${ThePatchDir}

DoMsg "Downloading CPU Patch ${PatchNumber} for WLS 12.2.1.2" | tee -a ${TheDownloadLogFile}

java -jar ${WorkDir}/getMOSPatch/getMOSPatch.jar MOSUser=${TheMOSUser} MOSPass=${TheMOSPassword} patch=${PatchNumber} regexp=.*Generic.* download=all platform=1234P >> ${TheDownloadLogFile}

cd ${TheUploadDir}/WLS12.2.1.2.0
rm -f actual
ln -s ${ThePatchDir} actual
cd ${WorkDir}

DoMsg "Done to download Oracle WLS CPU's" | tee -a ${TheDownloadLogFile}

}

#---------------------------------------------------------------------
# MAIN
#---------------------------------------------------------------------

ConfigFile=""

# All required ConfigParameters are initially set to empty
TheMOSUser=
TheMOSPassword=

while getopts i: CurOpt; do
    case ${CurOpt} in
        i) ConfigFile="${OPTARG}" ;;
        ?) Usage
           exit 1 ;;
    esac
done

shift $((${OPTIND}-1))

if [ $# -ne 0 ]; then
    Usage
fi

# Check Input Params
CheckParams

# Read the Params from the Config File
ReadParams
# Downloading EM Catalog zip file
DownloadEMCatalog
# Downloading the latest available Patches
DownloadPatches


mos.properties
# Configuration File for Automated Critical Patch Download
#
# Author: Dirk Nachbar, http://dirknachbar.blogspot.com
#

# My Oracle Support Credentials

MOSUser=<your_email>
MOSPassword=<your_mos_password>

# Upload Directory for CPU Patches

UploadDir=/CPU_PATCHES

Download the getMOSPatch.jar from https://github.com/MarisElsins/getMOSPatch and place it under /CPU_TOOL/getMOSPatch

root@server> mkdir -p /CPU_TOOL/getMOSPatch
root@server> cp /tmp/getMOSPatch.jar /CPU_TOOL/getMOSPatch

Make sure that you have a java 1.6 or higher in your PATH
root@server> which java
/bin/java
root@server> java -version
openjdk version "1.8.0_102"
OpenJDK Runtime Environment (build 1.8.0_102-b14)
OpenJDK 64-Bit Server VM (build 25.102-b14, mixed mode)

How does it work?

The trick behind the unintended CPU download is really simple, I am using the em_catalog.zip provided by My Oracle Support, which is used by Oracle Cloud Control for the so called Offline Patching (see MOS Note https://support.oracle.com/epmos/faces/DocContentDisplay?id=1931891.1)
In the patch_download.ksh script within the function DownloadEMCatalog() I am downloading the latest version of the em_catalog.zip, place it in the subdirectory /CPU_TOOL/em_catalog, unzip the file.
In the function DownloadPatches() I am using grep to identify the latest available CPU Patches for various WebLogic Server Releases within the file /CPU_TOOL/em_catalog/patch_recommendations.xml and through Maris Elsins' getMOSPatch I am downloading unintended the identified Patches, place them in the directory /CPU_PATCHES/WLS/<VersionNumber>/YYYY_Q[1|2|3|4] and creating a symlink on the latest CPU Patch to actual.

Get your Patches

To download the latest available patches, simply execute following commands:

root@server> cd /CPU_TOOL
root@server> ./patch_download.ksh -i mos.properties

2017-05-09_11:46:19 08102 Reading provided Configuration File
2017-05-09_11:46:19 08102 ...
2017-05-09_11:46:19 08102 Starting to download latest Version of em_catalog.zip from My Oracle Support
Archive:  /CPU_TOOL/em_catalog.zip
  inflating: /CPU_TOOL/em_catalog/aru_products.xml  
  inflating: /CPU_TOOL/em_catalog/aru_releases.xml  
  inflating: /CPU_TOOL/em_catalog/aru_platforms.xml  
  inflating: /CPU_TOOL/em_catalog/aru_languages.xml  
  inflating: /CPU_TOOL/em_catalog/aru_product_groups.xml  
  inflating: /CPU_TOOL/em_catalog/aru_product_releases.xml  
  inflating: /CPU_TOOL/em_catalog/aru_component_releases.xml  
  inflating: /CPU_TOOL/em_catalog/aru_targets.xml  
  inflating: /CPU_TOOL/em_catalog/components.xml  
  inflating: /CPU_TOOL/em_catalog/certifications.xml  
  inflating: /CPU_TOOL/em_catalog/patch_recommendations.xml  
 extracting: /CPU_TOOL/em_catalog/README.txt  
2017-05-09_11:46:56 08102 Done to download latest Version of em_catalog.zip from My Oracle Support
2017-05-09_11:46:56 08102 Starting to download Oracle WLS CPU's
2017-05-09_11:46:57 08102 Downloading CPU Patch 25388747 for WLS 10.3.6
2017-05-09_11:47:39 08102 Downloading CPU Patch 22505331 for WLS 12.1.2
2017-05-09_11:48:07 08102 Downloading CPU Patch 25388793 for WLS 12.1.3
2017-05-09_11:48:34 08102 Downloading CPU Patch 25388847 for WLS 12.2.1.0
2017-05-09_11:48:54 08102 Downloading CPU Patch 25388843 for WLS 12.2.1.1
2017-05-09_11:49:18 08102 Downloading CPU Patch 25388866 for WLS 12.2.1.2
2017-05-09_11:49:41 08102 Done to download Oracle WLS CPU's


Now you will find under the directory /CPU_PATCHES/WLS<VersionNumber>/YYYY_Q[1|2|3|4] the latest available CPU Patch for your Oracle WebLogic Server.
You can easily change in the mos.properties configuration file the target location for the CPU Patches to e.g. a mounted NAS drive, which you can attach to your WebLogic hosts, so that the patches are immediately available on your hosts for WebLogic Server.