SQLPLUS Command Line with Password

I am attempting to run a sqlplus commandline connect, but my database password has a "@" symbol. For example,  
sqlplus username/P@ssword@ @myscript.sql

I suspect that it is failing at the @.  How can I get this to work?
Who is Participating?
slightwv (䄆 Netminder)Connect With a Mentor Commented:
Double quote the password and make sure the password is in the correct case:
sqlplus username/"P@ssword"@ @myscript.sql
abuhaneefAuthor Commented:
I keep getting
ORA-12154 : TNS: could not resolve the connect identifier specified.  

I have verified that I can connect to the database via SQL Developer.
Abhimanyu SuriSr Database EngineerCommented:
sqlplus /nolog

SQL> conn asuri/"a@suri"

or if in Shell, " is a special character so you have to escape it

sqlplus asuri/\"a@suri\"@DBNAME

SQL*Plus: Release Production on Sat Aug 6 21:28:06 2016

Get 10% Off Your First Squarespace Website

Ready to showcase your work, publish content or promote your business online? With Squarespace’s award-winning templates and 24/7 customer service, getting started is simple. Head to Squarespace.com and use offer code ‘EXPERTS’ to get 10% off your first purchase.

abuhaneefAuthor Commented:
When I used the escape characters, I get

ORA-12638: Credential retrieval failed

Then it give s me the username: prompt.  After I type in the username and password I get

Enter user-name: myusername
Enter password:
ORA-12154: TNS: could not resolve the connect identifier specified

I am beginning to think the problem is with the tnsnames.ora file.
Abhimanyu SuriConnect With a Mentor Sr Database EngineerCommented:
tnsping TNSENTRY
tnsping "(ADDRESS= .. (PORT=))" --- Just the address part from TNS description

Check parameter "AUTHENTICATION SERVICES" in SQLnet and try setting it to NONE

If all looks good, try establishing  a connection using a test username/pwd

Also, are you passing password as static value or trying to pull it from a variable/file
Gerwin Jansen, EE MVETopic Advisor Commented:
Change the password, remove the @, retry script. If script works, @ is the issue, consider using a password without @. If script is not working, then you have another issue, If you have another issue than the base for this question isn't really there...
slightwv (䄆 Netminder)Connect With a Mentor Commented:
>>I am beginning to think the problem is with the tnsnames.ora file.

It isn't.

Check the sqlnet.ora file and change/add SQLNET.AUTHENTICATION_SERVICES to:
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.