|
|
Re: How to call an sql script from Shell script [message #228507 is a reply to message #228491] |
Tue, 03 April 2007 04:32 |
lokeshg82
Messages: 23 Registered: February 2007 Location: chennai
|
Junior Member |
|
|
hi,
see my below code,
vi Accid_Handle.ksh
echo `date` : Begin Process Accid Handle[ Accid_Handle.ksh ]
echo '################################################################ '
echo ' Enter the WTN'
read data
echo '################################################################ '
export ORACLE_USER=Swb
export ORACLE_PASSWORD=swbt3st
export DB_NAME=yteprod
export LOG_DIR=/var/log/pbiace
export PATH=/usr/local/pbiace/current/bin
export CONNSTRING=${ORACLE_USER}/${ORACLE_PASSWORD}@${DB_NAME}
if [ ! $ORACLE_USER ] ; then
echo `date` : ERROR: ORACLE_USER environment variable WAS NOT established
echo `date` : -------------------------------- END $filename ---------------------------------------
exit 2
fi
if [ ! $ORACLE_PASSWORD ] ; then
echo `date` : ERROR: ORACLE_PASSWORD environment variable WAS NOT established
echo `date` : -------------------------------- END $filename ---------------------------------------
exit 3
fi
if [ ! $DB_NAME ] ; then
echo `date` : ERROR: DB_NAME environment variable WAS NOT established
echo `date` : -------------------------------- END $filename ---------------------------------------
exit 4
fi
if [ ! $ORACLE_HOME ] ; then
echo `date` : ERROR: ORACLE_HOME environment variable WAS NOT established
echo `date` : -------------------------------- END $filename ---------------------------------------
exit 5
fi
$ORACLE_HOME/bin/sqlplus -s $CONNSTRING @myscript.sql $data <<-EOF
exit
EOF
here,inside the code i want to call handle.sql script which is called as @handle.
pls guide me.....
|
|
|
|
Re: How to call an sql script from Shell script [message #228543 is a reply to message #228523] |
Tue, 03 April 2007 06:00 |
lokeshg82
Messages: 23 Registered: February 2007 Location: chennai
|
Junior Member |
|
|
actually my question is here i already called one sql script.
there is any possibility to call another sql script in the same shell script,if yes can i use the same syntax format for that also??
i agreed that i have not much knowledge about unix,thats y me asking these kind of witty doubt..otherwise i won't...
|
|
|
Re: How to call an sql script from Shell script [message #229193 is a reply to message #228488] |
Thu, 05 April 2007 17:18 |
nmacdannald
Messages: 460 Registered: July 2005 Location: Stockton, California - US...
|
Senior Member |
|
|
#!/bin/ksh
#@(#)hotbackup_cancel -- takes all S2000 tablespaces out of backup mode
###
# Korn script to cancel hot backup of the S2000 database
#
###
#
#
# Inform operator what job they have requested
# Ask if they wish to continue
#
echo " "
echo "*****"
echo Canceling hot backup, taking all tablespaces out of backup mode
echo "Continue? (Y/N)"
read answer
if [[ "$answer" = [Yy]* ]]
then
pwddir=`pwd`
echo Enter password for S2000 ORADB
sttyops=`stty -g`
stty -echo
echo "Password: "\\c
read password
echo " "
stty $sttyops
#
# Start the hot backup cancel
#
sqlplus ORADBA/$password << EOF
@$pwddir/hotbackup_cancel
exit
EOF
fi
|
|
|