Search code examples
oracle-databasesqlplus

Trying to execute sql script using sqlplus from powershell commandline


I'm trying to execute a sql script from powershell using the following command:

sqlplus username/password@tnsnamesalias 'path to my sql file.sql'

If I run the command without the script path, I can connect to the database and execute commands. If I include the script path (which includes spaces) then I just get the sqlplus help text and no changes are made to the database. My sql script is finished with END; and /

What am I doing wrong?


Solution

  • I believe you need to add the @ sign before the path:

    sqlplus username/password@tnsnamesalias @'path to my sql file.sql'