How to upgrade Oracle APEX from 5.1.4 to 18.1

This is the 8th blog about Oracle APEX, you can find the full series list as below:

Introduction

Oracle APEX 18.1 has already been published several days, I believe most of apexers had tried it. The next thing we need to do is how to upgrade Oracle APEX from earlier version (such as 5.1.4) to the latest 18.1.

I quickly go through Oracle APEX 18.1 installation guide but not find a upgrade script I could use (even if there is also a sql named apxpatch.sql, I didn’t try it yet). Since the new APEX (db) schema is APEX_180100, I guess I have to reinstall APEX 18.1 this time.
The following upgrade steps are based on CentOS 6, Oracle database is 11gR2 and APEX 5.1.4.
The wonderful part I find out is I don’t have to reinstall my existed APEX applications after I upgrade APEX 18.1. All my data is still there (workspace, application and so on) and I could continue to use them painlessly. Thanks to what Oracle APEX team did!!
Here is a component list we could upgrade:

  • APEX:we will upgrade from earlier version to the latest 18.1;
  • ORDS:we will also upgrade it to the latest 18.1, and re-config and deploy to tomcat;
  • JAVA:ORDS 18.1 requires the lowest version of JDK/JRE is 1.8 or above;
  • Tomcat:ORDS 18.1 requires the lowest version of tomcat server is 8.5 or above;
  • Nignx:we need to adjust some configurations in nginx.conf if necessary;

OK, let’s begin the upgrade process.


Preparation

Upload installation media

I uploaded all installation media files to /u02/Media.

Shut down nginx and tomcat services.

1
2
3
4
5
## shutdown nginx service
service nginx stop

## shutdown tomcat service
service tomcat stop

Upgrade JDK/JRE 1.8

Use command java -version to check the current version of JDK. Per below picture, we can see the current version of JDK is 1.7. We have to upgrade to 1.8 or above to meet the requirement of ORDS 18.1.

JDK 1.8 Installation

1
yum install -y java-1.8.0-openjdk.x86_64 java-1.8.0-openjdk-devel.x86_64

We can update some values in ~/.bash_profile.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
# .bash_profile

# Get the aliases and functions
if [ -f ~/.bashrc ]; then
. ~/.bashrc
fi

# User specific environment and startup programs
export NLS_LANG=American_America.AL32UTF8
export JAVA_HOME=/u01/java/jdk1.8.0_162
export JRE_HOME=/u01/java/jdk1.8.0_162/jre
export ORACLE_SID=XE

PATH=/bin:/sbin:/usr/bin:$JAVA_HOME/bin:$JRE_HOME/bin:$PATH:$HOME/bin
export PATH

CLASSPATH=$JAVA_HOME/lib/tools.jar:$JAVA_HOME/lib/dt.jar:$JAVA_HOME/lib:$JRE_HOME/lib:$CLASSPATH
export CLASSPATH

Manually initialize environment variables.

1
2
3
4
source ~/.bash_profile

## Check java version again
java -version

We find out the version of JDK is 1.8 now.

Upgrade Tomcat Server

I checked my tomcat server and found out it was version 7. I have to upgrade it to version 8.5 or above to meet requirements of ORDS 18.1.

Download installation media of Tomcat server 8.5

1
2
3
4
5
6
7
8
9
cd /u02/Media

wget http://mirrors.shu.edu.cn/apache/tomcat/tomcat-8/v8.5.31/bin/apache-tomcat-8.5.31.zip

unzip apache-tomcat-8.5.31.zip
mv apache-tomcat-8.5.31/* /u01/tomcat8

chown -Rf tomcat:tomcat /u01/tomcat8
chmod -Rf 755 /u01/tomcat8/bin/*

Since I use CentOS 6, I have to adjust some values of /etc/init.d/tomcat.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
#!/bin/bash
# description: Tomcat Start Stop Restart
# processname: tomcat
# chkconfig: 234 20 80
JAVA_HOME=/u01/java/jdk1.8.0_162
export JAVA_HOME
PATH=$JAVA_HOME/bin:$PATH
export PATH
CATALINA_HOME=/u01/tomcat8

case $1 in
start)
/bin/su tomcat $CATALINA_HOME/bin/startup.sh
;;
stop)
/bin/su tomcat $CATALINA_HOME/bin/shutdown.sh
;;
restart)
/bin/su tomcat $CATALINA_HOME/bin/shutdown.sh
/bin/su tomcat $CATALINA_HOME/bin/startup.sh
;;
esac

. /root/firewall.sh

exit 0

start tomcat service and validate it.

1
service tomcat start

We can see the tomcat 8.5 is started and the JDK we used is 1.8 now.

Open your web explorer and type http://xxx.xxx.xxx.xxx:8080,you should also see the wellcome page of tomcat.


Upgrade APEX 18.1

1
2
3
cd /u02/Media/

unzip apex_18.1.zip

Execute installation of APEX 18.1

1
2
3
su - oracle

cd /u02/Media/apex
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
sqlplus / as sysdba

-- recommend to create new tablespace for APEX
SQL> create tablespace APEX181 DATAFILE '/u03/oradata/apex181.dbf' SIZE 1024m REUSE AUTOEXTEND ON NEXT 100M MAXSIZE UNLIMITED;

-- the whole installation of APEX 18.1 might last 5-10 minutes.
-- here APEX181 is the new tablespace we created just now
SQL> @apexins APEX181 APEX181 temp /i/

-- reset password of apex administration
SQL> @apxchpwd

-- config RESTful Services
SQL> @apex_rest_config.sql

-- disable embeded PL/SQL gateway since we will use ORDS later
SQL> exec dbms_xdb.sethttpport(0);
SQL> exec dbms_xdb.setftpport(0);

-- unlock ORDS user account
SQL> alter user apex_public_user account unlock;
SQL> alter user apex_public_user identified by "your password";

SQL> exit

copy apex static files to tomcat folder

1
2
3
4
5
6
su - root

mkdir -p /u01/tomcat8/webapps/i/
cp -a /u02/Media/apex/images/* /u01/tomcat8/webapps/i/

chown -Rf tomcat:tomcat /u01/tomcat8/webapps/

Upgrade ORDS 18.1

1
2
mkdir -p /u01/ords
unzip /u02/Media/ords.18.1.1.95.1251.zip -d /u01/ords/

Execute installation of ORDS

1
2
3
cd /u01/ords

java -jar ords.war install advanced

grant read privilege to make sure tomcat user could read files in folder /u01/ords/conf

1
chown -R tomcat:tomcat /u01/ords/conf

deploy ords.war to Tomcat

1
2
3
4
5
6
cp -a /u01/ords/ords.war /u01/tomcat8/webapps/

chown -Rf tomcat:tomcat /u01/tomcat8/webapps/

## restart tomcat service
service tomcat restart

Validate ORDS deployment

open your web explorer, navigate to http://xxx.xxx.xxx.xxx:8080/ords . If you could see apex page, congratulations!!


Nginx Configiration (optional)

Review your nginx.conf and check if there are something need to be changed,such as path of static file folder i

Test your environment

Open your web explorer again, navigate to http://xxx.xxx.xxx.xxx/ords . If you could see apex page, congratulations again!!

Login APEX Administration and switch toExisted Workspace,you will find all existed workspaces.

Login APEX with your workspace, all applications are there. Perfect!!


Conclusion

Now you have successfully upgraded your earlier version of APEX to the latest version 18.1.

本文标题:How to upgrade Oracle APEX from 5.1.4 to 18.1

文章作者:王方钢 / Kenny Wang

发布时间:2018年05月30日 - 08:05

最后更新:2018年09月10日 - 20:09

原始链接:https://wangfanggang.com/Oracle/Oracle-APEX/how-to-upgrade-apex-from-5-1-4-to-18-1/

许可协议: 署名-非商业性使用-禁止演绎 4.0 国际 转载请保留原文链接及作者。

王方钢 / Kenny Wang wechat
王方钢 | 智叟网络
0%