Tuesday, May 6, 2025

Script for applying EBS technology patches

A key step in applying EBS CPU patches is to decide which technology patches are required by both ETCC checker and quarterly CPU Release document for WebLogic and Oracle Homes of Fusion Middleware. After the list of required patches for each component is decided, I write a shell script to run the patching process and make it more consistent and much quicker cross nodes and different instances (Dev, QA, Prod).

Pre-steps: place technology patch files to a location shared by many servers. For January 2025 CPU patches (Doc ID 3061170.1), 3 patches are needed and copied to each sub-folder WLS and FMW_Comm under location /path/to/Jan2025_CPU:
 
- FMW_Comm
Holds 3 Fusion Middleware patch files and opatch response file ocm.rsp. Each .zip file is unzipped to its own sub-folder here.
$ cd /path/to/Jan2025_CPU/FMW_Comm
$ ls *.*
ocm.rsp
p33974106_111190_Generic.zip
p33960746_111190_Generic.zip
p34714760_111190_Generic.zip

Do unzip and chmod just one time.
$ unzip p33974106_111190_Generic.zip
$ unzip p33960746_111190_Generic.zip
$ unzip p34714760_111190_Generic.zip

Open READ permission for other OS accounts to run the script to patch instances on other servers: (Or, remove the sub-folder and then unzip the .zip file again before each opatch run.)
$ chmod -R +r 33974106
$ chmod -R +r 33960746
$ chmod -R +r 34714760

$ ls -l | egrep "^drw" |awk '{print $9}'
33974106
33960746
34714760

- WLS 
Holds 3 WLS patch zip files, and each file is saved in its own sub-folder:
13845626/p13845626_10360231017_Generic.zip
35476084/p35476084_1036_Linux-x86-64.zip
35586779/p35586779_1036_Generic.zip

============= script apply_EBStechPatches.sh ============
# apply tech patches for January 2025 EBS CPU technology patches. 
# it can be modified for any other R12.2 EBS CPU releases.
# 1. Make sure same patches are required cross different nodes and instances!
# 2. Assume all patch files are saved in sub-folders of a shared location: FMW_Comm and WLS
#
# Specify the path to the shared location where patch files are saved:
patchFileLoc=/path/to/Jan2025_CPU

# Run/call the script, for example: ./apply_EBStechPatches.sh 'appsPWD$%^&_!'
appsPWD=$1
if [ -z "$appsPWD" ]; then
  echo "ETCC needs password to run the script. Exit ..."
  exit;
else
echo "Run ETCC checker:"
cd $patchFileLoc/ETCC
{ echo $appsPWD } | checkMTpatch.sh

echo "Apply WLS patches:"
# Because it may required to remove WLS patch before installing a new WLS patch,
# to edit this section is needed for each CPU release. Can not make it truly automatic!
echo $FMW_HOME
cd $FMW_HOME/utils/bsu/cache_dir
echo $PWD
cp -f $patchFileLoc/WLS/13845626/p13845626_10360231017_Generic.zip .
cp -f $patchFileLoc/WLS/35476084/p35476084_1036_Linux-x86-64.zip .
cp -f $patchFileLoc/WLS/35586779/p35586779_1036_Generic.zip .
ls -altr
unzip -o p35586779_1036_Generic.zip
unzip -o p35476084_1036_Linux-x86-64.zip
unzip -o p13845626_10360231017_Generic.zip
cd ..
echo $PWD
./bsu.sh -remove -patchlist=AMGE -prod_dir=$FMW_HOME/wlserver_10.3
./bsu.sh -remove -patchlist=P8S7 -prod_dir=$FMW_HOME/wlserver_10.3
./bsu.sh -install -patch_download_dir=$FMW_HOME/utils/bsu/cache_dir -patchlist=E7HI -prod_dir=
$FMW_HOME/wlserver_10.3
./bsu.sh -install -patch_download_dir=$FMW_HOME/utils/bsu/cache_dir -patchlist=WY44 -prod_dir=
$FMW_HOME/wlserver_10.3
./bsu.sh -remove -patchlist=CW7X -prod_dir=$FMW_HOME/wlserver_10.3
./bsu.sh -install -patch_download_dir=$FMW_HOME/utils/bsu/cache_dir -patchlist=KMHV -prod_dir=
$FMW_HOME/wlserver_10.3
echo "confirm 3 patches are installed"
./bsu.sh -prod_dir=$FMW_HOME/wlserver_10.3 -status=applied -verbose -view | egrep -i 'KMHV|WY44|E7HI'

echo "Apply patches to ORACLE_COMMON: Truly automatic."
export ORACLE_HOME=$FMW_HOME/oracle_common
export PATH=$ORACLE_HOME/OPatch:$PATH
echo "Oracle Home: $ORACLE_HOME"
which opatch
ps -ef | grep $LOGNAME

cd $patchFileLoc/FMW_Comm
for x in ls -l | egrep "^drw" |awk '{print $9}'
do
echo "apply patch $x"
cd $x
opatch apply -silent -ocmrf $patchFileLoc/FMW_Comm/ocm.rsp   # silent!
echo "confirm patch $x is applied:"
opatch lsinventory | egrep -i "$x"
cd ..
echo
done

# Add easily a section here if patches are required for Oracle Home of Forms and Reports

echo "ETCC to confirm no more patches are needed:"
cd $patchFileLoc/ETCC
{ echo $appsPWD } | checkMTpatch.sh
exit

fi
============== End ================

No comments: