?
Solved

SQLPLUS Command Line with Password

Posted on 2016-08-06
8
Medium Priority
?
80 Views
Last Modified: 2016-09-23
I am attempting to run a sqlplus commandline connect, but my database password has a "@" symbol. For example,  
sqlplus username/P@ssword@123.45.67.111:1521/SID123 @myscript.sql

I suspect that it is failing at the @.  How can I get this to work?
0
Comment
Question by:abuhaneef
  • 2
  • 2
  • 2
  • +1
7 Comments
 

Author Comment

by:abuhaneef
ID: 41745845
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.
0
 
LVL 78

Accepted Solution

by:
slightwv (䄆 Netminder) earned 1336 total points
ID: 41745870
Double quote the password and make sure the password is in the correct case:
sqlplus username/"P@ssword"@123.45.67.111:1521/SID123 @myscript.sql
0
 
LVL 5

Expert Comment

by:Abhimanyu Suri
ID: 41745879
sqlplus /nolog

SQL> conn asuri/"a@suri"
Connected.

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

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

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

SQL>
0
Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 

Author Comment

by:abuhaneef
ID: 41746211
When I used the escape characters, I get

ERROR:
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:
ERROR:
ORA-12154: TNS: could not resolve the connect identifier specified

I am beginning to think the problem is with the tnsnames.ora file.
0
 
LVL 5

Assisted Solution

by:Abhimanyu Suri
Abhimanyu Suri earned 664 total points
ID: 41746231
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
0
 
LVL 38

Expert Comment

by:Gerwin Jansen, EE MVE
ID: 41746392
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...
0
 
LVL 78

Assisted Solution

by:slightwv (䄆 Netminder)
slightwv (䄆 Netminder) earned 1336 total points
ID: 41746548
>>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:
SQLNET.AUTHENTICATION_SERVICES= (NONE)
0

Featured Post

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

In this article, I’ll talk about multi-threaded slave statistics printed in MySQL error log file.
In today's business world, data is more important than ever for informing marketing campaigns. Accessing and using data, however, may not come naturally to some creative marketing professionals. Here are four tips for adapting to wield data for insi…
This video shows how to recover a database from a user managed backup
This video shows how to copy an entire tablespace from one database to another database using Transportable Tablespace functionality.
Suggested Courses

850 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question