Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How can i prevent SQL output being dsiplayed on screen 1

Status
Not open for further replies.

grapes12

Technical User
Mar 2, 2010
124
ZA
I have a unix menu setup to turn on/off index monitering on the DB. BUT the SQL output runs on the screen.
HOW can i prevent this from happening.

Code:
#!/bin/ksh
WORKDIR=/u1/home/oradba/
LOGS=/u1/home/oradba/logs/
LOGO=" INDEX MONITERING "
MONITORING=`cat /u1/home/oradba/logs/startmonitoring.txt | grep altered | wc -l`


Displaymenu () {
clear
echo `date`
echo
echo "\t\t\t\t" $LOGO
echo
echo "\tMonitoring=$MONITORING"
echo "\t\t"
echo "\tSelect Option:"
echo
echo "\t\t\t [1] Turn on Monitoring "
echo "\t\t\t [2] Turn off Monitoring "
echo "\t\t\t [3] Run Index Monitoring Report "
echo "\t\t\t [4] Exit Program "
echo
echo "Enter option then ENTER to continue: \c"
}
PressEnter () {
echo Press Enter
read x
}
# A function for each of the menu picks

turn_on_index()
{
  echo " Executing Turn on Monitoring "
  do_turn_on
  PressEnter
}

turn_off_index()
{
  echo "Executing Turn off Monitoring "
  do_turn_off
  PressEnter
}

index_report()
{
  echo " Executing INDEX Report "
  do_index_report
  PressEnter
}

do_turn_on()
{
sqlplus -s mac/mac789 <<ENDOFSQL
@${WORKDIR}/startmonitoring.sql
exit;
ENDOFSQL
sqlplus -s mac/mac789 <<ENDOFSQL
@${LOGS}/startmonitoring.sql
exit;
ENDOFSQL
}

do_turn_off()
{
sqlplus -s mac/mac789 <<ENDOFSQL
@${WORKDIR}/stopmonitoring.sql
exit;
ENDOFSQL
sqlplus -s mac/mac789 <<ENDOFSQL
@${LOGS}/stopmonitoring.sql
exit;
ENDOFSQL
}

do_index_report()
{
sqlplus -s mac/mac789 <<ENDOFSQL
@${WORKDIR}/unused_index_rep.sql
exit;
ENDOFSQL
do_email
}

do_email()
{
   echo "Emailing report now"
SUBJECT=" (Sun8) Unused MAC Index Report "
TO=oradba
(
cat $LOGS/unused_index_rep.txt
) | /usr/local/bin/mutt -a $LOGS/unused_index_rep.txt -s "$SUBJECT" $TO
}
while true
do
    Displaymenu
    read answer
    case $answer in
         1) turn_on_index ;;
         2) turn_off_index ;;
         3) index_report ;;
         4) break ;;
    esac
done
clear
 
Replace this:
sqlplus -s mac/mac789 <<ENDOFSQL
with this ?
sqlplus -s mac/mac789 >/dev/null 2>&1 <<ENDOFSQL

Hope This Helps, PH.
FAQ219-2884
FAQ181-2886
 
....and deserves a star?

The internet - allowing those who don't know what they're talking about to have their say.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top