Skip to content

Commit

Permalink
Enhancement to fix issue 2740 (oracle#2754)
Browse files Browse the repository at this point in the history
* Updated readme for opatch loc

* updated readme

* Fixing lint errors

* Fixing lint errors

* Fixed lint errors

* Fixed lint errors

---------

Co-authored-by: Yunus Qureshi <[email protected]>
Co-authored-by: Gerald Venzl <[email protected]>
  • Loading branch information
3 people authored Feb 6, 2024
1 parent 5dcc08e commit 310a71f
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 19 deletions.
3 changes: 2 additions & 1 deletion OracleDatabase/SingleInstance/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,8 @@ So, to use patching extension one should use additional build argument `-o '--bu

./buildContainerImage.sh -e -v 21.3.0 -o '--build-arg SLIMMING=false'

Patched container images can now be built by specifying the parameter -p. Download the database version specific release update and one-offs and place them into the `extensions/patching/patches/release_update` and `extensions/patching/patches/one_offs` folder respectively. In this case, SLIMMING is internally set to **false**. Example command for building the patched container image is as follows:
Patched container images can now be built by specifying the parameter -p. Download the database version specific release update and one-offs and place them under `extensions/patching/patches/release_update` and `extensions/patching/patches/one_offs` folder respectively.
If opatch is required, download and place the zip file for patch 6880880 under `extensions/patching/patches/one_offs` folder. In this case, SLIMMING is internally set to **false**. Example command for building the patched container image is as follows:

./buildContainerImage.sh -e -v 21.3.0 -p

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

Applies patches on oracle home. Multiple one-offs can be applied in a single build but only 1 RU can be applied.

Download the release update and one-offs and place them under extensions/patching/patches directory inside subfolders release_update and one_offs respectively.
Download the release update and one-offs and place them under extensions/patching/patches directory inside subfolders release_update and one_offs respectively. If opatch is required, download and place the zip file for patch 6880880 under one_offs subfolder.

Once the patches have been placed in the correct directories, use the buildExtensions.sh script to build the extended image with patch support.

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,33 +13,34 @@
RU_DIR="${PATCH_DIR}/release_update"
ONE_OFFS_DIR="${PATCH_DIR}/one_offs"

ru_count=$(ls $RU_DIR/*.zip 2> /dev/null | wc -l)
if [ $ru_count -ge 2 ]; then
# shellcheck disable=SC2012
ru_count=$(ls "$RU_DIR"/*.zip 2> /dev/null | wc -l)
if [ "$ru_count" -ge 2 ]; then
echo "Error: Only 1 Release Update can be applied."
exit 1;
elif [ $ru_count == 1 ]; then
ru_patch="$(ls $RU_DIR/*.zip)"
elif [ "$ru_count" == 1 ]; then
ru_patch=$(ls "$RU_DIR"/*.zip)
echo "Unzipping $ru_patch";
unzip -qo $ru_patch -d $PATCH_DIR;
ru_patch=$(echo ${ru_patch##*/} | cut -d_ -f1 | cut -dp -f2)
unzip -qo "$ru_patch" -d "$PATCH_DIR";
ru_patch=$(echo "${ru_patch##*/}" | cut -d_ -f1 | cut -dp -f2)
else
echo "No Release Update to be installed."
fi

ONE_OFFS_LIST=()

if ls $ONE_OFFS_DIR/*.zip 2> /dev/null; then
for patch_zip in $ONE_OFFS_DIR/*.zip; do
patch_no=$(echo ${patch_zip##*/} | cut -d_ -f1 | cut -dp -f2)
if [ $patch_no == "6880880" ]; then
if ls "$ONE_OFFS_DIR"/*.zip 2> /dev/null; then
for patch_zip in "$ONE_OFFS_DIR"/*.zip; do
patch_no=$(echo "${patch_zip##*/}" | cut -d_ -f1 | cut -dp -f2)
if [[ $patch_zip =~ "6880880" ]]; then
echo "Removing directory ${ORACLE_HOME}/OPatch";
rm -rf ${ORACLE_HOME}/OPatch;
echo "Unzipping OPatch archive $patch_zip to ${ORACLE_HOME}";
unzip -qo $patch_zip -d $ORACLE_HOME;
rm -rf "${ORACLE_HOME}"/OPatch;
echo "Unzipping OPatch archive ${patch_zip} to ${ORACLE_HOME}";
unzip -qo "$patch_zip" -d "$ORACLE_HOME";
else
ONE_OFFS_LIST+=($patch_no);
ONE_OFFS_LIST+=("$patch_no");
echo "Unzipping $patch_zip";
unzip -qo $patch_zip -d $PATCH_DIR;
unzip -qo "$patch_zip" -d "$PATCH_DIR";
fi
done
else
Expand All @@ -48,7 +49,7 @@ fi

export PATH=${ORACLE_HOME}/perl/bin:$PATH;

if [ ! -z $ru_patch ]; then
if [ -n "$ru_patch" ]; then
echo "Applying Release Update: $ru_patch";
cmd="${ORACLE_HOME}/OPatch/opatchauto apply -binary -oh $ORACLE_HOME ${PATCH_DIR}/${ru_patch} -target_type rac_database";
echo "Running: $cmd";
Expand All @@ -58,7 +59,7 @@ if [ ! -z $ru_patch ]; then
}
fi

for patch in ${ONE_OFFS_LIST[@]}; do
for patch in "${ONE_OFFS_LIST[@]}"; do
echo "Applying patch: $patch";
cmd="${ORACLE_HOME}/OPatch/opatchauto apply -binary -oh $ORACLE_HOME ${PATCH_DIR}/${patch} -target_type rac_database";
echo "Running: $cmd";
Expand Down

0 comments on commit 310a71f

Please sign in to comment.