AutoUpgrade before_action Local Parameter Example

To install Oracle Database features as part of your upgrade plan, you can use the before_action local parameter to run scripts.

The following script examples show how you can use the before_action local parameter to install Oracle Application Express with AutoUpgrade as part of your upgrade plan. To use these examples with your own system, modify the scripts to point to your own ORACLE_HOME, ORACLE_SID, and Oracle Application Express (APX_HOME) installation directories.

Example 4-8 Install Oracle Application Express as Part of the Upgrade

Linux and Unix Systems:

#!/bin/sh
# Copyright (c) 2016, 2019, Oracle and/or its affiliates. All rights reserved.
#
#
# DESCRIPTION
# Sample Shell Script to install Oracle APEX using AutoUpgrade Utility
#
#
# NOTES
# This script contains no resume capabilities. It also makes references to
# Oracle Linux Library path.
#
#
# MODIFIED (MM/DD/YY)
#
# Set APEX and Oracle Homes and sid
#
export APX_HOME="/scratch/kit/apx19"
export ORACLE_HOME="/scratch/base/1124"
export ORACLE_SID="db1124"
#
# Set Path and library
#
export PATH=$ORACLE_HOME/bin:$PATH
export LD_LIBRARY_PATH=$ORACLE_HOME/lib:$LD_LIBRARY_PATH
#
# Change directory to APEX home
#
cd $APX_HOME
#
# Remove and old log and list files
#
rm -f *.log
rm -f *.lst
#
# Write messages to progress.log file
#
echo "Installing APEX...." >> progress.log
echo "Starting Installing APEX...." >> progress.log
#
# Run the APEX Installation
#
$ORACLE_HOME/bin/sqlplus "/ as sysdba" @apexins SYSAUX SYSAUX TEMP /i/ > sqlplus.log
#
# Check for errors
#
echo "Completed Installing APEX...." >> progress.log
echo "Started checking status of the APEX Install" >> progress.log
retstat=`grep -i '^ORA-' *.log | wc -l | awk '{print $1}'`
echo "$retstat errors found" >> progress.log
echo "Finished checking status of the APEX Install" >> progress.log
#
# Write final progress and exit with success or failure status
#
if [ $retstat == 0 ]
then
   echo "Successful Install of APEX...." >> progress.log
   exit 0
fi
echo "Errors Found Installing APEX...." >> progress.log
echo "Check Installation logs at $APX_HOME" >> progress.log
exit 1

Microsoft Windows Systems:


# Copyright (c) 2016, 2019, Oracle and/or its affiliates. All rights reserved.
#
#
# DESCRIPTION
# Sample Windows PowerShell Script to install Oracle APEX using AutoUpgrade Utility
#
#
# NOTES
# This script contains no resume capabilities.
#
#
# MODIFIED (MM/DD/YY)
# 09/24/19 - Created
#
# Set APEX and Oracle Homes and sid
#
$env:APX_HOME="c:\kit\apx19"
$env:ORACLE_HOME="c:\oracle\1124"
$env:ORACLE_SID="db1124"
#
# Set Path
#
$powershell_path=$env:ORACLE_HOME + "\bin" + $env:PSModulePath
#
# Change directory to APEX home
#
cd $env:APX_HOME
#
# Remove and old log and list files
#
Remove-item * -Filter *.log
Remove-item * -Filter *.lst
#
# Write messages to progress.log file
#
Write-Output "Installing APEX...." | Out-File -FilePath .\progress.log -Append
Write-Output "Starting Installing APEX...." | Out-File -FilePath .\progress.log -Append
#
# Run the APEX Installation
#
sqlplus "/ as sysdba" "@apexins" SYSAUX SYSAUX TEMP /i/ | Out-File -FilePath sqlplus.log
#
# Check for errors
#
Write-Output "Completed Installing APEX...." | Out-File -FilePath .\progress.log -Append
Write-Output "Started checking status of the APEX Install" | Out-File -FilePath .\progress.log -Append
$retstat=(sls "^ORA-" *.log | Measure-Object -line).Lines
Write-Output "$retstat errors found" | Out-File -FilePath .\progress.log -Append
Write-Output "Finished checking status of the APEX Install" | Out-File -FilePath .\progress.log -Append
#
# Write final progress and exit with success or failure status
#
if ($retstat -eq 0) {
   Write-Output "Successful Install of APEX...." | Out-File -FilePath .\progress.log -Append
   exit 0
}
Write-Output "Errors Found Installing APEX...." | Out-File -FilePath .\progress.log -Append
Write-Output "Check Installation logs at $env:APX_HOME" | Out-File -FilePath .\progress.log -Append
exit 1