0
call sqlplus UNAME/PASSWD@DBNAME@\\FILELOCATION\SQLFILENAME.sql

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

CALL sqlplus UNAME@DBNAME/PASSWD@\\FILELOCATION\SQLFILENAME.sql

ERROR:
ORA-12154: TNS:could not resolve the connect identifier specified

SUNITH
  • 15
  • 10
  • Why are you using `Call`? is `sqlplus` a batch file? _if it isn't, remove the `Call` statement and try again_! – Compo Oct 29 '18 at 15:46
  • Yes. It is batch file I calling from. Now I can able to connect when I am giving password in the next line but I am unable to connect if I mention Password in the same line. – SUNITH Oct 30 '18 at 14:57
  • Just to confirm, I asked if `sqlplus` was a batch file, and your answer was `yes`; _So you are sending a username, password and `.sql` file as arguments to a batch script named `sqlplus.bat` or `sqlplus.cmd`!_ – Compo Oct 30 '18 at 15:23
  • Okay. I am not using SQLPLUS.BAT. I am using CALL SQLPLUS from a bat file. Issue was with connection identifier after setting path in command prompt it is working and I have & symbol in my password so it is getting into a new line it seems – SUNITH Oct 31 '18 at 13:15
  • You should first consider removing the `Call` command, or possibly replacing it with the `Start` command. As for your arguments, you should use quotes to protect them and any potentially problematic characters, or escape the characters before you use them. – Compo Oct 31 '18 at 13:48

3 Answers3

0

Try adding a space between the connection string and file (e.g. put a space before the @\FILELOCATION\SQLFILENAME.sql).

call sqlplus UNAME/PASSWD@DBNAME @\FILELOCATION\SQLFILENAME.sql

The other thing to try is to fully qualify your DBNAME. You can look in your tnsnames.ora file (check your Oracle installation folder, and then go to the network\admin folder to find the tnsnames.ora). In there, search for the DBNAME you're trying to connect to, and see what the full name of it is. (ex: DBNAME.SRV.YOURCOMPANY.COM would be an example).

dcp
  • 54,410
  • 22
  • 144
  • 164
0

Try with below braces :

CALL sqlplus {UNAME}@{DBNAME}/{PASSWD}@\\FILELOCATION\SQLFILENAME.sql
kanagaraj
  • 442
  • 1
  • 3
  • 8
0

Based on your latest comment:

SQLPlus "UNAME@DBNAME/PASSWD" @\\FILELOCATION\SQLFILENAME.sql

Or:

Start "" SQLPlus "UNAME@DBNAME/PASSWD" @\\FILELOCATION\SQLFILENAME.sql

Please also enclose your file path with doublequotes, if you wish to protect characters within that too!

Compo
  • 36,585
  • 5
  • 27
  • 39