Oracle password file complexity workaround

Sometimes we need to recreate the oracle password

The password file on Windows is located in

  • Conventional home: ORACLE_HOME/database directory
  • READONLY home: ORACLE_BASE/database

How can you tell if the ORACLE_HOME is readonly:

Get-ChildItem -Path HKLM:\Software\Oracle

output:

ORACLE_HOME_READONLY : N or Y

To create the password file we need to know the Oracle Database name with CDB or Non CDB, we are talking about the name used for the main service or CDB, so if service name on windows is:

OracleServiceORCL

Our database name is ORCL for purpose of creating the password file

The password file must follow strict naming format of : PWD<lowercase dbname>.ora

So for the service above it will be called PWDorcl.ora

change directory to the location of where password file should be located

i.e.:

cd F:\WINDOWS.X64_193000_db_home\database

use orapwd: orapwd file=PWDorcl.ora password=abc123

and we get an error:

OPW-00029: Password complexity failed for SYS user : Password must contain at least 8 characters.
or
OPW-00029: Password complexity failed for SYS user : Password must contain at least 1 special character.

so lets set it to a random value that beats the check temporarily

orapwd file=PWDorcl.ora password=abc123fwwerwerasfgwas!

Now lets update back to our simpler password using sqlplus as that uses windows group to authenticate

sqlplus /@orcl as sysdba

alter user sys identified by abc123;

This if applicable will update password for pdb’s as well as they share the password file.