Install Oracle APEX & ORDS 24.x.x on Oracle Linux

As you might have already noticed, mostly I post instructions for installing Oracle software on Windows. Today, I will try to walk you through the Linux installations for APEX, ORDS and Apache Tomcat. Please note, my attempts are against an existing multitenant Oracle EBS database/environment. Extending Oracle EBS database requires you to strictly adhere to multiple conditions. Please make sure that you WILL refer this document prior attempting the rest of the article.

Make sure you will be downloading the latest software. If you are using Windows machine to download the software, move them to a path that your oracle user has access to, eg(/u01/oracle/Downloads)

Extract the archives to paths without space.

SSH/VNC to your linux box and switch to the path where you have extracted the APEX installation sources. First of all, let us check whether the PDB already has an APEX installation

oracle@apps.example.com:/home/oracle/Downloads/apex-latest/apex>sqlplus / as sysdba

SQL*Plus: Release 19.0.0.0.0 - Production on Fri Nov 24 18:37:56 2023
Version 19.17.0.0.0

Copyright (c) 1982, 2022, Oracle.  All rights reserved.


Connected to:
Oracle Database 19c Enterprise Edition Release 19.0.0.0.0 - Production
Version 19.17.0.0.0

SQL> alter session set container="TEST";

Session altered.

select version from dba_registry where comp_id='APEX';

Normal cases there shouldn’t be a default installation of APEX available with Oracle EBS database. Next step is to create a tablespace for APEX

SQL>CREATE TABLESPACE APEX DATAFILE '/u01/oratest/TEST/db/apps_st/data/apex01.dbf' size 2G;

Once the new tablespace is created, we are ready to install APEX

SQL> @apexins.sql APEX APEX TEMP /i/

Depending upon the resources available, this installation could take considerable time. Once done, execute “apxchpwd.sql” from the same session.

SYS> @apxchpwd.sql
...set_appun.sql
================================================================================
This script can be used to change the password of an Oracle APEX
instance administrator. If the user does not yet exist, a user record will be
created.
================================================================================
Enter the administrator's username [ADMIN]
User "ADMIN" does not yet exist and will be created.
Enter ADMIN's email [ADMIN] youremail@yourdomain.com
Enter ADMIN's password [] <== Use the same password across for a TEST environment
Created instance administrator ADMIN.

From the same session, execute “apex_rest_config.sql”

SQL> @apex_rest_config.sql

PL/SQL procedure successfully completed.
PL/SQL procedure successfully completed.


Enter a password for the APEX_LISTENER user              [] <== use the common password
Enter a password for the APEX_REST_PUBLIC_USER user              [] <== use the above password

Unlock all APEX database user accounts before moving ahead. We’ve the user profile DEFAULT set with no password expiry. This is real pain and an expired password could completely make your day spoiled. Follow PRODUCTION instructions if you are setting it for it. Basically you only need to unlock the user “apex_public_user”

SQL>alter user apex_listener identified by <<common password>> account unlock;
/
SQL>alter user apex_public_user identified by <<common password>> account unlock; 
/
SQL>alter user apex_rest_public_user identified by <<common password>> account unlock;
/

if you have valid Oracle support, download and apply the APEX patch set 6 before installing ORDS. Please note, Oracle EBS server is a complex environment and setting up ORDS on the same server is highly discouraged as ORDS software, network PORTS requirement could cause total service outage. I recommend setting up a different server for ORDS. Regardless, the following instructions are for the same TEST server where APEX was installed already.

Oracle Linux comes preinstalled with OpenJDK and ORDS doesn’t support it. Hence you must remove it and install a supported version. I am using JDK 17 for the purpose. Please follow the instructions available here

https://support.cbaliveassist.com/hc/en-us/articles/360001020438-How-to-remove-OpenJDK-and-install-Oracle-JDK

or

Oracle EBS database doesn’t allow you to connect as “SYS” from remote locations & you can override it by adding a password file which I will not encourage. If you insist, please execute the following instructions.

cd $ORACLE_HOME/dbs
oracle@apps.example.com:/u01/oratest/TEST/db/tech_st/19.0.0/dbs>orapwd file=orapwTESTCDB  password=<<your password>> entries=5
SQL>alter system set REMOTE_LOGIN_PASSWORDFILE=EXCLUSIVE scope=spfile;
SQL>alter user sys identified by <<your password>> account unlock container=all;

Instead, you can “simply” grant “sysdba” role to system account!

sqlplus / as sysdba
SQL> grant sysdba to system container=all;

Revoke the grants once the activities are over.

Now switch to the path where latest ORDS installation sources were extracted and execute “ords_installer_privileges.sql”

sqlplus / as sysdba
SQL> alter session set container="TEST";
SQL> @ords_installer_privileges.sql system

Change the permissions for “ords” executable now.

oracle@apps.example.com:/home/oracle/Downloads/ords-latest/bin>chmod +x ords

I setup ORDS on /u01/ords path. Hence, the following folders were created for configuration files and logs. As oracle user

mkdir -p /u01/ords /u01/ords/config /u01/ords/logs

Now, we are ready to install ORDS interactive mode. I preferred interactive mode than silent mode for a better understanding. ORDS 24.1 automatically picks up TNS entries for the CDB, hence make sure to select “S” from the options provided.

/home/oracle/Downloads/ords-latest/bin>ords --config /u01/ords/config install --interactive --log-folder /u01/ords/logs

Oracle REST Data Services - Interactive Install

  Enter a number to select the TNS net service name to use from /u01/oratest/TEST/db/tech_st/19.0.0/network/admin/tnsnames.ora or specify the database connection
    [1] TESTCDB      SERVICE_NAME=TESTCDB
    [2] EXTPROC_CONNECTION_DATA SID=PLSExtProc
    [S] Specify the database connection
  Choose [1]: S
  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]:
 Enter the database host name [localhost]: apps.example.com
  Enter the database listen port [1521]: 1526
  Enter the database service name [TESTCDB]: TEST
  Provide database user name with administrator privileges.
    Enter the administrator username: system
  Enter the database password for system:

I’ve created two new tablespaces for ORDS, as version 24.x has many new prompts & I’ve noticed that the EBS PDB doesn’t have a TEMP tablespace.

CREATE TABLESPACE ORDS DATAFILE '/u01/oratest/TEST/db/apps_st/data/ords01.dbf' SIZE 1G
/
CREATE TEMPORARY TABLESPACE ORDS_TEMP TEMPFILE '/u01/oratest/TEST/db/apps_st/data/ords_temp_01.dbf' SIZE 1G;
/

The next list of prompts is quite long & mostly we need to deal with 3,4,6,9 which are respectively for setting up ORDS_PUBLIC_USER user password and default tablespaces followed by whether you want to configure as standalone server.

Enter a number to update the value or select option A to Accept and Continue
    [1] Connection Type: Basic
    [2] Basic Connection: HOST=apps.example.com PORT=1526 SERVICE_NAME=TEST
           Administrator User: system
    [3] Database password for ORDS runtime user (ORDS_PUBLIC_USER): <generate>
    [4] ORDS runtime user and schema tablespaces:  Default: SYSAUX Temporary TEMP
    [5] Additional Feature: Database Actions
    [6] Configure and start ORDS in Standalone Mode: Yes
    [7]    Protocol: HTTP
    [8]       HTTP Port: 8080
    [9]   APEX static resources location:
    [A] Accept and Continue - Create configuration and Install ORDS in the database
    [Q] Quit - Do not proceed. No changes
  Choose [A]: 3
  Enter your choice for the runtime user password (ORDS_PUBLIC_USER)
    [S] Specify your own password
    [G] Generate password
    [C] Cancel - No Changes
  Choose [G]: S
  Enter the database password for ORDS_PUBLIC_USER:
Confirm password:

Once the password for ORDS_PUBLIC_USER set, select the option 4

 Enter a number to update the value or select option A to Accept and Continue
    [1] Connection Type: Basic
    [2] Basic Connection: HOST=apps.example.com PORT=1526 SERVICE_NAME=TEST
           Administrator User: system
    [3] Database password for ORDS runtime user (ORDS_PUBLIC_USER): <specified password>
    [4] ORDS runtime user and schema tablespaces:  Default: SYSAUX Temporary TEMP
    [5] Additional Feature: Database Actions
    [6] Configure and start ORDS in Standalone Mode: Yes
    [7]    Protocol: HTTP
    [8]       HTTP Port: 8080
    [9]   APEX static resources location:
    [A] Accept and Continue - Create configuration and Install ORDS in the database
    [Q] Quit - Do not proceed. No changes
  Choose [A]: 4
  Enter the default tablespace for ORDS_METADATA and ORDS_PUBLIC_USER [SYSAUX]: ORDS
  Enter the temporary tablespace for ORDS_METADATA and ORDS_PUBLIC_USER [TEMP]: ORDS_TEMP

Now, we should decide whether to setup ORDS as a standalone server. This means, ORDS will use built-in jetty server to start the ORDS services, which I don’t prefer. Let us see how the options switch when we select option 6 (changes highlighted). For this article I chose 6 to setup Standalone mode.

Choose [A]: 6
  Enter a number to update the value or select option A to Accept and Continue
    [1] Connection Type: Basic
    [2] Basic Connection: HOST=apps.example.com PORT=1526 SERVICE_NAME=TEST
           Administrator User: system
    [3] Database password for ORDS runtime user (ORDS_PUBLIC_USER): <specified password>
    [4] ORDS runtime user and schema tablespaces:  Default: ORDS Temporary ORDS_TEMP
    [5] Additional Feature: Database Actions
    [6] Configure and start ORDS in Standalone Mode: No
    [A] Accept and Continue - Create configuration and Install ORDS in the database
    [Q] Quit - Do not proceed. No changes
Choose [A]: 6
  Enter a number to update the value or select option A to Accept and Continue
    [1] Connection Type: Basic
    [2] Basic Connection: HOST=apps.example.com PORT=1526 SERVICE_NAME=TEST
           Administrator User: system
    [3] Database password for ORDS runtime user (ORDS_PUBLIC_USER): <specified password>
    [4] ORDS runtime user and schema tablespaces:  Default: ORDS Temporary ORDS_TEMP
    [5] Additional Feature: Database Actions
    [6] Configure and start ORDS in Standalone Mode: Yes
    [7]    Protocol: HTTP
    [8]       HTTP Port: 8080
    [9]   APEX static resources location:
    [A] Accept and Continue - Create configuration and Install ORDS in the database
    [Q] Quit - Do not proceed. No changes

If we are going ahead with Standalone mode enabled, then we must specify the APEX static resources location by choosing option 9. Copy the images folder from APEX installation folder to /u01/ords/

Choose [A]: 9
  Enter the APEX static resources location: /u01/ords/images
Enter a number to update the value or select option A to Accept and Continue
    Choose [A]: 9
  Enter the APEX static resources location: /u01/ords/images  

Now we can accept the changes and proceed by selecting the option “A”

Enter a number to update the value or select option A to Accept and Continue
    [1] Connection Type: Basic
    [2] Basic Connection: HOST=apps.example.com PORT=1526 SERVICE_NAME=TEST
           Administrator User: system
    [3] Database password for ORDS runtime user (ORDS_PUBLIC_USER): <specified password>
    [4] ORDS runtime user and schema tablespaces:  Default: ORDS Temporary ORDS_TEMP
    [5] Additional Feature: Database Actions
    [6] Configure and start ORDS in Standalone Mode: Yes
    [7]    Protocol: HTTP
    [8]       HTTP Port: 8080
    [9]   APEX static resources location: /u01/ords/images
    [A] Accept and Continue - Create configuration and Install ORDS in the database
    [Q] Quit - Do not proceed. No changes
  Choose [A]: A

ORDS installation is pretty straight forward. If you didn’t change the ORDS_PUBLIC_USER password during the above, please keep in mind that changing the password later could force you to reconfigure ORDS. Once the installation is over, ORDS built-in jetty server automatically start. You can access the APEX interface now from http://localhost:8080/ords. Use ctrl+c to kill the server.

Now we will install and configure Apache Tomcat for the webserver serving ORDS. Version 9 was the latest one supported for ORDS, hence we will proceed with the same version. Keep on checking Oracle’s announcements to know when the later versions are certified for ORDS. Download the tar.gz file from the download repository & extract to /u01/apache-tomcat/

Now switch to /u01/apache-tomcat/conf path and let us quickly make few modifications. As my server is already running Oracle EBS on port number 8005, I had to change this to next available port so that Apache Tomcat could go online.

Edit the “server.xml” file and make the changes as with the image below and make sure that you are not running other application on the port 8080. If yes, you will have to reconfigure ORDS once again with the next available port (I am not sure whether it would truly affect incase if you are not using Standalone mode)

Now we have to copy few files to Apache repositories.

oracle@apps.example.com:/home/oracle/Downloads/ords-latest>cp ords.war /u01/apache-tomcat/webapps
oracle@apps.example.com:/home/oracle/Downloads/apex-latest/apex>scp -pr images /u01/apache-tomcat/webapps/i

It’s time to start Apache Tomcat server! As user oracle

oracle@apps.example.com:/u01/apache-tomcat/bin>export ORDS_CONFIG=/u01/ords/config
oracle@apps.example.com:/u01/apache-tomcat/bin>export JAVA_OPTS="-Dconfig.url=${ORDS_CONFIG} -Xms1024M -Xmx1024M"
oracle@apps.example.com:/u01/apache-tomcat/bin>./startup.sh
Using CATALINA_BASE:   /u01/apache-tomcat
Using CATALINA_HOME:   /u01/apache-tomcat
Using CATALINA_TMPDIR: /u01/apache-tomcat/temp
Using JRE_HOME:        /usr
Using CLASSPATH:       /u01/apache-tomcat/bin/bootstrap.jar:/u01/apache-tomcat/bin/tomcat-juli.jar
Using CATALINA_OPTS:
Tomcat started.

If there are no configuration issues, Apache Tomcat server should start serving now.

Oracle APEX Summit sample application

Recently, after setting up APEX for the nth time, I wanted to give the stack a try. I’ve been developing around Oracle technologies for more than 20 years and I felt it was the time. After some serious searches, I came across an Oracle blog that was discussing about migrating from Oracle Forms & APEX, which I was looking for.

[Forms to APEX] Creating a Migration Project (oracle.com)

By the end of the article, author had given a link to the sample application “Summit” that was directly migrated from Oracle Forms. Currently, APEX doesn’t support direct migrations from anymore. Regardless, the example project was truly informative. I suggest you to create a document using the explanations provide with the blog, which could help you with many details later.

As on 28th November 2024, against the feedback, Oracle APEX team has updated the download section with a latest export & it works without any issues once after imported. Hence, majority of the bashing has been removed from this post ;)

Although you can import the application database objects to an existing schema, it is better to be on a schema dedicated for the application so that you don’t have to scavenge through dozens of objects to identify the app specific ones.

CREATE USER SUMMIT IDENTIFIED BY SUMMIT
DEFAULT TABLESPACE EXAMPLE
TEMPORARY TABLESPACE TEMP
/
GRANT DBA TO SUMMIT
/
GRANT CONNECT TO SUMMIT
/
GRANT RESOURCE TO SUMMIT
/

Newly created “Summit” schema prior the demo application installation.

Once you created the schema, add it to your APEX workspace and import the APEX sample application that you downloaded. It is a pretty straight forward thing and when the installer asks you to install the additional components, proceed.

Do not forget to change the Parsing Schema in case if your workspace is associated with multiple schemas.

Proceed with the installation. It takes just few seconds and must install the supporting Objects (that are tables, procedures, sequences, functions etc).

Run the application and you should be welcomed with a beautiful dashboard!

Oracle APEX on Apache Tomcat

Referred documents

https://oracle-base.com/articles/misc/oracle-rest-data-services-ords-installation-on-tomcat-windows

Oracle keeps releasing new versions of both APEX and ORDS once in couple of months, if not weeks. Posting a fresh article for each and every other version looks pretty hectic and I have decided to maintain a single post with specific instructions for versions that I tested at lab. Please refer “Install APEX on Windows” for details about installing APEX on Windows.

Assuming the APEX with ORDS installation all good, we will see how to setup ORDS using Apache Tomcat now. Please note, Apache Tomcat 9.x is the latest version supported by ORDS. You can read about the differences between Tomcat 9 and Tomcat 10 here (As on 23rd Dec 2023, Tomcat10 doesn’t work with ORDS)

I suggest going with the Zip package. You can opt for the Windows Service installer, if you are setting APEX for regular development or PRODUCTION usage. Please refer the following link for detailed information about setting up Apache Tomcat on Windows. https://phoenixnap.com/kb/install-tomcat-window

Let’s setup Apache Tomcat for ORDS now, assuming Apache Windows Service is not installed.

I have the Tomcat 9 software extracted to the folder to D:\apache-tomcat. Please make sure that you will setup the server.xml with ports that are freely available on your system prior attempting to start the web server.

The following are the areas you must thoroughly confirm within the server.xml file that is available in “conf” folder.

Let’s quickly make some minor change to web.xml, allowing directory browsing. We’ll change the listing parameter value from “false” to “true”

There are many other changes we must make for a PRODUCTION instance. For the current purpose, this is enough to start with.

Now, we will quickly copy the ORDS and APEX images to Tomcat apps section so that they could be mapped.

  1. Copy “ords.war” from the ORDS installation source to webapps
  2. Copy the “images” folder from APEX installation source & rename it to “i”
  3. Refer the below image for details.

From an elevated command prompt, switch to Apache Tomcat BIN folder. We need to setup some environment variables prior starting Tomcat server.

D:\apache-tomcat\bin>set JAVA_HOME=C:\Java\jdk-17 --JDK path

D:\apache-tomcat\bin>set ORDS_CONFIG=D:\ORDS\config --location that was selected for configuring ORDS, this location has all details for database connection and more.

D:\apache-tomcat\bin>set JAVA_OPTS="-Dconfig.url=%ORDS_CONFIG%" -Xms1024M -Xmx2G --Dconfig.url is the place where Tomcat server looks for ORDS configurations. Finaly Xms and Xmx are the JAVA min and max memory settings. For PRODUCTION, these parameters should be configured precisely to avoid performance bottlenecks.

D:\apache-tomcat\bin>startup --will start the web server.

Let us try to access ORDS now. The below is the landing page, from which you can start SQL Developer Web APEX and ORDS authentication.

You can use “shutdown.bat” to stop the Tomcat server.

If set is expected to be used for longer intervals, we can install Tomcat as Windows Service. Please note the forward slashes “/”. Oracle allows both forward and backward slashes for these kind of settings.

Note the service name “Tomcat9”. You should use the same name, so that the service configuration executable(tomcat9w.exe) can be used for setting up ORDS specifics at post service installation.

Once the service installed, let us quickly move to Tomcat bin folder. Open “tomcat9w.exe”

let’s configure the JAVA options section with the “-Dconfig.url”, pointing to the ORDS config path.

Start the “Apache Tomcat 9.0 tomcat9” Windows service now. Set the service to start manually or automatic based on your requirements. Remember, ORDS will not start if the database instance is not open.