skip to Main Content

I’d need to create a sh script, which will connect to Oracle DB and then execute a SQL file.
The problem is that sqlplus is not installed on that Cent-OS machine and most probably it won’t be installed either.
Is there a way how to do this?

3

Answers


  1. You can easily install Oracle Instant Client including sqlplus executable (“Free to download, deploy and distribute”).

    See
    https://www.oracle.com/database/technologies/instant-client/linux-x86-64-downloads.html

    Login or Signup to reply.
  2. If some java version is installed on the server, you can create a simple class that will connect to oracle DB via JDBC, load the sql script and execute it.

    1. Create and compile java class
    2. Upload class file, sql script + oracle_driver (jar file) (https://www.oracle.com/database/technologies/jdbcdriver-ucp-downloads.html)
    3. Execute the java program
    Login or Signup to reply.
  3. You can’t. You need to install oracle client which include sqlplus or sqlloader.
    Or you can use Python and library Cx_Oracle, but you still need sqlclient to connect to database.
    If you don’t want to install oracle client, you can use external table to load data to database or some etl tool.

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search