Hi All ,
At the end I have to post my problem thinking I'll be able to get a clue.
I have done a shell script to access a table in our database to extract some logs .
Script is working when executed manually ,but when I set it up in cronjob it is not working. I know thins should be a environment issue but i cant correct it .I red some posts and did some adjustments to the script but still not successful.
My script is -
----------------------------------
#!/usr/bin/ksh
set -x
#export ORACLE_SID=ictprd
#export ORACLE_BASE=/opt/apps/oracle/product
#export ORACLE_HOME=${ORACLE_BASE}/10204
#export NLS_DATE_FORMAT='DD-MON-YYYY'
#export NLS_DATE_LANGUAGE=AMERICAN
#export NLS_LANG=AMERICAN_AMERICA.WE8ISO8859P15
#export TNS_ADMIN=${ORACLE_HOME}/network/admin
#export ORACLE_OWNER="oracle"
#export ORACLE_LIB_DIR=lib
mlidd="emailadd@xxx.com"
prvdate=`cat pdate.log`
sdate=`date "+%Y/%m/%d %T"`
echo $sdate > pdate.log
. ${HOME}/.profile
sqlplus -s yyyyy/dddd@xxx <<EOF
SET HEAD OFF
SET FEEDBACK OFF
SET ECHO OFF
SET PAGESIZE 10000
SET TERMOUT ON
SET WRAP OFF
SET LINESIZE 500
spool msglg.log
SELECT *****
WHERE time_logged BETWEEN to_date('$prvdate','yyyy/mm/dd hh24:mi:ss') AND to_date('$sdate','yyyy/mm/dd hh24:mi:ss') AND fk_seve <= 8 ;
spool off
exit
EOF
if [[ -s msglg.log ]] ; then
cat msglg.log | mailx -s "CRITICAL AND ERROR MESSAGE" $mlidd
fi
rm msglg.log
exit
--------------------------
when i redirect script output from cron it says "sqlplus not found"
thanks