Page 1 of 1

Issue on running sqlldr while using rsh

Posted: Sun Dec 30, 2007 1:03 am
by agathaeleanor
Hi There,

Appreciate if anyone can help.
I am running a dsjob using remote shell. Where the source file is placed in different host and the dsjob will do rsh to do sqlldr. However, I encountered the below error that

Func_Sqlldr[27]: sqlldr: not found

and the log file wasn't there also.

Here i posted my sqlload function for reference:

Func_Sqlldr() {

CONNECTION_STRING="${USER_ID}/${PASSWORD}@${DATA_SOURCE_NAME}"
DATA_PATH=${1}
CTL_FILE=${2}

cd ${DATA_PATH}

for PROCESS_FILE in `ls -1 *`
do
DATA_FILE="${DATA_PATH}${PROCESS_FILE}"
SQLLDR_LOG_FILE="${LOG_PATH}/${PROCESS_FILE}_trn.log"
SQLLDR_BAD_FILE="${LOG_PATH}/${PROCESS_FILE}.bad"
SQLLDR_ERROR_FILE="${LOG_PATH}/${PROCESS_FILE}_trn.error"


Func_Log_Writer "----------------------------------------------------------"
Func_Log_Writer "Start sqlldr ${PROCESS_FILE}"
Func_Log_Writer "Connection string=${CONNECTION_STRING}"
Func_Log_Writer "Data file=${DATA_FILE}"
Func_Log_Writer "Control file=${CTL_FILE}"
Func_Log_Writer "Log file=${SQLLDR_LOG_FILE}"
Func_Log_Writer "Bad file=${SQLLDR_BAD_FILE}"

sqlldr\
userid=${CONNECTION_STRING}\
control="${CTL_FILE}"\
data="${DATA_FILE}"\
log="${SQLLDR_LOG_FILE}"\
bad="${SQLLDR_BAD_FILE}"\
errors=${REC_ERROR_ALLOW}\
rows=${ROWS}\
bindsize=${BINDSIZE}\
direct="${DIRECT}"\
silent="${SILENT}" 2> "${SQLLDR_ERROR_FILE}"

SQLLDR_RETURN_CODE=$?
Func_Log_Writer "Sqlldr return code ${SQLLDR_RETURN_CODE}"


#*** Removing Source file ***
if [[ ${RETURN_CODE} != "1" ]]; then

Func_Remove_File "${DATA_FILE}"

fi

done

cd ${CONTROLLER_PATH}
}


Thanks.

Posted: Sun Dec 30, 2007 8:21 am
by chulett
Welcome. :D

sqlldr isn't in your path on the remote system, hence it cannot be found. And there's no log file because you never launched sqlldr... unless you mean whatever Func_Log_Writer is supposed to do. If so, don't see how anyone can comment on that with no source.

So it seems you'll need to ensure your environment is correct over there, either in the remote user's .profile or better yet explicitly in your script. At the very least that would mean establishing the full pathname to sqlldr over there.

Posted: Sun Dec 30, 2007 2:20 pm
by ray.wurlod
You might also like to check (or ensure) that your script has all relevant environment variables, such as ORACLE_HOME, set.

Posted: Mon Jan 07, 2008 4:24 am
by agathaeleanor
Thanks very much.
It works now with the ORACLE_HOME path defined.

Posted: Mon Jan 07, 2008 4:26 am
by agathaeleanor
Thanks very much.
It works now with the ORACLE_HOME path defined.

Posted: Mon Jan 07, 2008 4:45 am
by ray.wurlod
Time to mark the thread as Resolved, then.