I am trying to run a SQL script on remote Oracle database. Something like this, the shell script contains:

sqlplus / @db 

I want to add something to this command so that is is able to run a SQL script on the database db.

  • This question appears to be abandoned as there hasn't been any activity for a longer period of time. I'm voting to close it for now. If by any reason you think this question is still viable or useful in anyways or that there is still a good chance it will be answered please flag it to a moderator or add a comment with the reasons why you want it reopened. Thanks!
    – jrg
    Feb 24, 2012 at 17:13

1 Answer 1


Create a file (let's say: my_sql_commands.sql) containing your SQL commands, for example:

select table_name from user_tables;

And then:

sqlplus username/password@oracle_instance @my_sql_commands.sql

That's all!