Run SQL script on remote Oracle database

10,727

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

select table_name from user_tables;
exit;

And then:

sqlplus username/password@oracle_instance @my_sql_commands.sql

That's all!

Share:
10,727
Olli
Author by

Olli

Updated on September 17, 2022

Comments

  • Olli
    Olli over 1 year

    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.

    • jrg
      jrg about 12 years
      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!