PavelPraulov
PavelPraulov

Reputation: 629

sqlplus connection string with a user name in double quotes

I'm wondering how a user with a double quoted name supposed to log in?

create user test_default identified by test_pass;
GRANT CREATE SESSION TO test_default;

sqlplus test_default/test_pass@localhost/DBRAZRAB <-- works fine, I'm connected
create user "test_lowercase" identified by test_pass;
GRANT CREATE SESSION TO "test_lowercase";

sqlplus "test_lowercase"/test_pass@localhost/DBRAZRAB <-- ORA-01017: invalid username/password; logon denied

SQL*Plus: Release 19.0.0.0.0 - Production on Wed Jan 5 12:34:56 2022

Version 19.3.0.0.0

I guess, I should somehow modify the connection string, but how?

Upvotes: 0

Views: 1211

Answers (2)

Littlefoot
Littlefoot

Reputation: 143023

You, of course, can do that - only if you know how :)

Creating user, blabla - it works, as you already know:

SQL> connect sys as sysdba
Enter password:
Connected.
SQL> create user "test_lowercase" identified by test_pass;

User created.

SQL> grant create session to "test_lowercase";

Grant succeeded.

SQL> connect "test_lowercase"/test_pass
Connected.
SQL> exit
Disconnected from Oracle Database 11g Express Edition Release 11.2.0.2.0 - 64bit Production

But, can you connect from operating system using sqlplus executable?

c:\Temp>sqlplus "test_lowercase"/test_pass

SQL*Plus: Release 11.2.0.2.0 Production on Sri Sij 5 20:46:04 2022

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

ERROR:
ORA-01017: invalid username/password; logon denied

Whoops! That won't work.

But, if you escape double quotes, then it works:

c:\Temp>sqlplus \"test_lowercase\"/test_pass

SQL*Plus: Release 11.2.0.2.0 Production on Sri Sij 5 20:46:09 2022

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


Connected to:
Oracle Database 11g Express Edition Release 11.2.0.2.0 - 64bit Production

SQL>

Ta-daa!

Upvotes: 1

EJ Egyed
EJ Egyed

Reputation: 6094

On my Windows machine, the case sensitivity does not seem to be retained when trying to launch SQLPlus or SQLcl and login with the same command.

One option you can do is launch SQLPlus (or SQLcl) using a command like sqlplus /nolog, then connect using the conn command like this:

C:\temp>sqlplus /nolog

SQL*Plus: Release 19.0.0.0.0 - Production on Wed Jan 5 14:41:21 2022
Version 19.3.0.0.0

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

SQL> conn "test_lowercase"/test_pass@tnsinfo
Connected.
SQL>

Upvotes: 1

Related Questions