Tuesday, 28 April 2026

Oracle Application Express (APEX) Post Upgrade - Remove Old Installations

This article demonstrates how to remove old installations after an Oracle Application Express (APEX) upgrade.

Oracle Application Express (APEX) Installation

Connections

There are three ways you can install APEX, and the database connection you use will vary depending on which you are dealing with. 

The rest of the article assumes you are making the appropriate connection for your installation type.

-- APEX installed in Non-CDB Architecture.

CONN / AS SYSDBA

-- APEX installed in a CDB root container.

CONN / AS SYSDBA

-- APEX installed in a PDB.

CONN / AS SYSDBA

ALTER SESSION SET CONTAINER = {pdb-name};

-- Or

CONN sys@{pdb-name} AS SYSDBA

Check For Old Installations

The following query lists all APEX installations that are not the currently running installation.

SELECT username

FROM   dba_users 

WHERE  (username LIKE 'FLOWS\_______' ESCAPE '\'

OR      username LIKE 'APEX\_______' ESCAPE '\')

AND    username NOT IN (SELECT schema

                        FROM dba_registry

                        WHERE comp_id = 'APEX');

USERNAME

------------------------------

APEX_200200

SQL>

Drop Old Installations (Non-CDB or PDB)

For every old release we need to drop the APEX_XXXXXX user and the SYS.WWV_DBMS_SQL_APEX_XXXXXX package. For non-CDB instances and installations in a PDB we can run these commands directly.

-- 12.2 onward.

ALTER SESSION SET "_oracle_script"=true;

DROP USER APEX_200200 CASCADE;

DROP PACKAGE SYS.WWV_DBMS_SQL_APEX_200200;

From 12.2 onward, if you don't issue the ALTER SESSION command, you may receive the following error.

ERROR at line 1:

ORA-28014: cannot drop administrative users

Drop Old Installations (CDB)

For every old release we need to drop the APEX_XXXXXX user and the SYS.WWV_DBMS_SQL_APEX_XXXXXX package in all containers. We do this with the "catcon.pl" script. 

Here is an example of dropping an old 19.2 (190200) installation from a CDB root container.

# Drop the user.

$ORACLE_HOME/perl/bin/perl -I \

                           $ORACLE_HOME/rdbms/admin \

                           $ORACLE_HOME/rdbms/admin/catcon.pl \

                           -b drop_apex200200 -- --x'drop user APEX_200200 cascade'

# Drop the package.

$ORACLE_HOME/perl/bin/perl -I \

             $ORACLE_HOME/rdbms/admin \

             $ORACLE_HOME/rdbms/admin/catcon.pl \

            -b drop_wwv_dbms_sql -- --x'drop package SYS.WWV_DBMS_SQL_APEX_200200 cascade'

Network ACLs

The documentation suggests cleaning up any old network ACLs.

BEGIN

  DBMS_NETWORK_ACL_ADMIN.delete_privilege('my_acl.xml', 'APEX_200200');

  COMMIT;

END;

/

Dropping the database user means the network ACL principal is no longer available, so there is no risk associated with them, and they don't show up in the ACL views anymore. 

You may want to amend any ACL scripts you have in version control.

------------------For below 12.2 DB------------

$SQLPLUS / AS SYSDBA

SQL>SELECT username

FROM   dba_users 

WHERE  (username LIKE 'FLOWS\_______' ESCAPE '\'

OR      username LIKE 'APEX\_______' ESCAPE '\')

AND    username NOT IN (SELECT schema

                        FROM dba_registry

                        WHERE comp_id = 'APEX');

USERNAME

------------------------------

APEX_040200

SQL>DROP PACKAGE SYS.WWV_DBMS_SQL_APEX_040200;

After Upgrade to 19c database for my EBS environment getting invalid username/password error when opening forms.

Error:

ORA-1017 when opening Forms and ORA-1017 Invalid username/password; logon denied FRM-41352 failed to create a new session


Cause: 

Mis-configuration with the listener and registration of services:

Refs:

19c Database with Oracle E-Business Suite R12 Known Issues & Solutions (Doc ID 2662860.1) - ORA-1017 when opening Forms and ORA-1017 Invalid username/password; logon denied FRM-41352 failed to create a new session

Connection Attempt to Pluggable Database PDB Fails with ORA-01017 (Doc ID 2169712.1)

Doc ID 2662860.1

Doc ID 2169712.1

Solution:

$. PRODCDB_proderpdb.env

$sqlplus / as sysdba

SQL>alter System set SERVICE_NAMES='PRODCDB' SCOPE=BOTH;

The ORA-44787: Service cannot be switched into error occurs because the desired pluggable database (PDB), PROD, either does not have a service running or 

the default service has been inadvertently disabled or dropped. 

The most straightforward way to resolve this issue is to restart the PDB. 

Resolution Steps

Connect to the root container (CDB$ROOT) as a user with SYSDBA privileges:

sql

SQL>CONNECT sys/password@your_tns_alias AS SYSDBA;

SQL>CONNECT sys/oracle@PRODCDB AS SYSDBA;

SQL>ALTER SESSION SET CONTAINER=CDB$ROOT;

Close the target PDB immediately:

sql

SQL>ALTER PLUGGABLE DATABASE PROD CLOSE IMMEDIATE;

Reopen the PDB. This action automatically recreates and starts the default service associated with the PDB name:

sql

SQL>ALTER PLUGGABLE DATABASE PROD OPEN;

Verify the service is active by querying V$ACTIVE_SERVICES or CDB_SERVICES to confirm that PROD is listed as a running service:

sql

SQL>SELECT NAME FROM V$ACTIVE_SERVICES;

-- or

SELECT service_id, name, pdb, con_id FROM cdb_services ORDER BY con_id;

Switch the session into the PDB:

sql

SQL>ALTER SESSION SET CONTAINER=PROD;

SQL>exec dbms_service.create_service(service_name => 'PROD',network_name => 'PROD'); if not exist

SQL>exec dbms_service.start_service('PROD');

SQL>exec dbms_service.start_service('PROD_ebs_patch');

[oracle@proderpdb ~]$ lsnrctl status PRODCDB

LSNRCTL for Linux: Version 19.0.0.0.0 - Production on 03-FEB-2026 18:17:11

Copyright (c) 1991, 2025, Oracle.  All rights reserved.

Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=proderpdb.n.in)(PORT=1536)))

STATUS of the LISTENER

------------------------

Alias                     PRODCDB

Version                   TNSLSNR for Linux: Version 19.0.0.0.0 - Production

Start Date                03-FEB-2026 17:45:12

Uptime                    0 days 0 hr. 31 min. 59 sec

Trace Level               off

Security                  ON: Local OS Authentication

SNMP                      OFF

Listener Parameter File   /oradata/prod/app/oracle/product/19.3.0/network/admin/listener.ora

Listener Log File         /oradata/prod/app/oracle/product/19.3.0/log/diag/tnslsnr/proderpdb/prodcdb/alert/log.xml

Listening Endpoints Summary...

  (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=proderpdb.n.in)(PORT=1536)))

Services Summary...

Service "45fdca432aea7f40e0632afc180a9d5a" has 1 instance(s).

  Instance "PRODCDB", status READY, has 1 handler(s) for this service...

Service "PRODCDB" has 1 instance(s).

  Instance "PRODCDB", status READY, has 1 handler(s) for this service...

Service "PRODCDBXDB" has 1 instance(s).

  Instance "PRODCDB", status READY, has 1 handler(s) for this service...

Service "PROD_ebs_patch" has 1 instance(s).

  Instance "PRODCDB", status READY, has 1 handler(s) for this service...

Service "ebs_PROD" has 1 instance(s).

  Instance "PRODCDB", status READY, has 1 handler(s) for this service...

Service "prod" has 1 instance(s).

  Instance "PRODCDB", status READY, has 1 handler(s) for this service...

The command completed successfully

[oracle@proderpdb ~]$