Deinstall Old Versions - to keep APEX installed but delete old versions left behind after an upgrade of APEX.
Deinstall All Versions - to completely remove APEX from the database.
Ensure you are logged into the correct server as the 'oracle' user with the correct ORACLE_HOME and ORACLE_SID set.
env | grep ORACLE
To verify if schemas for old versions of APEX exist in the database use:
SELECT username
FROM dba_users
WHERE (username LIKE 'FLOWS_%' OR username LIKE 'APEX_%')
AND username NOT IN (SELECT 'FLOWS_FILES'
FROM DUAL
UNION
SELECT 'APEX_PUBLIC_USER'
FROM DUAL
UNION
SELECT SCHEMA s
FROM dba_registry
WHERE comp_id = 'APEX');
(/u01/dba/apx/old.sql)To backup an old schema (in case of rollback) use:
expdp SCHEMAS=FLOWS_030000 \
DIRECTORY=ORAOUT \
DUMPFILE=FLOWS_030000.dmp \
LOGFILE=FLOWS_030000.log
...where FLOWS_030000 is an example schema name and ORAOUT is an example Directory name.The resultant file will be around 170GB in size for each schema.To remove an old schema use:
sqlplus / as sysdba
DROP USER FLOWS_030000 CASCADE;
...where FLOWS_030000 is an example schema name.Remember to delete backup files after a suitable period has elapsed.
To rollback use:
impdp SCHEMAS=FLOWS_030000 \
DIRECTORY=ORAOUT \
DUMPFILE=FLOWS_030000.dmp \
LOGFILE=FLOWS_030000.log
...where FLOWS_030000 is an example schema name and ORAOUT is an example Directory name.Ensure you are logged into the correct server as the 'oracle' user with the correct ORACLE_HOME and ORACLE_SID set.
env | grep ORACLE
As ‘oracle’:
cd $ORACLE_HOME/apex
sqlplus / as sysdba
@apxremov
drop package htmldb_system;
drop public synonym htmldb_system;