FB

How to Resolve ORA-01017 Invalid Username/Password; Logon Denied

Have you gotten an ORA-01017 error in your Oracle database? Learn what caused it and how you can resolve it in this article.

ORA-01017 invalid username/password; logon denied SolutionORA-01017 Cause

So you’re trying to connect to a database, or run a query across a database link, and you get this message:

ORA-01017: invalid username/password; logon denied

There are a few reasons that you can get this error:

  • Your username or password is actually incorrect
  • The database configuration is not correct (tnanames.ora, $ORACLE_SID parameter)

Now, let’s look at the solution to this error.

 

ORA-01017 Solution

There are a few ways to resolve the ORA-01017 error:

  • Check the username and password are correct
  • Oracle 11g passwords are case sensitive, so ensure that your connection string caters for this
  • Check the database link setup if you’re using a database link

 

Ensure that the Username and Password are Correct

It seems like an obvious step, but make sure that the username and password you’re entering is correct.

If you have them stored somewhere else, make sure you’re looking up the right password.

Also, try entering the username and password manually instead of copying and pasting (or vice versa) to make sure there are no issues with carriage returns or strange characters.

 

Case Sensitive Passwords in Oracle 11g

If you’re connecting to an Oracle 11g database, the passwords are case sensitive.

This was a new feature introduced in Oracle 11g. It’s a database setting that can be turned on and off, but if it’s on, you’ll need to treat your connection string differently.

To fix this, you can specify your password inside double quotes when connecting to the database.

For example, if your password is “DatabaseStar”, and you’re connecting to a database like this, you’ll get an error:

CONN bob/databasestar;

To resolve this error, specify the password in double quotes:

CONN bob/"DatabaseStar";

 

Check the Database Link Setup

If you’re getting this error while running a query, but you’ve already logged in to the database, it might be because your query uses a database link, and the connection details for the database link are incorrect.

To check the database link, you can run a simple query against it to see if it works.

You can then check the connection string to make sure that the user is correct, and that the password is case sensitive (if you’re using an Oracle 11g database).

If you’re connecting to an Oracle 11g database but running the query from a 10g or earlier version, the case sensitivity still applies. It’s related to the database you’re connecting to, not from.

Using the earlier example, if you specify your password in the connection string as DatabaseStar, you’ll get an error.

This is because the password of DatabaseStar is converted to uppercase, which will be DATABASESTAR. This is then checked against the stored value of DatabaseStar, and is found to be different.

To resolve it, put your password inside double quotes.

CONNECT TO order_database IDENTIFIED BY bob USING "DatabaseStar";

So, check these things for your database connection string.

 

Check Your TNSNAMES.ORA File

Your TNSNAMES.ORA file contains a list of service ID information for your databases.

You could be getting this ORA-01017 error if the information in that file is incorrect.

Open the file and check that this information is correct, such as the service name and ID.

So, that’s how you can check for and resolve any ORA-01017 invalid username/password issues.

Lastly, if you enjoy the information and career advice I’ve been providing, sign up to my newsletter below to stay up-to-date on my articles. You’ll also receive a fantastic bonus. Thanks!

16 thoughts on “How to Resolve ORA-01017 Invalid Username/Password; Logon Denied”

  1. I haven’t touched Oracle in 6 years and am reviewing by working through your book on Beginning Oracle SQL for Oracle Database 18c. I’m right at the beginning of your book where I would create the user but get this error. I have actually installed the newer 19c on my desktop. I have no problem connecting as SYS or SYSTEM but I can’ t connect with my name. First it was a different error but I was able to modify the config so common user names prefix isn’t C## and could at least create a user but now I get this error. I’m thinking that if my tnsnames.ora file was wrong then I wouldn’t be able to log in as SYSTEM or SYS but I’m not sure. I definitely don’t have the wrong username/pw as I’m simply creating the first one Joe with a simple pw I’ve used for test purposes for decades. Any guidance would be appreciated.

    1. Hi Joe, I think it could be to do with the new Pluggable Database feature in 18c and 19c. I’ll be writing an article soon about this, but I think you may need to change the service name in the connection settings to XEPDB1 or PDB1, depending on the version you install.

        1. Thank you. I had the same issue and after creating the user from SQL plus and it got revolved. It looks like if you create user from SQL Developer, the user name is lower case (and you still can’t login even if you use lower case user name). Creating user in SQLPlus will create a user in upper case, and you can login after.

      1. I am learning using Oracle 12c. I had created user , grant permission, but still getting this error. Oracle SID is ORCL. when I list user using “select username from dba_users;” under CDB, I can’t see users I had created, but under PDB (pluggable), with same command, I can see the users I had created.
        I login to PDBORCL using “sqlplus sys@PDBORCL as sysdba”, getting SQL > prompt, but when I try to connect with user I created in PDB, getting error
        SQL> conn tom/tomXXX
        ERROR:
        ORA-01017: invalid username/password; logon denied

        Warning: You are no longer connected to ORACLE.

        If I am trying to connect from windows prompt via sqlplus using ” sqlplus tom@pdborcl” , its work fine.

        Any suggestion? what should I change?

        1. Hi Suresh, I’m not sure what the issue would be. I assume you have granted Create Session to the new user. Does your password have mixed-case? I think there was a change in a recent Oracle version to use case-sensitive passwords.
          If not, I wrote an article here that explains a few possible reasons for Oracle connection errors.

      2. Ce message apparait lors de connession a ma base de donnée oracle : “Invalid username/password : logon denied ” qui peut m’aider stp

  2. I have this problem with below jdbc url format

    Sqlplus ‘jdbc:oracle:thin:dbuser/dbpwd@(DESCRIPTION=(COMMECT_TIMEOUT.. )

    But able to login with below format.
    sqlplus user/pwd@sid Or

    sqlplus user/pwd@(DESCRIPTION=….)

    Any idea why with jdbc ot always throws error?

  3. hello sir
    I am new at oracle, I can log in with sqlplus but cannot log in with SQL developer, showing invalid user and password, “select username from dba_users; ” not showing the user in the table, how I get login in sqlplus;
    “sqlplus ‘username’ as sysdba
    password”
    “sqlplus system as sysdba
    password”
    I can log in but when I try to log in with SQL developer I can’t log in, its through error msg invalid user and password. please help
    Thank you,
    Khairun Afroz

  4. when I connect /as sysdba im getting an error ORA-01017: invalid username/password; logon denied. However when connect system/password, I am able to connect. I check v$pwfileusers and I saw 3 users that has sysdba users, how do I identify what user is being used when I connect /as sysdba?

    The oracle services in my window servers is using local account as the user, this user is already part of the admin and ora_dba group.

    Can you please help on my issue?

    Thanks!

  5. If NFS is responsible for those important backend configuration file this , having problem in NFS (or netfs) can also give this error.

    I am no expert in Oracle but i had a case where this ORA error appear and after investigation locate it was due to NFS unavailability for a short duration.

Leave a Comment

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.