"ORA-01017: invalid username/password" : Why is that?

All we need is an easy explanation of the problem, so here it is.

What is the difference between the two :

SQLPLUS / AS SYSDBA

and

SQLPLUS
Enter user-name: SYSDBA
Enter password:

If I use the first command I get connected and see the prompt SQL> but upon using the second command I always get ORA-01017: invalid username/password; logon denied , when I enter the correct password. Why is this ?

Also how do I get connected as the SYSDBA using the first command , when I didn’t enter any password.

I am using Oracle Database 11g Express Edition Release 11.2.0.2.0

How to solve :

I know you bored from this bug, So we are here to help you! Take a deep breath and look at the explanation of your problem. We have many solutions to this problem, But we recommend you to use the first method because it is tested & true method that will 100% work for you.

Method 1

SYSDBA is a role. When you connect using that role you’re effectively connecting as the user SYS (say show user in SQL*Plus). As @A.B.Cade already said you’re using external authentication (OS in this case), but if you want to connect remotely over network you’re required to provide username and password (unless account is configured to use remote OS authentication), e. g. sqlplus sys/[email protected] as sysdba.

You may also grant other users the SYSDBA privilege:

sql> GRANT SYSDBA to SCOTT;

This way user SCOTT is able to connect to database with SYS privileges:

[[email protected]]$ echo "show user" | sqlplus -S scott/password as sysdba
USER is "SYS"

Method 2

SYSDBA isn’t a user but a way to connect to the DB.

Connecting as sysdba is based on the OS authentication which means that as long as you connect to your machine with a user which is in the oradba group you will be connected with this user AS SYSDBA no metter what user/password you’ll write (as long as you try to connect as sysdba of course)

Read more in this Tom Kyte’s thread

So, this-

SQLPLUS / AS SYSDBA

and this

SQLPLUS a/b AS SYSDBA

and even this

SQLPLUS
Enter user-name: as SYSDBA
Enter user-name: a
Enter password: b

Are pretty much the same

Note: Use and implement method 1 because this method fully tested our system.
Thank you 🙂

All methods was sourced from stackoverflow.com or stackexchange.com, is licensed under cc by-sa 2.5, cc by-sa 3.0 and cc by-sa 4.0

Leave a Reply