2

Trying to import all the files into a table but I receive the following error.

#!/bin/bash 
. ~/.bash_profile 
export ORACLE_HOME=/u01/app/oracle/product/11.2.0/client_1
sqlldr USERID=user/pass@mydb DATA=/data/SDP/Import/*.csv \
    CONTROL=/home/path/test.ctl LOG=/home/path/test.log

Error Message

 SQL*Loader-500: Unable to open file  (/path/path/Import/*.csv) 
 SQL*Loader-553: file not found 
 SQL*Loader-509: System error: No such file or directory 
 SQL*Loader-2026: the load was aborted because SQL Loader cannot  continue.

Please help.

1 Answer 1

1

Use a shell loop, instead of trying to pass a wildcard:

#!/bin/bash 
. ~/.bash_profile 
export ORACLE_HOME=/u01/app/oracle/product/11.2.0/client_1

for FILE in /data/SDP/Import/*.csv; do
    sqlldr USERID=user/pass@mydb "DATA=$FILE" \
        CONTROL=/home/path/test.ctl LOG=/home/path/test.log
    done 
1
  • I changed list in for loop so that special characters in file names like blanks are handled collrectly.. Some problems remain: I think that sqlldr overwrites the log ofthe prevoius run whenever it is executed. Also the the environment is not set correctly if only ORACLE_HOME is set but not the PATH and the LD_LIBRARY_PATH variable is adapted. But maybe they are set in the .bash_profile.
    – miracle173
    Jan 18, 2018 at 16:58

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.