Sunday, August 23, 2015

Running 2 versions of APEX in the same ORACLE_HOME

I have just started working on a site which uses APEX, so thought I'd look at creating a dashboard app to see database activity.

Logging into APEX I had a bit of a shock to see that they were still using V3.

Not wanting to upgrade all their applications just for my own benefit, I decided to see if I could run V3 and V5 in the same database.

It was soon apparent that no, that can't be done. Even though the schema and tablespaces would be V5, there are some SYS objects used by APEX that would mean I would break the V3 environment.

My next thought was to see if I could run APEX V5 in a different database but in the same ORACLE_HOME.

I needed to be careful not to impact their stuff.

So, first step, I used dbca to create my own database to hold APEX V5.

I then created a new directory in the ORACLE_HOME for V5 and copied the V5 zip file from the web into it.

oracle@test_host.APEXTST> cd $ORACLE_HOME
[/opt/oracle/product/11.2.0.3/db1]
oracle@test_host.APEXTST> ls | grep apex
apex 
apexv5    

Note that I left the original apex there. Don't want to touch that.

I then copied and extracted the apexv5 zip file under the apexv5 directory. This created a new directory called 'apex'. I thought that this was a bit redundant, so tarred all the files up and moved them to the apexv5 directory (which turned out to be a mistake, see below).

I navigated to the apexv5 directory, connected to my database as sys / sysdba and ran the apexins.sql :

SQL> @apexins.sql sysaux sysaux temp /i/

This ran through OK, so I ran the @apxchpwd.sql script and set the password for the ADMIN user,

I finally ran the apex_epg_config.sql script, and had a problem:

SQL> @apex_epg_config.sql /opt/oracle/product/11.2.0.3/db1/apexv5

. Loading images directory: /opt/oracle/product/11.2.0.3/db1/apexv5/apex/images
declare
*
ERROR at line 1:
ORA-22288: file or LOB operation FILEOPEN failed
No such file or directory
ORA-06512: at "SYS.XMLTYPE", line 296

ORA-06512: at line 16

The 'apex' portion of the path is hard-coded in the config script - but this doesn't exist for my install, the images folder is directly under 'apexv5'.

So I decided to create a new directory under 'apexv5' called 'apex' and move all the files there.

cd /opt/oracle/product/11.2.0.3/db1/apexv5/
mkdir apex
mv * apex
(ignore the warning about moving the directory)

I then re-ran the config script and this time it worked because it could find the 'apex' directory.

SQL> @apex_epg_config.sql /opt/oracle/product/11.2.0.3/db1/apexv5

PL/SQL procedure successfully completed.

PL/SQL procedure successfully completed.

PL/SQL procedure successfully completed.

PL/SQL procedure successfully completed.

. Loading images directory: /opt/oracle/product/11.2.0.3/db1/apexv5/apex/images

Directory created.

PL/SQL procedure successfully completed.

PL/SQL procedure successfully completed.

PL/SQL procedure successfully completed.

Commit complete.

Directory dropped.

timing for: Load Images
Elapsed: 00:03:01.68

PL/SQL procedure successfully completed.

Commit complete.

Unlocked the anonymous account, ran the acl script (see my earlier post here), and tried connecting to the V5 APEX, which worked.

So, the short answer is that you can't run 2 versions of APEX in the same database, but the next best thing is to create a new database and run the different version in that. However, you must make sure that you don't overwrite the existing $ORACLE_HOME/apex directory when you unzip the file. I always take a backup of the database as well as the apex directory under $ORACLE_HOME when doing any APEX upgrade.




No comments:

Post a Comment