Environment: Oracle Linux 6.3, Oracle database 11.2.0.3.0 EE, APEX 4.1.1.00.23, GlassFish 3.1.2.2
This blog post explains how you can upgrade your Application Express installation from version 4.1.1 to version 4.2.1, with the APEX Listener deployed under GlassFish.
Steps:
1) download the software
Update: APEX 4.2.1 is no longer available from the Oracle website. Please use a more recent version of APEX (5.1, 18.x, 19.x). You can download the software here.
2) copy and extract the software
Now copy and extract the apex_4.2.1.zip file to your server. I use “unzip” to unzip the zip file. This will create a folder named “apex”. I usually keep this folder on my server in a permanent location, for example /u01/app/apex.
3) check the tablespace requirements
You need about 275MB of free space in the APEX tablespace (mine is called “APEX”) and 100MB of free space in the SYSTEM tablespace.
4) stop the APEX Listener
Before you start with the upgrade, you need to stop the APEX Listener to make sure no one is using the software during the upgrade.
To stop the APEX Listener under GlassFish, you can do it as follows:
– connect to the GlassFish administration console (by default this is port 4848 using SSL).
– log in with the “admin” user.
– click on Standalone Instances => Applications.
– select the “apex” application and select “Disable” from the “More Actions” drop down list.
The APEX Listener should now be stopped on your GlassFish instance.
5) start the upgrade
To upgrade the APEX software, you need to run the “apexins.sql” sql script from within the “apex” folder that you extracted above. You need to connect as SYS as SYSDBA with the oracle software owner (mine is called “oracle”). Make sure the “apex” folder is writeable!
apexins.sql needs 4 parameters: the name of the tablespace for the APEX user (in my case: APEX), the name of the tablespace for the FLOWS_FILES user (in my case: APEX), the name of the TEMP tablespace (in my case: TEMP) and the name of the virtual image directory (which is “/i/”).
$ su - oracle $ cd /u01/app/apex $ sqlplus /nolog SQL*Plus: Release 11.2.0.3.0 Production on Thu Jan 3 11:21:39 2013 Copyright (c) 1982, 2011, Oracle. All rights reserved. SQL> connect / as sysdba Connected. SQL> @apexins.sql APEX APEX TEMP /i/
The upgrade will now start. This will create a new schema called “APEX_040200”. The upgrade can take some time, depending on the speed of your server. On my server (with fairly recent hardware), it took about 17 minutes. After the upgrade, check the installation log file (in the same folder where you exectuted the apexins.sql file) to make sure no errors were encountered during the process.
6) verify the installation
I always verify my APEX installation after a upgrade by querying dba_registry:
$ sqlplus /nolog SQL*Plus: Release 11.2.0.3.0 Production on Thu Jan 3 12:06:21 2013 Copyright (c) 1982, 2011, Oracle. All rights reserved. SQL> conn / as sysdba Connected. SQL> select status from dba_registry where comp_id='APEX'; STATUS ------------------------------------------------------- VALID
7) copy the images
Next, copy the new and updated images from your installation folder to the GlassFish docroot (you might take a backup folder of the original docroot/i folder just in case):
$ cp -rf /u01/app/apex/images/* /u01/app/glassfish/glassfish/nodes/localhost-domain1/node01/docroot/i/
8) start the APEX Listener
Finally, start the APEX Listener again (see under step 4) and check if all your applications work fine :-) You should now have a nicely upgraded APEX 4.2.1.00.08 installation!
HTH,
Matthias
Update:
If you are accessing network services from withing APEX, like LDAP authentication, print servers and such, you will need to grant the new APEX_040200 user network access or it won’t work. This is documented in the installation guide and is only needed for Oracle 11g. You can grant network access by running the following PL/SQL script with user SYS as SYSDBA:
DECLARE ACL_PATH VARCHAR2(4000); BEGIN -- Look for the ACL currently assigned to '*' and give APEX_040200 -- the "connect" privilege if APEX_040200 does not have the privilege yet. 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_040200', 'connect') IS NULL THEN DBMS_NETWORK_ACL_ADMIN.ADD_PRIVILEGE(ACL_PATH, 'APEX_040200', TRUE, 'connect'); END IF; EXCEPTION -- When no ACL has been assigned to '*'. WHEN NO_DATA_FOUND THEN DBMS_NETWORK_ACL_ADMIN.CREATE_ACL('power_users.xml', 'ACL that lets power users to connect to everywhere', 'APEX_040200', TRUE, 'connect'); DBMS_NETWORK_ACL_ADMIN.ASSIGN_ACL('power_users.xml','*'); END; / COMMIT;