ORA-01017: invalid username/password; logon denied error occurs when an invalid username or password was submitted in an attempt to connect on to Oracle. The ORACLE username and password should be the same as those specified in the GRANT CONNECT statement. The connect statement uses the username/password format for username and password. It’s possible that the username, password, or both are incorrect. The error ORA-01017: invalid username/password; logon denied will be fixed if the correct user name and password are used to connect to the Oracle server.
While attempting to connect to the database, the user name or password may be invalid or misspelt. Passwords in Oracle 11g and later are case sensitive. It’s possible that the password was created before to 11g, and the error ORA-01017: invalid username/password; logon denied occurred after the update. The error will be fixed if you define the password as case sensitive. It’s possible that the connection string contains incorrect database connection information. In the database link setup, double-check all of the settings.
The Problem
The database connection string is used to connect to the database in Oracle when you want to make a database connection. Oracle database could not create a connection using the string if improper connection settings were added to connect to the database. It’s possible that the user name or password is wrong. It’s possible that the database settings or database connection link setup is improper or faulty. The error ORA-01017: invalid username/password; logon denied is going to be thrown.
[oracle@localhost ~]$ sqlplus sys as sysdba
SQL*Plus: Release 19.0.0.0.0 - Production on Wed Apr 6 20:37:22 2022
Version 19.3.0.0.0
Copyright (c) 1982, 2019, Oracle. All rights reserved.
Enter password:
Connected to:
Oracle Database 19c Enterprise Edition Release 19.0.0.0.0 - Production
Version 19.3.0.0.0
SQL> conn hr/hr1
ERROR:
ORA-01017: invalid username/password; logon denied
SQL>
Solution 1
An error ORA-01017: invalid username/password; logon denied will appear if you attempt to connect to an Oracle database with an incorrect password. It’s possible that the password is wrong or that the password has been deactivated. The oracle database connection could not be made if you used an invalid password. Double-check that the password is accurate. If you forget your password, use the system user password to reset it. Alternatively, you can contact your database administrator to have the database user password reset.
[oracle@localhost ~]$ sqlplus sys as sysdba
SQL*Plus: Release 19.0.0.0.0 - Production on Wed Apr 6 20:37:22 2022
Version 19.3.0.0.0
Copyright (c) 1982, 2019, Oracle. All rights reserved.
Enter password:
Connected to:
Oracle Database 19c Enterprise Edition Release 19.0.0.0.0 - Production
Version 19.3.0.0.0
SQL> alter user hr identified by hr;
User altered.
SQL>
Solution 2
The Oracle database will give an error if you supply an incorrect user name. To connect to the Oracle database, the correct user name must be specified in the connection command. The error ORA-01017: invalid username/password; logon denied will be issued if an incorrect user name is provided, or if the user name does not exist or was not created in the Oracle database. Ascertain that the database user exists and is accessible in the Oracle database.
select USERNAME, PASSWORD_VERSIONS from DBA_USERS where USERNAME='HR';
Output
USERNAME PASSWORD_VERSIONS
---------------------------
HR 11G 12C
Solution 3
It’s possible that you’re using an earlier version of Oracle than Oracle 11g. You’ve now updated to Oracle 11g or higher. The database fails to create a database connection with the same database credentials after the update. From Oracle 11g onwards, the password is case sensitive. If you’re using an older Oracle version, you can use case-insensitive passwords. Since the update version, the password has been failing. The error ORA-01017: invalid username/password; logon denied will be resolved if the password is changed to be case sensitive or if the existing password is reset.
show parameter sec_case;
Output
NAME TYPE VALUE
------------------------ ------- -----
sec_case_sensitive_logon boolean TRUE
[oracle@localhost ~]$ sqlplus sys as sysdba
SQL*Plus: Release 19.0.0.0.0 - Production on Wed Apr 6 20:37:22 2022
Version 19.3.0.0.0
Copyright (c) 1982, 2019, Oracle. All rights reserved.
Enter password:
Connected to:
Oracle Database 19c Enterprise Edition Release 19.0.0.0.0 - Production
Version 19.3.0.0.0
SQL> conn hr/hr
Solution 4
If you’re experiencing this error ORA-01017: invalid username/password; logon denied while executing a query but have previously signed in to the database, it’s possible that your query utilises a database link and the database link’s connection details are wrong. To determine if the database link is functional, perform a basic query against it. Check the following details before connecting to the database
hostname : localhost
port : 1521
sid : orcl (any one Sid or service name)
service name : xe
user name : hr
password : hr
Solution 5
A list of service ID information for your databases may be found in the tnsnames.ora file. Open the file and double-check that the information, such as the service name and ID, is valid. Make any required adjustments to the database connection string or the tnsnames.ora file if any information from the file differs from the database connection string.This will resolve the error ORA-01017: invalid username/password; logon denied