Ora 01017 Invalid Username Password; with correct data

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

I am new to oracle (enterprise:12.2.0.1) and after installation I logged in with connect sys as sysdba.
I also created a new user with:

 alter session set "_ORACLE_SCRIPT"=true;
 create user dummy identified by dummy;
 GRANT ALL PRIVILEGES TO dummy;

Everything went successful until now, but when I tried to log in with the new created user with ‘connect dummy’ I get the error: Ora 01017 Invalid Username Password; logon denied

After resetting the password 10 times and creating 8 new users, I am nearly 100% sure, the password and username is correct.
I read, that this problem can also appear because of the tnsnames.ora file, but I don’t try to connect with TNS, so I would rule this case.

After many hours, I would now be happy, if I can get here a simple step-by-step solution and explanation.
Thank you very much and greetings from Germany.

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

Sounds like you were trying to connect to a different database with the user.

You should not be using

alter session set "_ORACLE_SCRIPT"=true;

It is for Oracle’s internal use only, you will create problems for yourself if you use it. I can only assume that you stumbled into it from a misleading answer which suggests this is the way to create users, it is not. You should be connecting to a Pluggable Database and creating a user as normal there:

show pdbs

To list the PDBs (Pluggable Databases) in your Multitenant Database.

alter session set container=<pdb name>;

To move your session to the PDB

create user dummy identified by dummy;

To create the user

conn [email protected]<tns alias for the PDB>

You might need to create the tns alias first, have a look at your existing tnsnames.ora and create an entry which gives the PDB name as the service_name. Once you’ve created this entry, you can also use it to connect as SYS straight to the PDB so you can create users

sqlplus /@<tns alias for the PDB> as sysdba
create user dummy identified by dummy;

Method 2

I reinstalled oracle and now it works fine.
My guess with tnsnames.ora was totally wrong and also think there was the error!

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