One of the most common Oracle database errors users face during login is.
ORA-01017: Invalid username/password; logon denied
This error usually occurs when.
- The username or password is incorrect.
- The user account is locked or expired.
- You're connecting to the wrong database container in a multitenant (CDB/PDB) environment.
In this blog, we’ll guide you on how to reset Oracle database user passwords and fix this error.
Solution: Reset Password for SYSTEM User
Connect as SYSDBA
First, connect to your Oracle database using SQL*Plus or any terminal.
sqlplus / as sysdba
Switch to Root Container (CDB)
In a multitenant database, you must connect to the root container to reset the password.
ALTER SESSION SET CONTAINER = CDB$ROOT;
Reset SYSTEM User Password
Now, reset the SYSTEM user’s password. You can set any strong password here:
ALTER USER system IDENTIFIED BY Oracle123 CONTAINER = ALL;
Replace Oracle123 with your desired password.
CONTAINER=ALL ensures that the password change applies to all containers (CDB and PDBs).
Test Connection
EXIT SQL*Plus;
exit
Now try logging in again.
sqlplus system/Oracle123@YourServiceName
How to Find Your Service Name?
Step 1. Open your tnsnames.ora file.
Typical path (Windows): C:\app\Administrator\product\21c\dbhomeXE\network\admin\tnsnames.ora
Step 2. Look for entries like: XE =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.1.193)(PORT = 1521))
(CONNECT_DATA =
(SERVER = DEDICATED)
(SERVICE_NAME = XE)
)
)
In this example.
Step 3. Your service name is XE.
Common Service Names
Container Type |
Example Service Name |
CDB (Root DB) |
XE |
PDB (Pluggable) |
XEPDB1 |
Step 4. Example Connection Command.
sqlplus system/Oracle123@XE
Or for Pluggable DB: sqlplus system/Oracle123@XEPDB1
Step 5. Please review the TNS config you provided (you previously shared XE and XEPDB1) and suggest the exact command.
In your case, it looks like your service name is either.
Step 6. XE → Root Database.
Step 7. XEPDB1 → Pluggable Database.
If you encounter this error, here is the solution to resolve it.
![SQL]()
![Command prompt]()