oraconnect shell script

posted Apr 11, 2013, 4:15 AM by Sachchida Ojha   [ updated Apr 11, 2013, 4:16 AM ]
oraconnect.sh

printf "Oracle User ID: "
read ORAUSER
if [ "$ORAUSER" = "" ]
then
  printf "Oracle User ID must be entered..\n"
  exit 1
fi

printf "Password: "
read -s ORAPASSWORD
if [ "$ORAPASSWORD" = "" ]
then
  printf "\nPassword must be entered..\n"
  exit 1
fi

printf "\nConnect String: "
read  CONNECTSTRING
if [ "$CONNECTSTRING" = "" ]
then
  printf "\nCONNECTSTRING must be entered..\n"
  exit 1
fi

echo "hostname:"`hostname`":user:"$ORAUSER":passwd:"$ORAPASSWORD":string:"$CONNECTSTRING >connectstring.log
echo ""
export ORAUSER
export ORAPASSWORD
export CONNECTSTRING

sqlplus  $ORAUSER/$ORAPASSWORD@$CONNECTSTRING

Comments