Tuesday, May 22, 2018

Oracle APEX, ORDS Deployment on Apache Tomcat

Steps of Oracle APEX, ORDS Deployment on Apache Tomcat

1. Install Oracle Database

2. Create a tablespace.

CREATE TABLESPACE APEX_DATA DATAFILE '/u01/APEX/db/data/apex_001.dbf' SIZE 500M AUTOEXTEND ON NEXT 1M;

3. Download Oracle appex and unzip ( Also ORACLE_HOME/apex directory can be used )

sqlplus / as sysda

SQL> -- @apexins.sql tablespace_apex tablespace_files tablespace_temp images
SQL>
SQL> @apexins.sql APEX_DATA APEX_DATA TEMP /i/

SQL> @apxchpwd.sql

SQL> @apex_rest_config.sql

SQL> @apex_epg_config.sql /u01/APEX/db/11.2.0

SQL> ALTER USER ANONYMOUS ACCOUNT UNLOCK;

Check the port setting for XML DB Protocol Server.

SQL> SELECT DBMS_XDB.gethttpport FROM DUAL;

GETHTTPPORT
-----------
          0

1 row selected.

SQL>

If it is set to "0", you will need to set it to a non-zero value to enable it.

SQL> EXEC DBMS_XDB.sethttpport(8080);

PL/SQL procedure successfully completed.

4. Check the APEX URL is working fine. http://<server-name>:<port>/apex

5. Download and unzip Apache Tomcat

# su - tomcat

export JAVA_HOME=/home/tomcat/jdk1.8.0_77
export CATALINA_HOME=/home/tomcat/apache-tomcat-7.0.68
export CATALINA_BASE=$CATALINA_HOME

Start and stop Tomcat using the following scripts.

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


6. Configure ORDS using following steps.

ALTER USER APEX_LISTENER IDENTIFIED BY manager#123 ACCOUNT UNLOCK;
ALTER USER APEX_PUBLIC_USER IDENTIFIED BY manager#123 ACCOUNT UNLOCK;
ALTER USER APEX_REST_PUBLIC_USER IDENTIFIED BY manager#123 ACCOUNT UNLOCK;

-- The next one will fail if you've never installed ORDS before. Ignore errors.
ALTER USER ORDS_PUBLIC_USER IDENTIFIED BY manager#123 ACCOUNT UNLOCK;

# su - tomcat
$ mkdir /home/tomcat/ords
$ cd /home/tomcat/ords
$ unzip /tmp/ords.3.0.11.180.12.34.zip /home/tomcat/ords

mkdir -p /home/tomcat/ords/conf

Edit the "/u01/ords/params/ords_params.properties

-------------------------------------------------------------------------------
db.hostname=oracle.test.com
db.port=1521
db.servicename=ords
#db.sid=
db.username=APEX_PUBLIC_USER
db.password=manager#123
migrate.apex.rest=false
rest.services.apex.add=true
rest.services.ords.add=true
schema.tablespace.default=APEX_DATA
schema.tablespace.temp=TEMP
standalone.mode=false
#standalone.use.https=true
#standalone.http.port=8080
#standalone.static.images=/home/oracle/apex/images
user.apex.listener.password=manager#123
user.apex.restpublic.password=manager#123
user.public.password=manager#123
user.tablespace.default=APEX_DATA
user.tablespace.temp=TEMP
sys.user=SYS
sys.password=manager#123
-------------------------------------------------------------------------------

$ $JAVA_HOME/bin/java -jar ords.war configdir /home/tomcat/ords/conf

$JAVA_HOME/bin/java -jar ords.war configdir /u01/ords/                                                                                        conf
Jun 15, 2018 5:21:32 PM
INFO: Set config.dir to /u01/ords/conf in: /u01/ords/ords.war

$ $JAVA_HOME/bin/java -jar ords.war

$ $JAVA_HOME/bin/java -jar ords.war
Enter 1 if you want to use PL/SQL Gateway or 2 to skip this step.
If using Oracle Application Express or migrating from mod_plsql then you must en                          ter 1 [1]:
Enter the database password for APEX_PUBLIC_USER:
Confirm password:
Jun 15, 2018 5:23:24 PM
INFO: Updated configurations: defaults, apex, apex_pu, apex_al, apex_rt
Installing Oracle REST Data Services version 3.0.12.263.15.32
... Log file written to /u01/ords/logs/ords_install_core_2018-06-15_172324_00763.log
... Verified database prerequisites
... Created Oracle REST Data Services schema
... Created Oracle REST Data Services proxy user
... Granted privileges to Oracle REST Data Services
... Created Oracle REST Data Services database objects
... Log file written to /u01/ords/logs/ords_install_datamodel_2018-06-15_172341_00566.log
Completed installation for Oracle REST Data Services version 3.0.12.263.15.32. Elapsed time: 00:00:18.614


7. Deploy on Tomcat using following steps.

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

$ mkdir $CATALINA_HOME/webapps/i/
$ cp -R /home/oraapex/apex/images/* $CATALINA_HOME/webapps/i/
Copy the "ords.war" file to the Tomcat "webapps" directory.

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

8. ORDS should now be accessible using the following type of URL.

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