Hopefully you have just seen that APEX patchset bundle 16 has just been released for 24.2. Of particular note is that a well-publicised Chrome change to deprecate the unload event created some issues in APEX.
I regularly create fresh databases to handle questions on AskTOM or for demos in my videos or at conferences, and most of these I will typically install APEX on. One thing that was continually catching me out was that I would forget to install the patchset bundle once I had installed the base product.
So I put together a little batch script on my Windows machine that augments the standard install. It checks for the existence of the patchset bundle, and if it is present, it will apply the patch.
Its obviously built for my own laptop but should be easily customised to whatever scenario that might suit you.
It will
-
install APEX 24.2
-
check for the existence of PSE 37366599 and if so build a post install script to run it
-
replace the appropriate files in the ‘images’ folder
-
display the contents of APEX_RELEASES once everything is done
setlocal
set PSE=37366599
set PASS=...
set PDB=...
cd /d C:\oracle\product\apex.242\apex
copy /y apexins.sql tmp_apexins.sql
echo exit >> tmp_apexins.sql
sqlplus "sys/%PASS%@%PDB% as sysdba" @tmp_apexins apex24 apex24 TEMP /i/
REM Check that PSE is defined
if "%PSE%"=="" (
echo REM nothing to do > "%PSE%"\post_install.sql
echo REM nothing to do > "%PSE%"\post_install2.sql
goto :eof
)
REM Check if the directory exists
if exist "%CD%\%PSE%\" (
REM Check if catpatch.sql exists inside that directory
if exist "%CD%\%PSE%\catpatch.sql" (
echo @catpatch.sql > "%PSE%"\post_install.sql
echo select * from apex_release; > "%PSE%"\post_install2.sql
echo exit >> "%PSE%"\post_install2.sql
) else (
echo REM nothing to do > "%PSE%"\post_install.sql
echo REM nothing to do > "%PSE%"\post_install2.sql
)
) else (
echo REM nothing to do > "%PSE%"\post_install.sql
echo REM nothing to do > "%PSE%"\post_install2.sql
)
if exist "%CD%\%PSE%\images\" (
if exist "%CD%\images\" (
echo Copying images from "%CD%\%PSE%\images" to "%CD%\images"...
xcopy "%CD%\%PSE%\images\*" "%CD%\images\" /E /I /Y
)
)
cd "%PSE%"
sqlplus "sys/%PASS%@%PDB% as sysdba" @post_install
sqlplus "sys/%PASS%@%PDB% as sysdba" @post_install2
endlocal
and here is a variant for Linux
#!/bin/bash
# Variables
PSE=37366599
PASS=...
PDB=...
# Exit immediately if a command exits with a non-zero status
set -e
# Change to APEX directory
cd /u01/app/oracle/product/apex.242/apex || exit 1
# Copy apexins.sql and append exit
cp -f apexins.sql tmp_apexins.sql
echo "exit" >> tmp_apexins.sql
# Run APEX installation
sqlplus "sys/${PASS}@${PDB} as sysdba" @tmp_apexins.sql apex24 apex24 TEMP /i/
# Check that PSE is defined
if [[ -z "$PSE" ]]; then
echo "REM nothing to do" > "${PSE}/post_install.sql"
echo "REM nothing to do" > "${PSE}/post_install2.sql"
exit 0
fi
# Check if the directory exists
if [[ -d "$PWD/$PSE" ]]; then
# Check if catpatch.sql exists inside that directory
if [[ -f "$PWD/$PSE/catpatch.sql" ]]; then
echo "@catpatch.sql" > "${PSE}/post_install.sql"
echo "select * from apex_release;" > "${PSE}/post_install2.sql"
echo "exit" >> "${PSE}/post_install2.sql"
else
echo "REM nothing to do" > "${PSE}/post_install.sql"
echo "REM nothing to do" > "${PSE}/post_install2.sql"
fi
else
echo "REM nothing to do" > "${PSE}/post_install.sql"
echo "REM nothing to do" > "${PSE}/post_install2.sql"
fi
# Copy images directory if both source and target exist
if [[ -d "$PWD/$PSE/images" && -d "$PWD/images" ]]; then
echo "Copying images from $PWD/$PSE/images to $PWD/images..."
cp -R "$PWD/$PSE/images/"* "$PWD/images/"
fi
# Change to PSE directory
cd "$PSE" || exit 1
# Run post install scripts
sqlplus "sys/${PASS}@${PDB} as sysdba" @post_install.sql
sqlplus "sys/${PASS}@${PDB} as sysdba" @post_install2.sql
Happy patching!
Standard disclaimer: Use at own risk, no warranty/liability etc 🙂




Leave a Reply