How to install Oracle Apex with ORDS and Apache Tomcat on Oracle Database 19c

Mohsin Ali

This document shows how to install and configure Oracle Apex 22.2 with ORDS and Apache Tomcat 8 on Oracle Database 19c PDB.

Download Oracle Apex 22.2, ORDS, Apache Tomcat and JDK 11:

wget --no-check-certificate https://download.oracle.com/otn_software/apex/apex-latest.zip   ##With this link version keeps on changing, Download 21.2 from internet  
wget --no-check-certificate https://download.oracle.com/otn_software/java/ords/ords-latest.zip
wget --no-check-certificate https://dlcdn.apache.org/tomcat/tomcat-8/v8.5.91/bin/apache-tomcat-8.5.91.tar.gz
Download JDK 11 - https://www.oracle.com/pk/java/technologies/javase/jdk11-archive-downloads.html

Place the Oracle Apex 22.2, ORDS, Apache Tomcat and JDK 11 in /u01 (as per your environment) and unzip and create environment file:

[oracle@himstest]$ vi /home/oracle/apex.env

export APEX_HOME=/u01/apex
export ORDS_HOME=/u01/ords
export ORDS_CONFIG=/u01/ords
export TOMCAT_HOME=/u01/apache-tomcat-8.5.91
export PATH=$ORDS_HOME/bin:$JAVA_HOME/bin:$PATH

Copy images from APEX extracted folder to Tomcat webapps, and rename the folder from “images” to “i”:

[oracle@himstest]$ source /home/oracle/apex.env

[oracle@himstest]$ cp -Rp $APEX_HOME/images $TOMCAT_HOME/webapps
[oracle@himstest]$ mv $TOMCAT_HOME/webapps/images $TOMCAT_HOME/webapps/i

We are going to install APEX in PDB. Before doing that, we need to uninstall APEX, if it already exists:

[oracle@himstest]$ export ORACLE_PDB_SID=TEST
[oracle@himstest]$ sqlplus / as sysdba

SQL> SELECT STATUS FROM DBA_REGISTRY WHERE COMP_ID = 'APEX';

If query returns APEX, it means default APEX exists, then remove it:

SQL> @$ORACLE_HOME/apex/apxremov.sql

Verify the status to make sure APEX is uninstalled:


[oracle@himstest]$ export ORACLE_PDB_SID=TEST
[oracle@himstest]$ sqlplus / as sysdba

SQL> SELECT STATUS FROM DBA_REGISTRY WHERE COMP_ID = 'APEX';

Create APEX_DATA and APEX_FILES tablespaces:

[oracle@himstest]$ export ORACLE_PDB_SID=TEST
[oracle@himstest]$ sqlplus / as sysdba

SQL> create tablespace APEX_DATA datafile '/u01/app/oracle/oradata/APEX/datafile/apex_data01.dbf' size 2G;
SQL> create tablespace APEX_FILES datafile '/u01/app/oracle/oradata/APEX/datafile/apex_files01.dbf' size 2G;

Disable default password complexity rules:

[oracle@himstest]$ sqlplus / as sysdba
SQL> ALTER PROFILE DEFAULT LIMIT PASSWORD_VERIFY_FUNTION NULL;

Now we install Apex 21.2 in PDB:

[oracle@himstest]$ export ORACLE_PDB_SID=TEST

[oracle@himstest]$ cd /u01/apex/
[oracle@himstest apex]$ sqlplus / as sysdba

SQL> @apexins APEX_DATA APEX_FILES TEMP /i/

Check validity of installation:

[oracle@himstest apex]$ export ORACLE_PDB_SID=TEST
[oracle@himstest apex]$ sqlplus / as sysdba

SQL> SELECT STATUS FROM DBA_REGISTRY WHERE COMP_ID = 'APEX';
SQL> SET LINESIZE 500
SQL> COLUMN username FORMAT A25
SQL> SELECT * FROM ALL_USERS WHERE username LIKE '%APEX%' OR username LIKE '%FLOWS%';

Unlock Public user and setup up Apex Admin Password:

[oracle@himstest]$ cd /u01/apex/
[oracle@himstest apex]$ export ORACLE_PDB_SID=TEST

[oracle@himstest apex]$ sqlplus / as sysdba
SQL> ALTER USER apex_public_user IDENTIFIED BY "welcome1" ACCOUNT UNLOCK;

Setting up Apex Admin Password:
SQL> @apxchpwd.sql

Enable Network Services (change the value of principal_name according to your installation schema):

[oracle@himstest]$ export ORACLE_PDB_SID=TEST
[oracle@himstest]$ sqlplus / as sysdba

SQL> BEGIN
DBMS_NETWORK_ACL_ADMIN.APPEND_HOST_ACE(
host => '*',
ace => xs$ace_type(privilege_list => xs$name_list('connect'),
principal_name => 'APEX_220200',
principal_type => xs_acl.ptype_db));
END;
/

Principal_Name must be the result of below query:
select username,created from all_users where USERNAME like '%APEX%';

Configure RESTful Services. In this step you will need to provide credentials for the users: APEX_LISTENER and APEX_REST_PUBLIC_USER:

[oracle@himstest]$ cd /u01/apex/
[oracle@himstest apex]$ export ORACLE_PDB_SID=TEST
[oracle@himstest apex]$ sqlplus / as sysdba

SQL> @apex_rest_config.sql

Enter a password for the APEX_LISTENER user [] welcome1
Enter a password for the APEX_REST_PUBLIC_USER user [] welcome1

Install ORDS:

[oracle@himstest]$ . /home/oracle/apex.env
[oracle@himstest]$ cd $ORDS_HOME
[oracle@himstest ords]$ ords install

If above does not work then use:
[oracle@himstest ords]$ java -jar ords.war install
[oracle@himstest ords]$ ords install
2023-03-29T06:29:57.375Z INFO Your configuration folder /u01/ords is located in ORDS product folder. Oracle recommends to use a different configuration folder.

ORDS: Release 22.4 Production on Wed Mar 29 06:29:57 2023

Copyright (c) 2010, 2023, Oracle.

Configuration:
/u01/ords

The configuration folder /u01/ords does not contain any configuration files.

Oracle REST Data Services - Interactive Install

Enter a number to select the type of installation
[1] Install or upgrade ORDS in the database only
[2] Create or update a database pool and install/upgrade ORDS in the database
[3] Create or update a database pool only
Choose [2]: 2
Enter a number to select the database connection type to use
[1] Basic (host name, port, service name)
[2] TNS (TNS alias, TNS directory)
[3] Custom database URL
Choose [1]: 1
Enter the database host name [localhost]: himstest
Enter the database listen port [1521]:
Enter the database service name [orcl]: TEST
Provide database user name with administrator privileges.
Enter the administrator username: sys
Enter the database password for SYS AS SYSDBA:
Connecting to database user: SYS AS SYSDBA url: jdbc:oracle:thin:@//himstest:1521/TEST

Retrieving information.
Enter the default tablespace for ORDS_METADATA and ORDS_PUBLIC_USER [SYSAUX]: APEX_DATA
Enter the temporary tablespace for ORDS_METADATA and ORDS_PUBLIC_USER [TEMP]:
Enter a number to select additional feature(s) to enable:
[1] Database Actions (Enables all features)
[2] REST Enabled SQL and Database API
[3] REST Enabled SQL
[4] Database API
[5] None
Choose [1]:
Enter a number to configure and start ORDS in standalone mode
[1] Configure and start ORDS in standalone mode
[2] Skip
Choose [1]:
Enter a number to select the protocol
[1] HTTP
[2] HTTPS
Choose [1]:
Enter the HTTP port [8080]:
Enter the APEX static resources location: /u01/apache-tomcat-8.5.91/webapps/i
After ORDS installation completes, It automatically starts the Services, 
we have to stop it:

CTRL + C
KILL ords process

Copy ords.war in Apache Webapps:

[oracle@himstest]$ . /home/oracle/apex.env
[oracle@himstest]$ cp $ORDS_HOME/ords.war $TOMCAT_HOME/webapps

Start Apex services from Apache Tomcat:


[oracle@himstest]$ cd $TOMCAT_HOME/bin
[oracle@himstest bin]$ ./startup.sh

Login to the APEX console as the INTERNAL workspace and user ADMIN:

http://hostname:8080/ords/

To Stop Apex Services:

[oracle@himstest]$ cd $TOMCAT_HOME/bin
[oracle@himstest bin]$ ./startup.sh

Add Environment file in bash profile:

[oracle@himstest]$ vi .bash_profile

export APEX_HOME=/u01/apex
export ORDS_HOME=/u01/ords
export ORDS_CONFIG=/u01/ords
export TOMCAT_HOME=/u01/apache-tomcat-8.5.91
export PATH=$ORDS_HOME/bin:$JAVA_HOME/bin:$PATH

save

To Stop Apex Services:

[oracle@himstest]$ cd $TOMCAT_HOME/bin
[oracle@himstest bin]$ ./shutdown.sh

Configure this on TEST environment and then move to othe Environment.

Sign up to discover human stories that deepen your understanding of the world.

Free

Distraction-free reading. No ads.

Organize your knowledge with lists and highlights.

Tell your story. Find your audience.

Membership

Read member-only stories

Support writers you read most

Earn money for your writing

Listen to audio narrations

Read offline with the Medium app

Responses (4)

Write a response