ORA-12154: TNS:could not resolve the connect identifier specified I've initially posted this question on serverfault.com, but because lack of answers decided to post it here...

I'm trying to use bat file/CLI to run SQL script against certain Oracle database with following syntax:

sqlplus -L user_name/database_name@Password @d:\my_bat_file\sql_script.sql


If I run this following error is returned:

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

SP2-0751: Unable to connect to Oracle. Exitig SQL*Plus


At the same time tnsping database_name works fine &amp; corresponding connection configuration strings are present in tnsnames.ora

Moreover if I type commands manually in a following way:

sqlplus /nolog
connect user_name@databasename
Passowrd


I can connect to the database too. Any idea why I'm getting error when trying to use command I mentioned in beginning &amp; how to fix it?

P.S. I'm doing this from Windows Server 2003 SP2 box with Oracle client v10 installed.
As Munchi pointed out the issue was caused by wrong syntax. I used:

sqlplus -L user_name/tns_alias@Password @d:\my_bat_file\sql_script.sql


Instead of:

sqlplus -L user_name/Password@tns_alias @d:\my_bat_file\sql_script.sql