Sunday, January 19, 2025

Oracle Application Express (APEX) 23.2 Installation

Introduction:
Oracle APEX is a low-code development platform that helps you build scalable, secure enterprise apps. This guide will walk you through the installation process step-by-step.

Prerequisites:
1. Oracle Database 19c or later with any edition
2. ORDS 23.3 or later
3. Java 11 or later
4. Minimum 2GB free space for tablespace and software directory
5. Create appropriate and working TNS entry for DB services. Include PDB if using it.

Software Download:
1. Apex 23.2 : Apex 23.2
2. ORDS Download: ORDS
3. Java Download: Java

Environment:
Hostname: apex
IP: 192.168.101.7
ORACLE_SID : APEXDB
PDB: APEXPDB
ORACLE_HOME: /u02/app/oracle/product/19c/db_1

Apex Installation:
1. Create tablespace:

SQL> show pdbs
    CON_ID CON_NAME              OPEN MODE  RESTRICTED
---------- ------------------------------ ---------- ----------
         2 PDB$SEED                       READ ONLY  NO
         3 APEXPDB                        READ WRITE NO
SQL> alter session set container=APEXPDB;
Session altered.
SQL> select name from v$datafile;
NAME
-----------------------------------------------------------
/u02/app/oracle/oradata/APEXDB/apexpdb/system01.dbf
/u02/app/oracle/oradata/APEXDB/apexpdb/sysaux01.dbf
/u02/app/oracle/oradata/APEXDB/apexpdb/undotbs01.dbf
/u02/app/oracle/oradata/APEXDB/apexpdb/users01.dbf
SQL> create tablespace APEX232 datafile '/u02/app/oracle/oradata/APEXDB/apexpdb/apex232_01.dbf' size 500m autoextend on;
  Tablespace created.

2. Create required directories, place the software and then unzip them:

[oracle@apex oracle]$ mkdir apex23_2
[oracle@apex oracle]$ mkdir java
[oracle@apex oracle]$ mkdir ords
[oracle@apex oracle]$ cd apex23_2
[oracle@apex apex23_2]$ pwd
/u02/app/oracle/apex23_2
[oracle@apex apex23_2]$ ls
apex_23.2.zip
[oracle@apex apex23_2]$ cd ..
[oracle@apex oracle]$ cd ords
[oracle@apex ords]$ pwd
/u02/app/oracle/ords
[oracle@apex ords]$ ls
ords-latest.zip
[oracle@apex ords]$ cd ..
[oracle@apex oracle]$ cd java
[oracle@apex java]$ pwd
/u02/app/oracle/java
[oracle@apex java]$ ls
jdk-17_linux-x64_bin.tar.gz

3. Run the installation scripts:
Syntax:
@apexins.sql tablespace_apex tablespace_files tablespace_temp images

* @apexins.sql script for Apex installation.
* tablespace_apex is the name of the tablespace for the APEX application user.
* tablespace_files is the name of the tablespace for the APEX files user.
* tablespace_temp is the name of the temporary tablespace or tablespace group.
* images is the virtual directory for APEX images.To support future APEX upgrades, define the virtual image directory as /i/.



[oracle@apex apex]$ pwd
/u02/app/oracle/apex23_2/apex
[oracle@apex apex]$

[oracle@apex apex]$ sqlplus / as sysdba
SQL> show pdbs
    CON_ID CON_NAME                       OPEN MODE  RESTRICTED
---------- ------------------------------ ---------- ----------
         2 PDB$SEED                       READ ONLY  NO
         3 APEXPDB                        READ WRITE NO
SQL> alter session set container=APEXPDB;
Session altered.

SQL> @apexins.sql APEX232 APEX232 TEMP /i/
...set_appun.sql
PL/SQL procedure successfully completed.
...set_ufrom_and_upgrade.sql
PL/SQL procedure successfully completed.
Session altered.
FOO3
------------------------------
install2024-09-25_00-57-26.log
. ORACLE
.
. Oracle APEX Installation.
..........................................
Thank you for installing Oracle APEX 23.2.0
Oracle APEX is installed in the APEX_230200 schema.
The structure of the link to the Oracle APEX administration services is as follows:
http://host:port/ords/apex_admin
The structure of the link to the Oracle APEX development interface is as follows:
http://host:port/ords
timing for: Phase 3 (Switch)
Elapsed:    0.40
timing for: Complete Installation
Elapsed:   10.10

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] mailtoabhishek91@gmail.com
Enter ADMIN's password []    

==>Provide the password and remember it. Need to share the same with app team.

Created instance administrator ADMIN. SYS> @apex_rest_config.sql Enter a password for the APEX_LISTENER user [] Enter a password for the APEX_REST_PUBLIC_USER user [] ...set_appun.sql ...setting session environment ...create APEX_LISTENER and APEX_REST_PUBLIC_USER users ...grants for APEX_LISTENER and ORDS_METADATA user
4. Now check the DB users and apex version:

SYS> set lines 333 pages 333
SYS> col username for a30
SYS> col account_status for a30
SYS> select username, account_status from dba_users where username like '%APEX%';
USERNAME                       ACCOUNT_STATUS
------------------------------ ------------------------------
APEX_LISTENER                  OPEN
APEX_PUBLIC_USER               LOCKED
APEX_REST_PUBLIC_USER          OPEN
APEX_230200                    LOCKED

SYS> alter user APEX_PUBLIC_USER identified by Apex#123 account unlock;
SYS> alter user APEX_230200 identified by Apex#123 account unlock;
SYS> select username, account_status from dba_users where username like '%APEX%';
USERNAME                       ACCOUNT_STATUS
------------------------------ ------------------------------
APEX_LISTENER                  OPEN
APEX_PUBLIC_USER               OPEN
APEX_REST_PUBLIC_USER          OPEN
APEX_230200                    OPEN

SYS> col VERSION_NO for a20
SYS> col API_COMPATIBILITY for a20
SYS> col PATCH_APPLIED for a20
SYS> select * from apex_release;
VERSION_NO           API_COMPATIBILITY    PATCH_APPLIED
-------------------- -------------------- --------------------
23.2.0               2023.10.31           APPLIED

5. Now set the bash profile:

[oracle@apex ~]$ cat .bash_profile
# .bash_profile
# Get the aliases and functions
if [ -f ~/.bashrc ]; then
        . ~/.bashrc
fi
# User specific environment and startup programs
ORACLE_HOME=/u02/app/oracle/product/19c/db_1
export ORACLE_HOME
ORACLE_BASE=/u02/app/oracle
export ORACLE_BASE
ORACLE_SID=apexdb
export ORACLE_SID
LD_LIBRARY_PATH=$ORACLE_HOME/lib:/usr/lib:.
export LD_LIBRARY_PATH
LIBPATH=$ORACLE_HOME/lib32:$ORACLE_HOME/lib:/usr/lib:/lib
export LIBPATH
TNS_ADMIN=${ORACLE_HOME}/network/admin
export TNS_ADMIN
JAVA_HOME=/u02/app/oracle/java/jdk-17.0.12
export JAVA_HOME
ORDS_HOME=/u02/app/oracle/ords
export ORDS_HOME
PATH=$ORACLE_HOME/bin:$JAVA_HOME/bin:$ORDS_HOME/bin:$PATH:.
export PATH

[oracle@apex ~]$ . .bash_profile
[oracle@apex ~]$ java -version
java version "17.0.12" 2024-07-16 LTS
Java(TM) SE Runtime Environment (build 17.0.12+8-LTS-286)
Java HotSpot(TM) 64-Bit Server VM (build 17.0.12+8-LTS-286, mixed mode, sharing)
[oracle@apex ~]$

6. Copy images files from apex to ords:


[oracle@apex apex]$ pwd
/u02/app/oracle/apex23_2/apex
[oracle@apex apex]$
[oracle@apex apex]$ cp -r images/ /u02/app/oracle/ords/
[oracle@apex apex]$
7. ORDS installation:

[oracle@apex ords]$ pwd
/u02/app/oracle/ords
[oracle@apex ords]$ mkdir config
[oracle@apex ords]$ java -jar ords.war --config /u02/app/oracle/ords/config install
Warning: Support for executing: java -jar ords.war has been deprecated.
Please add ords to your PATH and use the ords command instead.
Run the following command to add ords to your PATH:
echo -e 'export PATH="$PATH:/u02/app/oracle/ords/bin"' >> ~/.bash_profile
Start a new shell to pick up this change.
2024-09-24T21:15:26.438Z WARNING     Your configuration folder /u02/app/oracle/ords/config is located in ORDS product folder. Oracle recommends to use a different configuration folder.
Refer to Oracle REST Data Services Documentation on how to setup your configuration folder.
ORDS: Release 24.2 Production on Wed Sep 25 02:45:26 2024
Copyright (c) 2010, 2024, Oracle.
Configuration:
  /u02/app/oracle/ords/config
Oracle REST Data Services - Interactive Install
...
Mapped local pools from /u02/app/oracle/ords/config/databases:
  /ords/                              => default                        => VALID
2024-09-24T21:17:44.394Z INFO        Oracle REST Data Services initialized
Oracle REST Data Services version : 24.2.3.r2011847
Oracle REST Data Services server info: jetty/10.0.21
Oracle REST Data Services java info: Java HotSpot(TM) 64-Bit Server VM 17.0.12+8-LTS-286
# Now installation will get stuck like this as ORDS is started in the background. Wait for some time. Then exit from this via 'ctrl+c' or 'ctrl+z'. Post that, kill the runnin#g ORDS with the following:
ps -ef | grep ords
kill -9 "pid"

8. Check for the ORDS user:


SQL> show pdbs
    CON_ID CON_NAME                       OPEN MODE  RESTRICTED
---------- ------------------------------ ---------- ----------
         2 PDB$SEED                       READ ONLY  NO
         3 APEXPDB                        READ WRITE NO

SQL> alter session set container=APEXPDB;

SQL> select username, account_status from dba_users where username like '%ORDS%';
USERNAME                       ACCOUNT_STATUS
------------------------------ ------------------------------
ORDS_PUBLIC_USER               OPEN
ORDS_METADATA                  OPEN
ORDSYS                         LOCKED

9. Start the ORDS services:
nohup ords --config /u02/app/oracle/ords/config serve &

10. Access the Apex via browser:
http://192.168.101.7:8080/ords/
http://192.168.101.7:8080/ords/apex_admin


Apex Home
Workspace Login
Apex Admin Login
Admin Home
Manage Workspace
#### Image Directory Issue ####
When trying to login to APEX, you might get the following error:
There is a problem with your environment because the Oracle APEX files have not been loaded. Please verify that you have copied the images directory to your application server as instructed in the Installation Guide. In addition, please verify that your image prefix path is correct. Your current path is /i/ (it should contain both starting and ending forward slashes, such as the default /i/). Use the SQL script reset_image_prefix.sql if you need to change it.

Perform the following steps:

SQL> set lines 333 pages 333
SQL> col NAME for a30
SQL> col VALUE for a60
SQL> select * from apex_instance_parameters where name='IMAGE_PREFIX';

NAME                           VALUE                                                        CREATED_O LAST_UPDA
------------------------------ ------------------------------------------------------------ --------- ---------
IMAGE_PREFIX                   /i/                                                          25-SEP-24 25-SEP-24

SQL> begin
  apex_instance_admin.set_parameter(p_parameter=>'IMAGE_PREFIX', p_value=>'https://static.oracle.com/cdn/apex/23.2.0/');
  commit;
end;
/
PL/SQL procedure successfully completed.

SQL> select * from apex_instance_parameters where name='IMAGE_PREFIX';

NAME                           VALUE                                                        CREATED_O LAST_UPDA
------------------------------ ------------------------------------------------------------ --------- ---------
IMAGE_PREFIX                   https://static.oracle.com/cdn/apex/23.2.0/                   25-SEP-24 25-SEP-24

Please note the value "https://static.oracle.com/cdn/apex/23.2.0/" is for version 23.2.

Thanks for visiting!!

What Next --> APEX Upgradation




0 comments:

Post a Comment