Script not reading Data from oracle table properly


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Script not reading Data from oracle table properly
# 1  
Old 04-03-2009
Bug Script not reading Data from oracle table properly

Hi,

I have a case where i am connecting to the oracle DB and reading a column value....
Script is in production...it was running fine,,,but suddenly now some times its started giving pain....
Script runs dailly....but sometimes its reading data from Oracle DB and sometimes its not rading the Data,,,
ID PASSWORD TO CONNECT TO THE DB IS CORRECT ONLY....
cAN ANYBODY TELL THE SOLUTION FOR THIS?
# 2  
Old 04-03-2009
Please share your codes...

HOpe anyone one of us can help you Smilie

THanks
SHa
# 3  
Old 04-03-2009
#!/usr/bin/ksh
PROG=`basename ${0}`
SHL_DIR=`dirname ${0}`
EXIT_STATUS=0
ParameterFile="CbsCollPay_static.ini"
#
# BINPATH="/opt/app/dstage/Ascential/DataStage/DSEngine/bin"
BINPATH=${DS_HOME}/bin
#
RUNSCRIPTPATH="/EVF/work_08/script/"
#
# ORACLE_HOME="/etl01/opt/app/oracle/product/8.1.7/"
# export ORACLE_HOME
# ORAPATH="/etl01/opt/app/oracle/product/8.1.7/bin"
RUNBATCHNAME="Batch::CBSCollPayMaster"
PROJDIR="/EVF/work_08/"
BATCHNAME="LP/COLLPAY/CBS"
INIDIR="ini"
LOGDIR="/EVF/work_08/LP/COLLPAY/CBS/log" #CHANGE#
X=0
BATCHTIMESTAMP=`date +"%Y-%m-%d-%H.%M.%S"`
echo "${BATCHTIMESTAMP} ${PROG} Initialization..."
LOGFILE="${LOGDIR}/CbsCollPay_${BATCHTIMESTAMP}.log" #CHANGE#
if [ ! -r ${PROJDIR}${BATCHNAME}/${INIDIR}/${ParameterFile} ]; then
error_ msg="${BATCHTIMESTAMP} ${PROG} Failed to read parameter file ${PROJDIR}${BATCHNAME}/${INIDIR}/${ParameterFile}"
break
fi
set -x
# Look in the parameters.ini file to determine the directory paths
ICVDB=`grep "ICVDB=" ${PROJDIR}${BATCHNAME}/${INIDIR}/${ParameterFile} | cut -d "=" -f2`
ICVDBUSER=`grep "ICVDBUSER=" ${PROJDIR}${BATCHNAME}/${INIDIR}/${ParameterFile} | cut -d "=" -f2`
ICVDBPASSWORD=`grep "ICVDBPASSWORD=" ${PROJDIR}${BATCHNAME}/${INIDIR}/${ParameterFile}|cut -d "=" -f2`
SRCDIR=`grep "SRCDIR=" ${PROJDIR}${BATCHNAME}/${INIDIR}/${ParameterFile} | cut -d "=" -f2`
PROJDIR=`grep "PROJDIR=" ${PROJDIR}${BATCHNAME}/${INIDIR}/${ParameterFile} | cut -d "=" -f2`
SCRIPTDIR=`grep "SCRIPTDIR=" ${PROJDIR}${BATCHNAME}/${INIDIR}/${ParameterFile} | cut -d "=" -f2`
ARCHDIR=`grep "ARCHDIR=" ${PROJDIR}${BATCHNAME}/${INIDIR}/${ParameterFile} | cut -d "=" -f2`
FTPSERVERNAME=`grep "FTPSERVERNAME=" ${PROJDIR}${BATCHNAME}/${INIDIR}/${ParameterFile} | cut -d "=" -f2`
FTPUSERNAME=`grep "FTPUSERNAME=" ${PROJDIR}${BATCHNAME}/${INIDIR}/${ParameterFile} | cut -d "=" -f2`
FTPPASSWORD=`grep "FTPPASSWORD=" ${PROJDIR}${BATCHNAME}/${INIDIR}/${ParameterFile} | cut -d "=" -f2`
REMOTEDIR=`grep "REMOTEDIR=" ${PROJDIR}${BATCHNAME}/${INIDIR}/${ParameterFile} | cut -d "=" -f2`
SRCFILENAME=`grep "SRCFILENAME=" ${PROJDIR}${BATCHNAME}/${INIDIR}/${ParameterFile} | cut -d "=" -f2`
PREFILE=`ls ${PROJDIR}${BATCHNAME}/${ARCHDIR}/`
cd ${PROJDIR}${BATCHNAME}/${SRCDIR}/
chmod 775 *.*
if [ ! -f ${PROJDIR}${BATCHNAME}/${SRCDIR}/${PREFILE} ]; then
mv ${PROJDIR}${BATCHNAME}/${SRCDIR}/${PREFILE} ${PROJDIR}${BATCHNAME}/${ARCHDIR}/
fi
EXIT_STATUS=0
echo "ICVDB=$ICVDB" >> ${LOGFILE}
echo "ICVDBUSER=$ICVDBUSER" >> ${LOGFILE}
echo "ICVDBPASSWORD=$ICVDBPASSWORD" >> ${LOGFILE}
#
# /etl01/opt/app/oracle/product/8.1.7/bin/sqlplus ... ... #
#
X=`${ORACLE_HOME}/bin/sqlplus -silent $ICVDBUSER/$ICVDBPASSWORD@$ICVDB <<END
set pagesize 0 feedback off verify off heading off echo off
select cast((substr(max(a.LAST_FILE_NAME),10,LENGTH(max(Trim(a.LAST_FILE_NAME)))-13)) as integer) from DA.ETL_CONTROL
a where a.LAST_POST_DTS in(
select max(b.LAST_POST_DTS) from DA.ETL_CONTROL b where b.TABLE_NAME='CBS_COLL_PAYMENT');
EXIT;
END`



I am expecting Value of X.....
Some times its comming some times its not comming....
ID password values are geting passed coreectly


Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Run the Script from any stage by updating data from Oracle Table.

I have 100 Scripts, each containing 10-15 SQL's in them. Each Script run for 40 mins to 1 hour 30 mins. In the event of Failure in any step, if i re-start the Script, it will start running from the beginning. Which is waste of time. So in order handle this, i made the script to run from the... (7 Replies)
Discussion started by: kiran1992
7 Replies

2. Shell Programming and Scripting

Perl Script for reading table format data from file.

Hi, i need a perl script which reads the file, content is given below. and output in new file. TARGET DRIVE IO1 IO2 IO3 IO4 IO5 ------------ --------- --------- --------- --------- --------- 0a.1.8 266 236 ... (3 Replies)
Discussion started by: asak
3 Replies

3. Shell Programming and Scripting

Shell script to export data from Oracle table .

Hi, I want to write a shell script which will export data from oracle table . I don't want to save that data . I want the queries . Right now i am right clicking on the table and clicking on export as to my desktop . Please let me know if any one have any idea . (2 Replies)
Discussion started by: honey26
2 Replies

4. Shell Programming and Scripting

sending mail using Mailx with data from oracle table

Hi, i need to send emails to the mail ids i receive using the sql query . SELECT L.ALARM_DEF,L.CRITERIA,L.DISTANCE_METRE,L.EMAIL,L.LAC_ID,L.LAST_CHECK,L.RANGE, L.RESOURCE_MSISDN,LM.ADDRESS,LM.NAME FROM LANDMARK_ALARM_CONF l, LANDMARK lm WHERE L.LANDMARK_ID=LM.LANDMARK_ID AND... (0 Replies)
Discussion started by: aemunathan
0 Replies

5. Shell Programming and Scripting

select data from oracle table and save the output as csv file

Hi I need to execute a select statement in a solaris environment with oracle database. The select statement returns number of rows of data. I need the data to be inserted into a CSV file with proper format. For that we normally use "You have to select all your columns as one big string,... (2 Replies)
Discussion started by: rdhanek
2 Replies

6. Shell Programming and Scripting

Reading data from multiple tables from Oracle DB

Hi , I want to read the data from 9 tables in oracle DB into 9 different files in the same connection instance (session). I am able to get data from one table to one file with below code : X=`sqlplus -s user/pwd@DB <<eof select col1 from table1; EXIT; eof` echo $X>myfile Can anyone... (2 Replies)
Discussion started by: net
2 Replies

7. Shell Programming and Scripting

load a data from text file into a oracle table

Hi all, I have a data like, 0,R001,2,D this wants to be loaded into a oracle database table. Pl let me know how this has to be done. Thanks in advance (2 Replies)
Discussion started by: raji35
2 Replies

8. Shell Programming and Scripting

To load data from variable to oracle table ....???

Hi all, How to load variable value into Oracle table? I have created a file validation shell script. After the validation completes, i need to update a Oracle table with the variable value... Can someone help me how to do it? I have searched, but not able to get answer. i have 4 variables... (2 Replies)
Discussion started by: Amit.Sagpariya
2 Replies

9. Shell Programming and Scripting

To load data from variable to oracle table

Hi all, How to load variable value into Oracle table? I have created a file validation shell script. After the validation completes, i need to update a Oracle table with the variable value... Can someone help me how to do it? I have searched, but not able to get answer. i have 4... (1 Reply)
Discussion started by: Amit.Sagpariya
1 Replies

10. Shell Programming and Scripting

Reading a table in a shell script

Dear all: I want to write a script capable of reading specific rows and collumns of a table, into a variable. Just imagine i have a file named table.dat which contains: GENERAL INFORMATION Col 1 Col2 Col3 1 1 2 2 3 3 4 4 What i want to do... (13 Replies)
Discussion started by: luiscarvalheiro
13 Replies
Login or Register to Ask a Question