Updating the E-Business Suite context file, particularly on the appsTier, is a fairly common exercise for an E-Business Suite DBA. You might need to do it as part of cloning, or just implementing things like Java Web Start and SSL/TLS.
One challenge, however, is that the context file is somewhat fragile. Make the wrong typo, and you could spend a decent amount of time trying to fix things.
The typical method for updating the context file is to simply open it up in your favorite editor (that would be vi on most Unix/Linux systems) and make the changes directly.
The recommended method, is to login to EBS and use Oracle Applications Manager to make the change. Unfortunately, this assumes that you want to (or can) start the applications to make the change
But what I told you that I found a better way to do it?
So, here’s the story.
A couple of years ago, I was setting up an Oracle VISION Demo Virtual Machine. For those who might not know, Oracle has pre-built Virtual Appliances with the E-Business Suite VISION Demo that you can download and run in a VirtualBox VM. (The instructions for The R12.2.12 can be found in MOS 2933812.1).
When you boot up that virtual machine and login for the first time, you’re prompted to answer various questions that are fed into a script which completely reconfigures the system.
When I first saw that I though, oh, this is neat… I wonder how they’re doing this? Turns out, it’s largely a collection of Linux shell scripts and perl scripts. So I started digging further. What I found was that they were using a java routine to edit the context file.
Based on that, I’ve developed this script to do those edits.
It’s important to note that this script is simply a “wrapper” that calls a standard tool that is already included in the Oracle E-Business Suite installation.
In order to run the script, use the syntax:
./update_ctx.sh ${CONTEXT_FILE} token "value"
For example, let’s say you want to update the value for the s_display token:
./update_ctx.sh ${CONTEXT_FILE} s_display localhost:0.0
The script will make a backup of the context file, perform the update, and show you a “diff” between the two. It is written to run on the appsTier (which is where we tend to be making edits). The script supports R12.1.3 and R12.2.
#!/bin/bash
#
# Update Context File for EBS R12.1 or R12.2
#
# James J. Morrow
# BlueStone Solutions Group, Inc.
#
# 01-Nov-2023 JJM Updated to include R12.1 Syntax
#
export DTTM=`date +%Y%m%d-%H%M`
export CTXFILE=${1}
cp ${CTXFILE} ${CTXFILE}.${DTTM}
#
# Determine EBS Version from Environment
#
if [ "${FILE_EDITION}x" == "x" ]; then
echo -e "\nUsing syntax for EBS R12.1\n"
export VER="R12.1"
else
echo -e "\nUsing syntax for EBS R12.2\n"
export VER="R12.2"
fi
update_ctx()
{
#
# From EBS VISION VM, /u01/install/scripts/configwebentry.sh
#
if [ ${VER} == "R12.2" ]; then
#
# EBS R12.2.x syntax
#
echo -e "INFO: Setting ${TOKEN} to ${VALUE}"
${COMMON_TOP}/util/jdk32/jre/bin/java \
-classpath ${COMMON_TOP}/java/classes:${EBS_ORACLE_HOME}/shared-libs/ebs-appsborg/WEB-INF/lib/ebsAppsborgManifest.jar \
oracle.apps.ad.context.UpdateContext ${CTXFILE} ${TOKEN} "${VALUE}"
elif [ ${VER} == "R12.1" ]; then
#
# EBS R12.1.x Syntax
#
echo -e "INFO: Setting ${TOKEN} to ${VALUE}"
${COMMON_TOP}/util/jdk/jre/bin/java \
-classpath ${COMMON_TOP}/java/classes:${COMMON_TOP}/java/lib/appsborg2.zip \
oracle.apps.ad.context.UpdateContext ${CTXFILE} ${TOKEN} "${VALUE}"
fi
}
echo -e "\nUpdating CONTEXT_FILE\n"
export TOKEN=${2}
export VALUE="${3}"
update_ctx
#
# Show before/after
#
echo -e "\nDifference between ORIGINAL and UPDATED context files\n"
diff ${CTXFILE}.${DTTM} ${CTXFILE}
echo -e "\nOriginal context file backed up as ${CTXFILE}.${DTTM}\n"
The script, as written, will only update a single token. If, for example, you’re working on an upgrade or a clone and need to update several, you could modify the script to do so. Just replace this section with a series of TOKEN/VALUE settings and call the “update_ctx” routine for each.
export TOKEN=${2}
export VALUE="${3}"
update_ctx
For example, maybe you need to update all of your Workflow Mailer settings. Replace the section above with values like what we have below.
export TOKEN=s_javamailer_imaphost
export VALUE=outlook
update_ctx
export TOKEN=s_javamailer_imapdomainname
export VALUE=office365.us
update_ctx
export TOKEN=s_javamailer_reply_to
export VALUE=wf${SMSID}@mydomain.com
update_ctx
export TOKEN=s_javamailer_imap_user
export VALUE=swf${SMSID}@mydomain.com
update_ctx
export TOKEN=s_smtphost
export VALUE=smtp
update_ctx
export TOKEN=s_smtpdomainname
export VALUE=mydomain.com
update_ctx