1

I installed Oracle 23AI free database and I'm attempting to create a new user and connect to the database as that user. I'm using Sql Developer to connect to the database. After connecting to the database as Sys, I run the following commands:

alter session set container = FREEPDB1;
Create User newuser identified by password1;
grant connect to newuser;
Grant create session to newuser;

All grants respond with grant succeeded.

When I attempt to connect as newuser I get the error: Status : Failure -Test failed: ORA-01017: invalid credential or not authorized; logon denied

I've tried granting DB_DEVELOPER_ROLE after viewing a video I found on UTube, but still cannot connect as newuser. What am I doing wrong?

1 Answers1

1

From my environment (oracle free docker + MacOS):

sqlplus sys/Welcome_#1@localhost/FREE as sysdba

SQL*Plus: Release 19.0.0.0.0 - Production on Tue Dec 3 20:08:04 2024 Version 19.8.0.0.0

Copyright (c) 1982, 2020, Oracle. All rights reserved.

Connected to: Oracle Database 23ai Free Release 23.0.0.0.0 - Develop, Learn, and Run for Free Version 23.5.0.24.07

sys@FREE> alter session set container = FREEPDB1;

Session altered.

Elapsed: 00:00:00.04 [200~CreatCreate User newuser identified as password1; Create User newuser identified as password1 * ERROR at line 1: ORA-00924: missing BY keyword

Elapsed: 00:00:00.05 sys@FREE> Create User newuser identified by password1;

User created.

sys@FREE> grant connect to newuser;

Grant succeeded.

Elapsed: 00:00:00.04 sys@FREE> Grant create session to newuser;

Grant succeeded.

sqlplus newuser/password1@localhost/FREEPDB1

SQL*Plus: Release 19.0.0.0.0 - Production on Tue Dec 3 20:10:06 2024 Version 19.8.0.0.0

Copyright (c) 1982, 2020, Oracle. All rights reserved.

Connected to: Oracle Database 23ai Free Release 23.0.0.0.0 - Develop, Learn, and Run for Free Version 23.5.0.24.07

newuser@FREEPDB1> newuser@FREEPDB1> @whoami USER is "NEWUSER"

You need 'identified by' instead of 'identified as'.

Side note:

  • The DB_DEVELOPER_ROLE is the new role for database development in 23ai. That is the one to go with.
  • As an Oracle developer you operate on the pluggable database level - 'FREEPDB1'. Postgres has the 'create database' construct, Oracle Database has the 'create pluggable database' construct. A pluggable database is self-contained and can be plugged out of 'FREE' (container database) running on one host and plugged in on another 'FREE' (container database) running on another host. It is pretty cool.

Best of luck!