Tag Archives: DBMKT

DB connection

By saif2825

hi Im unable to find how this script in conencting to DB and which DB and job is scheduled in TWS to run this script.

Any sugggestion where to look for or how to get information.

please find below part of script for DB conenction.

##### SET VARIABLES ##################

rundate=`date +%H%M%b%d%Y`
LOGFILE=/logs/NDM/RSLAUTO.$rundate
BAN_CONF_STATUS=/logs/NDM/BANSTSAUTO.$rundate.$$
BAN_DETAILS=/logs/NDM/BAN_NAME_AUTO.$rundate.$$
homedir=/usr/local/ifs/resell
unsentlogdir=/usr/local/ifs/resell/unsent/logs
rsllogdir=/usr/local/ifs/resell/logs
codelist=”FTP NDM CD”
echo “This Log is for rundate=$rundate” | tee -a $LOGFILE
echo “————————————————–” | tee -a $LOGFILE
echo ” ” | tee -a $LOGFILE

************ Special Code following Database password encryption ***********

DBCODE=CUSTMC
DBMKT=${new_market:-$MARKET}
RUN_MODE=F

. setmarket_sh $DBMKT

status=`sqlplus -s $OP_CONNECT_STRING@$OPERATIONAL_DB_NAME << !

set head off
set line 999
set echo on
set feed on

select username, password, db_instance db_instance_node from dbconfig
where db_connect_code=(select db_connect_code from jobdbconnect
where job_name=’$DBCODE’ and market=’$DBMKT‘ and run_mode=’$RUN_MODE’);
!`
echo $status

echo $status | grep “no rows selected” > /dev/null 2>&1
if [ $? -eq 0 ]
then
echo “You have specified a connect code that does not exists” | tee -a $LOGFILE
exit 1
fi

echo $status | grep “ORA-” > /dev/null 2>&1
if [ $? -eq 0 ]
then
echo “An oracle error has occurred when trying to get db connection from op db” | tee -a $LOGFILE
echo “$CODE_RESULTS” | tee -a $LOGFILE
exit 2

…read more
Source: FULL ARTICLE at The UNIX and Linux Forums