majjam
majjam

Reputation: 1326

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?

Upvotes: 0

Views: 3394

Answers (2)

ekochergin
ekochergin

Reputation: 4129

You have forgotten "@" symbol and the apostrophes are wrong here.

This works for me for executing a "test script.sql" file

sqlplus .... "@test script.sql"

Upvotes: 1

Tony Andrews
Tony Andrews

Reputation: 132580

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

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

Upvotes: 1

Related Questions