0
votes

I'm trying to connect to my remote db with a user who has an @ in his password.

I use sqlplus v19 with an OracleClient and my remote db is an OracleServer v19 aswell. I had no problem during the alter user command on the database :

alter user USER identified by "P@ssword123";
user altered.

Below are the commands I tried to connect with this user :

sqlplus USER/"P@ssword123"@tnsname
sqlplus USER/'"P@ssword123"'@tnsname
sqlplus 'USER/"P@ssword123"'@tnsname
sqlplus USER/\"P@ssword123\"@tnsname

And some variants of those commands. This always return me the same TNS error :
TNS:could not resolve the connect identifier specified

It looks like these solutions works for old sqlplus versions but I can't figure out how can I solve my problem with this version 19.

Of course, I tried to change the password with non @ character and it works but this is not a possible solution in my specific case.

1
Are you using Windows or Linux client to Connect? Might try : sqlplus USER/\"P@ssword123"@tnsnamePCir
Windows or Linux?Wernfried Domscheit
I'm using Linux client. With @PCir answer, i get a prompt because de the first double quote is escapedero
The workaround is to do sqlplus /nolog, and then use connect user/"P@ssword"@//.... and it works. SQL> connect tat/"T@AT"@//localhost/pdbbct Connected.gsalem
if your script is running a commands from a sql file, add this 'connect....' to the sql filegsalem

1 Answers

0
votes

Thank you for all your replies.
I figure it out with your help. I even modified it to make it compatible with a PL/SQL Script which I pass some variables.
The answer :

sqlplus /NOLOG << EOF
connect USER/"P@ssword123"@tnsname
@script_plsql.sql $var1 $var2 $var3
EOF