Home > Software design >  how to login to oracle express as a new user
how to login to oracle express as a new user

Time:04-16

I'm getting started with Oracle Express. I used sqlplus to connect and create a new user then tried to use it with the password I gave it. Got a login error (tried 3 times with password I set). I'm surely missing something simple! What is my problem here?

>.\sqlplus / as sysdba

SQL*Plus: Release 21.0.0.0.0 - Production on Fri Apr 15 14:50:40 2022
Version 21.3.0.0.0

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


Connected to:
Oracle Database 21c Express Edition Release 21.0.0.0.0 - Production
Version 21.3.0.0.0

SQL> alter session set container = xepdb1;

Session altered.

SQL> alter user foo identified by bar
  2  ;

User altered.

SQL> connect foo
Enter password:
ERROR:
ORA-01017: invalid username/password; logon denied

CodePudding user response:

Check contents of TNSNAMES.ORA. "My" XE database (the same version as yours) has alias pdb1:

PDB1 =
  (DESCRIPTION =
    (ADDRESS = (PROTOCOL = TCP)(HOST = ods...r)(PORT = 1521))
    (CONNECT_DATA =
      (SERVER = DEDICATED)
      (SERVICE_NAME = XEPDB1)
    )
  )

Then check SQLNET.ORA. "My" version looks like this (your should too, I'd say):

SQLNET.AUTHENTICATION_SERVICES= (NONE)

NAMES.DIRECTORY_PATH= (TNSNAMES, EZCONNECT)

Now, at operating system command prompt:

c:\temp>sqlplus scott/tiger@pdb1

SQL*Plus: Release 21.0.0.0.0 - Production on Fri Apr 15 21:04:58 2022
Version 21.3.0.0.0

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

Last Successful login time: Fri Apr 15 2022 21:02:33  02:00

Connected to:
Oracle Database 21c Express Edition Release 21.0.0.0.0 - Production
Version 21.3.0.0.0

SQL>

CodePudding user response:

If foo is a local user, who exists only in container xepdb1, then the connect command should be connect foo@xepdb1. The connect command doesn't check to see where the user may exist (and indeed, different users by the same name may exist in different containers); you must include the container name in the command.

Perhaps you thought that, since you changed the container to xepdb1 (while connected as sysdba) already, the connect command would assume "within the same container". It does not.

CodePudding user response:

Succeed with:

connect foo/bar@localhost:1521/xepdb1
  • Related