How to Fix ORA-01017: Invalid Username/Password; Logon Denied in Oracle

Find why a logon is denied, from case-sensitive passwords to the wrong pluggable database, and reset the password as an administrator.

ORA-01017 means the database rejected the logon: the username or the password is wrong, or the account may not log on this way. Oracle AI Database 26ai words it as "invalid credential or not authorized; logon denied". For security, the message never says which part was wrong. Passwords are case-sensitive, so a password typed in the wrong case is a common cause.

Reproduce the Error

A test user is created for the examples:

Example:

-- a test user for the examples
drop user if exists demo_app cascade;
create user demo_app identified by "Demo_Pass_26" default tablespace users;
grant create session to demo_app;

A wrong password, then the right password in lowercase:

Example:

# a wrong password, and the right one in the wrong case
sqlplus -s -L demo_app/Wrong_Pass_26@localhost:1521/FREEPDB1 <<'SQL'
select user from dual;
SQL
sqlplus -s -L demo_app/demo_pass_26@localhost:1521/FREEPDB1 <<'SQL'
select user from dual;
SQL

Output:

ERROR:
ORA-01017: invalid credential or not authorized; logon denied

SP2-0751: Unable to connect to Oracle.  Exiting SQL*Plus
ERROR:
ORA-01017: invalid credential or not authorized; logon denied

SP2-0751: Unable to connect to Oracle.  Exiting SQL*Plus

Both fail with the same message: Demo_Pass_26 and demo_pass_26 are different passwords.

Fix: Check the Account and Reset the Password

An administrator checks that the account exists and is open, and sets a new password when it is not known:

Example:

select username, account_status, profile from dba_users where username = 'DEMO_APP';
-- an administrator can set a new password
alter user demo_app identified by "Demo_Pass_27";

Output:

USERNAME    ACCOUNT_STATUS    PROFILE
___________ _________________ __________
DEMO_APP    OPEN              DEFAULT

User DEMO_APP altered.

Example:

sqlplus -s -L demo_app/Demo_Pass_27@localhost:1521/FREEPDB1 <<'SQL'
select user from dual;
SQL

Output:

USER
----------
DEMO_APP

Other Common Causes

  • The user exists in another pluggable database than the one the service connects to.
  • The password contains characters such as @ or /, which split the connect string; enclose it in double quotes.
  • An old client cannot use the password versions the database requires; check the client version and SQLNET.ALLOWED_LOGON_VERSION_SERVER.
  • Repeated failures with a profile that limits FAILED_LOGIN_ATTEMPTS lock the account, which then gives ORA-28000.

Related Guides

Conclusion

ORA-01017 means the username and password were not accepted. Check the case of the password, the database you connect to, and special characters, and have an administrator reset the password when needed.

Vinish Kapoor
Vinish Kapoor

An Oracle ACE, author of four books on Oracle APEX, SQL and PL/SQL, and Oracle Forms, and a software developer building Oracle database applications since 2001.

guest

0 Comments
Oldest
Newest Most Voted