Updating the Context File in E-Business Suite From the Linux Command Line

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

Oracle E-Business Suite R12.2.14 Released

Approximately once a year, typically in the fall, frequently at or near the time of a convention, Oracle announces the new releases for E-Business Suite.

Today is one of those days.

The actual announcement is available to the public here

For those with access to My Oracle Support, you can get more information through MOS 3012829.1. That document includes a link to the R12.2.14 RUP Patch [36026788] as well as a release notes for the patch itself and each of the included modules.

Oracle CloudWorld is happening right now in Las Vegas, NV. Tomorrow, at 9AM (Pacific), Larry will give his keynote address. Hopefully, he will announce the general availability of 23ai for on-premises systems. If that happens, I would look for an announcement from the Applications Technology Group about certification to follow shortly thereafter. For those of you paying attention to the ATG Blog, Elke Phelps posted a seven-part series to “tease” the upcoming certification.

Fingers crossed…

Running ADOP Commands non-Interactively

I really don’t like answering prompts. It takes extra time, requires extra keystrokes, and makes documenting a process somewhat cumbersome. So, I avoid it whenever possible.

In the world of an Oracle E-Business Suite DBA, one command that we run quite often is adop. Unfortunately, the adop command doesn’t directly support command-line arguments for certain common things (passwords, in particular). So, here is what I tend to do:

First, I tend to manually assign the passwords to variables in my current session. The environment variables go away when the session ends. This also makes documentation easier.

export APPSPW=apps
export SYSTEMPW=manager
export WLADMIN=weblogic

PREPARE

{ echo ${APPSPW}; echo ${SYSTEMPW}; echo ${WLADMIN}; }|\
adop phase=prepare

APPLY

{ echo ${APPSPW}; echo ${SYSTEMPW}; echo ${WLADMIN}; }|\
adop phase=apply patches=1234567

FINALIZE

{ echo ${APPSPW}; echo ${SYSTEMPW}; echo ${WLADMIN}; }|\
adop phase=finalize

CUTOVER

{ echo ${APPSPW}; echo ${SYSTEMPW}; echo ${WLADMIN}; }|\
adop phase=cutover

CLEANUP

{ echo ${APPSPW}; echo ${SYSTEMPW}; echo ${WLADMIN}; }|\
adop phase=cleanup

FS_CLONE

{ echo ${APPSPW}; echo ${SYSTEMPW}; echo ${WLADMIN}; }|\
adop phase=fs_clone

A brief warning, though. I typically run the adop phase=abort command interactively as there are additional prompts that will need to be answered. Fortunately, I don’t have to do that quite as often…

Some things that make my EBS DBA Life Easier

There are a number of things that I do as part of my “process” that I find make my life a bit easier.

FINISHED block

There are a LOT of things that we do as an Oracle E-Business Suite DBA that can run for a long time. Because of this, we may have something running in another window and not realize that the command has finished. One trick that I use (mentioned in https://www.bluestonesolutionsgroup.com/?p=55) is to tail an ascii art file at the end of the command line. This serves a few purposes.

  • It is something of an attention grabber and makes an easy way to notice that the command has finished without needing to focus my attention on that particular window.
  • Using tail -f will, in many cases, prevent the shell from timing out and closing.

“Stacking” Multiple Commands on a single command-line

Unix/Linux allows you to “stack” multiple commands that will run in sequence. For example, while you might run three different commands (each on their own command-line):

date
ls -lat
date

They could be stacked into a single command line instead:

date;ls -alt;date

I do this quite a bit with the “date” command. This allows me to capture a “start” and “end” time for my documentation.

The one caveat, however, is that sometimes, the second “date” command will get fed into the command before and taken as a response to a prompt. So, test carefully.

The GNU Screen tool

GNU Screen is a package that can be installed on most Unix/Linux variants. The beauty of this tool is that you can detach an interactive shell session and re-attach it later on. While it’s detached, any commands that are actively running in that shell session will continue to process normally.

This is particularly useful if you’re on a network connection that might drop unexpectedly. Just re-connect, and re-attach the session.

Running an Empty Patch Cycle in R12.2

There are situations where it makes sense to run an “empty” patch cycle in E-Business Suite R12.2. For example, I will run an empty patch cycle after a major operation (R12.1.3 to R12.2 upgrade, platform migration, etc.) to confirm that I can, successfully run a patch cycle.

The other “trick” that I tend to use is a tail.txt file to indicate when a process has finished.  It is a simple ASCII text file that contains the following:

 ####### ### #     # ###  #####  #     # ####### ######  
 #        #  ##    #  #  #     # #     # #       #     # 
 #        #  # #   #  #  #       #     # #       #     # 
 #####    #  #  #  #  #   #####  ####### #####   #     # 
 #        #  #   # #  #        # #     # #       #     # 
 #        #  #    ##  #  #     # #     # #       #     # 
 #       ### #     # ###  #####  #     # ####### ######  

There are several ways to create it.  I used to use the Unix banner command (which isn’t generally present on Linux systems). Because of that, the easiest way now is to use an online ASCII art generator:

https://www.patorjk.com/software/taag/#p=display&f=Banner&t=FINISHED

By having tail -f ${DL}/tail.txt run at the end of a long command, it is pretty easy to notice when the process completes.  This is particularly useful when you may have the window in the background, be running from a different machine, or maybe you’re just glancing at the screen from across a room.

As an example, let’s say you wanted to run an “empty patch cycle” as described in MOS 2316218.1:

. /oracle/${TWO_TASK}/EBSapps.env run
date;{ echo ${APPSPW}; echo ${SYSTEMPW}; echo ${WLADMIN}; }|\
adop phase=prepare,finalize,cutover; date; tail -f ${DL}/tail.txt

. /oracle/${TWO_TASK}/EBSapps.env run
date;{ echo ${APPSPW}; echo ${SYSTEMPW}; echo ${WLADMIN}; }|\
adop phase=cleanup cleanup_mode=full;date;tail -f ${DL}/tail.txt

Including Date/Time in the Linux Prompt

The basic way to set a prompt is by setting the “PS1” variable.

In Linux (the BASH shell, in particular), the default format is:

export PS1="[\u@\h \W]\$ "

That will give you a prompt that looks like this (where “dir” is your current directory)

[username@host dir]$

We can add a date/timestamp to it by changing the prompt to this:

export PS1="\D{%F %T} [\u@\h \W]\$ "

So, for today (August 21, 2024 at 14:45:00), the prompt would look like this:

2024-08-21 14:45:00 [user@host ~]$

So, why would I want to set my prompt this way?

Generally, I wouldn’t. I tend to like things pretty clean.

But, if I’m doing a big upgrade with a lot of steps, it would be nice. Combine that with a terminal emulator that logs everything and you have a pretty decent way to capture “start/stop” times for individual commands.

You could even put some sort of token at the front to make the lines easier to grep out of the log. This one would put “[CMD] ” at the front of each line:

export PS1="[CMD] \D{%F %T} [\u@\h \W]\$ "

Keep in mind though. This prompt is not “dynamic”. It will only show the time at the instant that the prompt is printed.

Rebirth

Welcome to the re-launch of the BlueStone Solutions Group, Inc. site. I will be posting new content (and re-posting some of the old content) in the near future.