Remove Oracle Application Express (APEX) from Oracle Database 12c
1.1. Identify installed Apex
Connect to CDB$ROOT by sys user:
sqlplus / as sysdba
show con_name;
show user;
First of all check our currently installed APEX version with this query:
set lines 200
column CON_ID format 999999
column PDB format a12
column COMP_ID format a12
column SCHEMA format a12
column VERSION format 999999
column STATUS format a16
select m.CON_ID, (select i.name from v$pdbs i where i.con_id=m.con_id) PDB,m.COMP_ID, m.SCHEMA, m.VERSION, m.STATUS from CDB_REGISTRY m where m.COMP_ID='APEX' order by m.CON_ID;
CON_ID PDB COMP_ID SCHEMA VERSION STATUS
------- ------------ ------------ ------------ ------------------------------ ----------------
3 CMSDB APEX APEX_200100 20.1.0.00.13 VALID
6 PSBDBHR APEX APEX_200100 20.1.0.00.13 VALID
7 PSBDBFA APEX APEX_190200 19.2.0.00.18 VALID
10 EBEK3RV APEX APEX_050000 5.0.4.00.12 VALID
11 MISPDB APEX APEX_200200 20.2.0.00.20 VALID
12 APEXREPORT APEX APEX_220200 22.2.0 VALID
14 UCB3RVDB APEX APEX_050100 5.1.0.00.45 VALID
15 EBEK2RVDB APEX APEX_050000 5.0.1.00.06 VALID
16 PDBORCL APEX APEX_050100 5.1.0.00.45 VALID
1.2. Remove Apex
We download the laest Apex and unzip to '/oracle/apex/apex' directory of Databae server.
At First, remove APEX from all custom PDB then from PDB$SEED and lastly from CDB$ROOT.
Go to the Home Directory of Later release of APEX;
[oracle@Server ~]$ cd /oracle/apex/apex
Connect to the desire PDB with sys user;
[oracle@Server apex]$ sqlplus / as sysdba
SQL> ALTER SESSION SET CONTAINER=PDBORCL; -- PDB Name Like PDBORCL, PDB$SEED, CDB$ROOT etc.
SQL> SHOW CON_NAME; -- container=PDBORCL
SQL> SHOW USER; -- user=sys
SQL> select username from dba_users where upper(username) like '%APEX%'; -- Check the Apex User
SQL> !ls -lrth apxremov.sql
SQL> @apxremov.sql
SQL> select username from dba_users where upper(username) like '%APEX%'; -- You do not see any Apex User
.
.
.
.
PL/SQL procedure successfully completed.
...Application Express Removed
or
1.3. Drop Apex
If we unable to download too old apex from oracle then drop the old installations (Non-CDB or PDB):
sqlplus / as sysdba
set lines 200
column CON_ID format 999999
column PDB format a12
column COMP_ID format a12
column SCHEMA format a12
column VERSION format 999999
column STATUS format a16
select m.CON_ID, (select i.name from v$pdbs i where i.con_id=m.con_id) PDB,m.COMP_ID, m.SCHEMA, m.VERSION, m.STATUS from CDB_REGISTRY m where m.COMP_ID='APEX' order by m.CON_ID;
CON_ID PDB COMP_ID SCHEMA VERSION STATUS
------- ------------ ------------ ------------ ------------------------------ ----------------
16 PDBORCL APEX APEX_050100 5.1.0.00.45 VALID
ALTER SESSION SET CONTAINER=PDBORCL;
-- 12.2 onward.
ALTER SESSION SET "_oracle_script"=true;
drop user APEX_050100 cascade;
drop user APEX_PUBLIC_USER cascade;
DROP PACKAGE SYS.WWV_DBMS_SQL_APEX_050100;
Again check by the step -1 (1.1. Identify installed Apex) we do not find any installed apex.
In this way, we will remove Oracle Apex from any Pluggable Database.
Comments
Post a Comment