shell script parameters for sql loader! [message #74564] |
Fri, 07 January 2005 01:21 |
Jolanda
Messages: 68 Registered: September 2004
|
Member |
|
|
Hi You all,
I want to load Oracle tables with sqlloader.
I have written the script below, which gives the user the possibility to import all the tables in once, or select a table to import.
the user_id, password and if necessary I want to force the user to give them as a parameter when he/she calls the function.
I get the error messages that user id and password are not ok..I echo'ed the user_id and password and they seem to be Ok. i guess I am doing something wrong.
does anyone know how to parametrize this shell script?
#!/bin/ksh
#set -x
export ORACLE_SID
ORACLE_SID=MYDATABASE_SID
# these directories should be changed by the user to the desired directories.
# the location of the control files
BIR_CONTROL_HOME=./control
process_all()
{
sqlldr user_id/password@MYDATABASE_SID control=$CONTROL_HOME/control.ctl log=$LOG/logfile.log
sqlldr user_id/password@MYDATABASE_SID control=$CONTROL_HOME/control_other.ctl log=$LOG/logfile_other.log
}
select_table()
{
continue_here=0
while [[ $continue_here -eq 0 ]]
do
echo "make a choice from the menu below"
echo _
echo "1 fill table_1"
echo "2 fill table_2"
echo "3 Quit"
echo
echo "enter choice: c"
read CHOICE
case "$CHOICE" in
1)
sqlldr user_id/password@MYDATABASE_SID control=$CONTROL_HOME/control.ctl log=$LOG/logfile.log
echo "Press Enter to continue "
read inp
continue;;
2)
sqlldr user_id/password@MYDATABASE_SID control=$CONTROL_HOME/control_other.ctl log=$LOG/logfile_other.log
echo "Press Enter to continue "
read inp
continue;;
3) clear
echo "Quitting"
break;;
*) echo "Sorry, $CHOICE is not a valid choice"
exit 1
esac
done
}
#main
#continue_script=0
#while [[ $continue_script -eq 0 ]]
#do
echo "1 If you want to import all data, press 1"
echo "2 If you want to select to import, press 2"
echo "3 Quit"
echo "enter choice: c"
read CHOICE
#case "$CHOICE" in
if [[[[ $CHOICE == 1 ]]]]
then
process_all
elif [[ $CHOICE == 2 ]]
then
select_table
elif [[ $CHOICE == 3 ]]
then
echo "Quitting"
exit 1
else
echo "Sorry, $CHOICE is not a valid choice"
exit 1
fi
#fi
#done
Thanks in advance
|
|
|