SQL*Plus connection fails in Windows batch script

1k Views Asked by At
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

3

There are 3 best solutions below

2
dcp On

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).

1
kanagaraj On

Try with below braces :

CALL sqlplus {UNAME}@{DBNAME}/{PASSWD}@\\FILELOCATION\SQLFILENAME.sql
0
Compo On

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!