SUNITH
SUNITH

Reputation: 35

SQL*Plus connection fails in Windows batch script

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

Upvotes: 0

Views: 1126

Answers (3)

Compo
Compo

Reputation: 38708

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!

Upvotes: 0

kanagaraj
kanagaraj

Reputation: 442

Try with below braces :

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

Upvotes: 0

dcp
dcp

Reputation: 55468

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

Upvotes: 0

Related Questions