Skip to content
Advertisement

cannot call sqlplus from linux where password contains $ dollar sign

I have spent hours trying various suggestions and combinations but for the life of me cannot get a call to sqlplus from direct linux command line or from a bash script to work with a password containing a $

I have tried these

sqlplus -S mylogin/'"my$password"'@My_DBName
sqlplus -S mylogin/'my$password'@My_DBName
sqlplus -S mylogin/"my$password"@My_DBName

I have tried the same as above but putting before the $, and various other attempts not shown…

Have tried using CONNECT instead both plain password, and with the various quotes and backslashes (only one example shown here)

sqlplus -S /nolog << EOF
CONNECT mylogin/my$password@My_DBName;    

sqlplus -S /nolog << EOF
CONNECT mylogin/'"my$password"'@My_DBName;

I do know that the general sqlplus commands as single command, or with CONNECT works for passwords that do NOT contain $.

Can someone tell me what I’m doing wrong and why? If so, I thank you profusely!

EDITED – MY BAD – ARGH!

Turns out someone changed the password. In fact it does work even the $ and specifying the single quotes like:

sqlplus -S mylogin/'my$password'@My_DBName

Advertisement

Answer

Tested on my MacOS Catalina. Works with single-quotes.

Are you sure about your -S option ? Nothing is displayed after login…. (but you ARE logged in). You can still do select * from dual;

system@XEPDB1> create user mylogin identified by my$password;

User created.

Elapsed: 00:00:00.05
system@XEPDB1> grant create session to mylogin;

Grant succeeded.

Elapsed: 00:00:00.03
system@XEPDB1> exit

sqlplus mylogin/'my$password'@localhost/XEPDB1

SQL*Plus: Release 19.0.0.0.0 - Production on Thu Jun 11 13:17:35 2020
Version 19.3.0.0.0

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


Connected to:
Oracle Database 18c Express Edition Release 18.0.0.0.0 - Production
Version 18.4.0.0.0

mylogin@XEPDB1>


-- change from my$password to $$$$password
mylogin@XEPDB1> passw
Changing password for MYLOGIN
Old password:
New password:
Retype new password:
Password changed
mylogin@XEPDB1> exit

sqlplus mylogin/'$$$$password'@localhost/XEPDB1

SQL*Plus: Release 19.0.0.0.0 - Production on Thu Jun 11 13:20:09 2020
Version 19.3.0.0.0

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

Last Successful login time: Thu Jun 11 2020 13:17:35 +02:00

Connected to:
Oracle Database 18c Express Edition Release 18.0.0.0.0 - Production
Version 18.4.0.0.0

mylogin@XEPDB1>

sqlplus -S mylogin/'$$$$password'@localhost/XEPDB1
select 'No errors - I am logged in!' from dual;

'NOERRORS-IAMLOGGEDIN!'
---------------------------
No errors - I am logged in!

Elapsed: 00:00:00.02
User contributions licensed under: CC BY-SA
2 People found this is helpful
Advertisement