3

I would like to create shell script, AUTOLOAD that will, when ran, execute SQL*Loader with a set of instructions. All this is in my Linux environment.

SQL*loader will then import data to SQL developer

#!/bin/sh
#
echo -------- SQL loader --------
# @echo; 
#
sqlldr username@server1/password control=/folder1/ctrl/loader.ctl log=/folder1/load/results.l 

My shell script is located in root directory and this is where I will be calling other files from. But it is giving me error when I try to run it:

- line 6: sqlldr: command not found

I don't know how to specify path to SQL*Loader, since I am on Linux.

I am new to this...so Be gentle :(

Ben
  • 51,770
  • 36
  • 127
  • 149
Angelina
  • 2,175
  • 10
  • 42
  • 82
  • I'm confused. Which shell do you intend to use `sh` (Bourne shell) or `bash` (Bourne-Again SHell)? – PM 77-1 May 17 '13 at 21:04
  • I am trying to use sh – Angelina May 17 '13 at 21:08
  • 1
    What does your `/home//.ora_profile` or `/home//.profile` have in them because you might not be setting your environment variables correctly... – Ben May 17 '13 at 21:08
  • Use a text edit (vi should be installed on Linux but emacs etc) to open them @Angelina. – Ben May 17 '13 at 21:11
  • I don't have full permissions to this server :( – Angelina May 17 '13 at 21:15
  • You should still have read access to the home directory of the username you're using in order to try to load data @Angelina... if you don't something's seriously wrong with your Linux install. P.S. If you're replying to someone please use the `@` syntax otherwise they don't get notified. – Ben May 17 '13 at 21:22
  • ok so I found out where is my sqlldr.exe stored. it is in /opt.oracle/product/11gR2/db/bix/sqlldr.exe So how do I specify this is shell script? @Ben – Angelina May 17 '13 at 21:58

1 Answers1

6

Try

locate sqlldr

That should return something like

/u01/app/oracle/product/11.2.0/xe/bin/sqlldr

Edit your ~/.profile and add at the bottom

export ORACLE_HOME=/u01/app/oracle/product/11.2.0/xe
PATH="$PATH:$ORACLE_HOME/bin"

Then re-load your profile with source ~/.profile (or log out and log back in), and you should be good to go.

glenn jackman
  • 238,783
  • 38
  • 220
  • 352