Oracle 12c – ORA-01017 Invalid Username Password with Correct Data

oracle-12c

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.

Best Answer

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 dummy@<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;