15 Apr 2018

Oracle APEX Locked ADMIN account

I recently locked out the ADMIN account to the APEX INTERNAL workspace.

To change the password is relativly easy, however, there are a few considerations, that I feel should be highlighted

Firstly, SSH into your DB Instance

sudo su - oracle
to log in as Oracle user

cd $ORACLE_HOME/apex
here you will find all the APEX scripts that are used for administration and installation.

Now SQL Plus as sysdba
sqlplus / as sysdba

First problem!
You must log into the Pluggable Database.. if you don't, you'll be changing stuff in the container, and this won't do you much good. Nowadays, APEX is installed at Pluggable level.

alter session set container=pdb_name;
(Obviously rename pdb_name to your PDB)

You probably already know this.. to change / reset the ADMIN password, you must run @apxchpwd

BUT in my case, this did not have any effect. Why?
Because the version of the script in the /apex folder was accessing a different APEX schema to the actual one I am running. There are many reasons for this.. but it took me a few minutes to make the connection...

So...
(if still in sqlplus use ! to shell)
!cat apxchpwd.sql

Near the top, you will see a schema setting:
alter session set current_schema = APEX_050000;

For me, I'm actually running 5.1 of APEX
Use your favourite editor to change to the correct schema.. in my case APEX_050100
alter session set current_schema = APEX_050100;

Now, when I run
@apxchpwd 

All is well!