Reputation: 237
I am trying to put together a batch file to simply execute a .sql file I have. The code I'm using in the batch is:
REM JOB.BAT
SQLPLUS -S username/password@db @C:\Users\username\Desktop\testsql.sql
EXIT
I am getting the error:
"ERROR: ORA-12154: TNS:could not resolve the connect identifier specified"
I think the issue is that my password contains the @ symbol, so it starts reading the remote database name in the middle of the password instead of just reading 'db'. So if my password were "p@ssword", it's looking for a database called "ssword@db" which does not exist.
Is there a short way around this or is changing my password the only way to do it?
Thanks!
Upvotes: 3
Views: 829
Reputation: 17944
You need to quote the password string, using whatever is appropriate for your operating system. It looks like you're using Windows, so, try this:
SQLPLUS -S username/'password'@db @C:\Users\username\Desktop\testsql.sql
Upvotes: 1
Reputation: 381
If you TNS isn't setup correctly you can simply call the database explicitly:
sqlplus 'user/pass@(DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(Host=hostname.network)(Port=1521))(CONNECT_DATA=(SID=remote_SID)))'
Upvotes: 0