OraOpenSource / OXAR

Oracle XE & APEX build script along with images for popular cloud platforms
http://www.oraopensource.com/oxar/
MIT License
107 stars 42 forks source link

Uninstall APEX 4.x and remove objects owned by APEX_040000 #220

Open GasparYYC opened 7 years ago

GasparYYC commented 7 years ago

Oracle XE comes with APEX 4.x by default. The Schema APEX_040000 should be removed as it doesn't provide any value whatsoever (in the context of OXAR 1.x) and that will release space and unnecessary objects in the dictionary.

The right way of uninstalling is prior to installing APEX 5.x

The following script should be executed (as per the documentation):

$ sqlplus /nolog
SQL> connect sys as sysdba
Enter password:
Connected.

SQL> select version from dba_registry where comp_id='APEX';
VERSION
------------------------------
5.1.0.00.45                <<--This validates the version of APEX, in this case shows 5 on my OXAR, on a plain XE should show a 4.x
$ sqlplus /nolog
SQL> connect sys as sysdba
Enter password:
Connected.
SQL> @/u01/app/oracle/product/11.2.0/xe/apex/apxremov.sql
When the script executed without errors, you should see the following message at the end:
PL/SQL procedure successfully completed.
…Application Express Removed
SQL>select version from dba_registry where comp_id='APEX';
no rows selected.
tschf commented 7 years ago

I'm in favour of this - can't see any reason to keep APEX 4 around. I'm a little confused on your two snippets above, you seem to have installed APEX 5.1, then ran the uninstallation - removed apex 5.1? Or is the second snippet just run before 5.1 install?

You seem to be on top of everything - did you want to give this change a go and file a PR?

My notes for uninstall have to drop the schema's, and then removing EPG images (dbms_xdb.deleteresource('/images', dbms_xdb.delete_recursive);) - but that uninstall script seems to do all that, so should be better.

Maybe also removing the 4 installation media and ensuring $ORACLE_HOME/apex points to 5.x install media.

GasparYYC commented 7 years ago

Hi, Sorry for the confusion, here's an explanation: Snippet 1: Just shows the query to identify what version (if any) of APEX is installed on the database, in the example provided I ran the query on my already installed 5.1 so it shows that my database has a 5.1.00.45 version of APEX installed and registered. I don't have an empty XE without APEX but if the same query was executed on a plain XE it should show 4.x as the version installed.

Snippet 2: As per Oracle that is the official way to uninstall Oracle APEX from a database is by executing @/u01/app/oracle/product/11.2.0/xe/apex/apxremov.sql as SYS.

Thoughts: I think that before APEX 5.0/5.1 is installed the script mentioned above should be executed to clear APEX completely from the database, otherwise I think we have an OXAR system that had some components upgraded or inherited from the v4.x already installed. Is that a problem?? I don't know but I like to have my system installations on a clean slate, that way I know the whole thing is consistent.

Benefits: More free space in the database and possibly less junk in the dictionary.