Install Oracle Apex (Application Express) On Oracle 12c Pluggable Database

In this post you will learn to install Oracle Apex 5 on Oracle Database 12c pluggable database. Below is the step by step guide to install Oracle Application Express on Oracle 12c pluggable database.

1. Download the latest version of Oracle Apex 5 from the Oracle.com. You can download with the following link Oracle Application Express 5

2. After downloading extract the zip file into some location, for e.g. on windows D:SoftwareApex5

3. Then open the MS-DOS prompt and changed the directory to the extract location, eg.

CD D:SoftwareApex5Apex

4. Then run the sqlplus as following:

sqlplus /nolog 

It is better to run sqlplus from the Oracle Database 12c Server location, you can copy the path from the shortcut available in Start Menu for Oracle Sql Plus.

5. Now logon using Sys account as following:

Conn
Enter User Name: sys as sysdba
Enter Password: yourpassword

6. After logon change the session to pluggable database with the following command. Change the YOURPDB12C with your pluggable database name:

ALTER SESSION SET CONTAINER = YOURPDB12C;
Note: If your pluggable database is down then run the Alter Database Open; command to start it.

You can remove if any prior Oracle Apex installation exists. To remove the apex run the following script.
@apxremov.sql

7. Now run the main script (apexins.sql) to install Oracle Apex, it will take some time.

@apexins.sql SYSAUX SYSAUX TEMP /i/

8. After completion the above script, create Apex Admin User and Password with the following script. It will ask you to enter admin username and password information:

@apxchpwd.sql

9. Configure Apex using apex_epg_config.sql by passing the path of your apex directory, where you extracted the zip file.

@apex_epg_config.sql D:SoftwareApexApex5.3

10. Unlock the Anonymous User.

ALTER USER ANONYMOUS ACCOUNT UNLOCK;

11. Set the HTTP Port, you can specify any depend on your system.

EXEC DBMS_XDB.SETHTTPPORT(8181);

12. Grant Connect priviledges, run all below scripts.

BEGIN
DBMS_EPG.set_dad_attribute (
dad_name => ‘APEX’,
attr_name => ‘cgi-environment-list’,
attr_value => ‘REQUEST_PROTOCOL=https’);
DBMS_EPG.set_dad_attribute (
dad_name => ‘APEX’,
attr_name => ‘cgi-environment-list’,
attr_value => ‘HTTP_HOST=external-name:external-port’);
commit;
END;
/

DECLARE
ACL_PATH VARCHAR2(4000);
BEGIN
SELECT ACL INTO ACL_PATH FROM DBA_NETWORK_ACLS
WHERE HOST = ‘*’ AND LOWER_PORT IS NULL AND UPPER_PORT IS NULL;
IF DBMS_NETWORK_ACL_ADMIN.CHECK_PRIVILEGE(ACL_PATH, ‘APEX_050000’,
‘connect’) IS NULL THEN
DBMS_NETWORK_ACL_ADMIN.ADD_PRIVILEGE(ACL_PATH,
‘APEX_050000’, TRUE, ‘connect’);
END IF;
EXCEPTION
WHEN NO_DATA_FOUND THEN
DBMS_NETWORK_ACL_ADMIN.CREATE_ACL(‘power_users.xml’,
‘ACL that lets power users to connect to everywhere’,
‘APEX_050000’, TRUE, ‘connect’);
DBMS_NETWORK_ACL_ADMIN.ASSIGN_ACL(‘power_users.xml’,’*’);
END;
/
COMMIT;

DECLARE
ACL_PATH VARCHAR2(4000);
BEGIN
— Look for the ACL currently assigned to ‘localhost’ and give APEX_050000
— the “connect” privilege if APEX_050000 does not have the privilege yet.
SELECT ACL INTO ACL_PATH FROM DBA_NETWORK_ACLS
WHERE HOST = ‘localhost’ AND LOWER_PORT IS NULL AND UPPER_PORT IS NULL;
IF DBMS_NETWORK_ACL_ADMIN.CHECK_PRIVILEGE(ACL_PATH, ‘APEX_050000’,
‘connect’) IS NULL THEN
DBMS_NETWORK_ACL_ADMIN.ADD_PRIVILEGE(ACL_PATH,
‘APEX_050000’, TRUE, ‘connect’);
END IF;
EXCEPTION
— When no ACL has been assigned to ‘localhost’.
WHEN NO_DATA_FOUND THEN
DBMS_NETWORK_ACL_ADMIN.CREATE_ACL(‘local-access-users.xml’,
‘ACL that lets users to connect to localhost’,
‘APEX_050000’, TRUE, ‘connect’);
DBMS_NETWORK_ACL_ADMIN.ASSIGN_ACL(‘local-access-users.xml’,’localhost’);
END;
/
COMMIT;

BEGIN
DBMS_NETWORK_ACL_ADMIN.APPEND_HOST_ACE(
host => ‘*’,
ace => xs$ace_type(privilege_list => xs$name_list(‘connect’),
principal_name => ‘apex_050000’,
principal_type => xs_acl.ptype_db));
END;
/
BEGIN
DBMS_NETWORK_ACL_ADMIN.APPEND_HOST_ACE(
host => ‘localhost’,
ace => xs$ace_type(privilege_list => xs$name_list(‘connect’),
principal_name => ‘apex_050000’,
principal_type => xs_acl.ptype_db));
END;
/

Now your installation of Oracle Apex is complete, you can now open the Apex administration page with the following URL:
http://localhost:8181/apex/apex_admin


Note: Any time if you got disconnected from database during installation, just connect it again using sys account and give the following command to continue with the installation:
ALTER SESSION SET CONTAINER = YOURPDB12C;

How to install oracle apex on oracle 12c database