8i | 9i | 10g | 11g | 12c | 13c | 18c | 19c | 21c | 23c | Misc | PL/SQL | SQL | RAC | WebLogic | Linux

Home » Articles » Misc » Here

Oracle REST Data Services (ORDS) : Installation on Tomcat (ORDS Version 22.1 Onward)

This methods works for ORDS version 22.1 onward. If you want to use a version prior to ORDS 22.1, use the method described here.

Oracle REST Data Services (ORDS), formerly known as the APEX Listener, allows APEX applications to be deployed without the use of Oracle HTTP Server (OHS) and mod_plsql or the Embedded PL/SQL Gateway. ORDS version 3.0 onward also includes JSON API support to work in conjunction with the JSON support in the database. ORDS can be deployed on WebLogic, Tomcat or run in standalone mode. This article describes the installation of ORDS on Tomcat 9.

Related articles.

Assumptions

Multitenant : CDB or PDB Installation

When using the multitenant architecture there are several options for how to install ORDS. For this article we are going to install ORDS into the PDB. This is preferable for Lone-PDB installations (a CDB with one PDB), or for CDBs with small numbers of PDBs

If you are using many PDBs per CDB, you may prefer to install ORDS into the CDB. You can read more about the CDB installation options here.

Downloads

Download the following software. Always use the latest version available.

The latest version can always be downloaded from this URL. It doesn't include the version number in the file name, which means you have to unzip it to check the version, so I rarely use this.

ORDS Installation

Check the SYS user (or an alternative SYSDBA user) and common public users are unlocked and you know their passwords. Remember to lock the SYS user when the installation is complete.

conn / as sysdba
alter user sys identified by SysPassword1 account unlock;
--alter user sys identified by SysPassword1 account unlock container=all;

--alter session set container = pdb1;
alter user apex_listener identified by OraPassword1 account unlock;
alter user apex_public_user identified by OraPassword1 account unlock;
alter user apex_rest_public_user identified by OraPassword1 account unlock;

-- The next one will fail if you've never installed ORDS before. Ignore errors.
alter user ords_public_user identified by OraPassword1 account unlock;

Unzip the ORDS distribution. In this case we are doing this as the "tomcat" user on the server.

# su - tomcat
$ mkdir /u01/ords
$ cd /u01/ords
$ unzip /tmp/ords-22.1.0.105.1723.zip

Make a directory to hold the configuration, with a subdirectory for logs.

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

Unlike previous versions, from ORDS 22.1 onward we no longer run the "ords.war" file directly. Instead we use the "ords" script in the "bin" directory. For a silent installation we use command line arguments. The example below uses environment variables to supply argument values, as it's clearer when reading the ORDS command. Notice the passwords are sent in as a file redirect. If this were missing, we would be prompted for them.

export ORDS_HOME=/u01/ords
export ORDS_CONFIG=/u01/config/ords
export ORDS_LOGS=${ORDS_CONFIG}/logs
export DB_PORT=1521
export DB_SERVICE=pdb1
export SYSDBA_USER=SYS
export SYSDBA_PASSWORD=SysPassword1
export ORDS_PASSWORD=OraPassword1


${ORDS_HOME}/bin/ords --config ${ORDS_CONFIG} install \
     --log-folder ${ORDS_LOGS} \
     --admin-user ${SYSDBA_USER} \
     --db-hostname ${HOSTNAME} \
     --db-port ${DB_PORT} \
     --db-servicename ${DB_SERVICE} \
     --feature-db-api true \
     --feature-rest-enabled-sql true \
     --feature-sdw true \
     --gateway-mode proxied \
     --gateway-user APEX_PUBLIC_USER \
     --proxy-user \
     --password-stdin <<EOF
${SYSDBA_PASSWORD}
${ORDS_PASSWORD}
EOF

If the ORDS_CONFIG environment variable is set, we don't have to use the --config argument, but it's good to show it explicitly.

The full list of command line arguments, and their meanings, can be found here.

Lock the SYS user.

conn / as sysdba
alter user sys account lock;
--alter user sys account lock container=all;

You may find it useful to include the following change to your PATH variable, so you can runs the ords command without needing to explicitly include the path.

export PATH=${ORDS_HOME}/bin:$PATH

Tomcat Deployment

Copy the APEX images to the Tomcat "webapps" directory.

$ mkdir $CATALINA_BASE/webapps/i/
$ cp -R /tmp/apex/images/* $CATALINA_BASE/webapps/i/

Copy the "ords.war" file to the Tomcat "webapps" directory.

$ cd /u01/ords
$ cp ords.war $CATALINA_BASE/webapps/

The JAVA_OPTS environment variable must include a reference to the "-Dconfig.url" flag, to tell ORDS where to find the ORDS configuration. We can also set the Java heap size here. On Windows you may need to use the JAVA_TOOL_OPTIONS environment variable instead of JAVA_OPTS environment variable.

export JAVA_OPTS="-Dconfig.url=${ORDS_CONFIG} -Xms1024M -Xmx1024M"

After restarting Tomcat (see below) ORDS should now be accessible using the following type of URL.

http://<server-name>:<port>/ords/

http://ol7.localdomain:8080/ords/

Starting/Stopping ORDS Under Tomcat

ORDS is started or stopped by starting or stopping the Tomcat instance it is deployed to. Assuming you have the CATALINA_HOME environment variable set correctly, the following commands should be used.

export CATALINA_OPTS="$CATALINA_OPTS -Duser.timezone=UTC"
export JAVA_OPTS="-Dconfig.url=${ORDS_CONFIG} -Xms1024M -Xmx1024M"

$CATALINA_HOME/bin/startup.sh
$CATALINA_HOME/bin/shutdown.sh

ORDS Repair

You can repair the current ORDS installation using the following command.

export ORDS_HOME=/u01/ords
export ORDS_CONFIG=/u01/config/ords
export ORDS_LOGS=${ORDS_CONFIG}/logs

${ORDS_HOME}/bin/ords --config ${ORDS_CONFIG} install repair --interactive --log-folder ${ORDS_LOGS}

ORDS Uninstall

ORDS is uninstalled using the following command.

export ORDS_HOME=/u01/ords
export ORDS_CONFIG=/u01/config/ords

${ORDS_HOME}/bin/ords --config ${ORDS_CONFIG} uninstall --interactive

For more information see:

Hope this helps. Regards Tim...

Back to the Top.