Running Oracle SQL from shell script

Tags
shell scripts

 
Thread Tools Search this Thread
# 1  
Old 07-17-2011
Running Oracle SQL from shell script

Hi, can anyone help me with this script please. I need the oracle command to go into the unix batch file.
Code:
#!/bin/sh
# A menu driven Shell script which has following options
# for acmtoron@>
#
# 
# Exit
# As per option do the job
#----
 
while :
do
 clear
 echo "   A C M LOG MONITORING (TOR)"
 echo "1. Admin Server Log"
 echo "2. Nohup.out"
 echo "3. System Log"
 echo "4. Alert Log"
 echo "5. Disk Free (kb)"
 echo "6. Disk Free (mounted files)"
 echo "7. Disk Space"    echo "8. Swap Info"
  echo "9. Push Jobs"
 echo "0. Exit"
 echo -n "Please enter option [0 - 9]"
 read opt
 case $opt in 
 1) echo "*********Admin Server (TOR)*********";
    tail -f /opt/bea/SPERogers/SPEDomain/servers/AdminServer/logs/AdminServer.log
 ;;
 2) echo "*********Nohup.out (TOR)*********"
    tail -f /opt/bea/SPERogers/SPEDomain/nohup.out
 ;;
 3) echo "*********System Log (TOR)*********"
    cat /var/adm/syslog/syslog.log
 ;;
 4) echo "*********Alert Log (TOR)*********"
    tail -f /data/oracle10/admin/torosped/bdump/alert_torosped.log
 ;;
 5) echo "*********Disk Free in Kilobytes*********"
    df - b
 ;;
 6)echo "*********Disk Free (mounted files)*********"
    df  -g
 ;;
 7) echo "*********Disk space*********"
    bdf 
 ;;
 8) echo "*********Swap Info*********"
     swapinfo
 ;;
 9) echo "*********Push Jobs*********"
 > su - oracle10
 >sqlplus / as sysdba
 >       SELECT COUNT(DISTINCT DEFERRED_TRAN_ID) "Transactions Queued"   FROM DEFTRANDEST;
  
  
  0) echo "*********Logout*********"
    exit 1;;
 *) echo "$opt is an invalid option. Please select option between 0-8 only";
    echo "Press [enter] key to continue. . .";
     read enterKey;;
  
 esac
done


Last edited by pludi; 07-18-2011 at 04:51 AM..

|
Thread Tools Search this Thread
Search this Thread:
Advanced Search

More UNIX and Linux Forum Topics You Might Find Helpful
How to pass Oracle sql script as argument to UNIX shell script? a1_win Shell Programming and Scripting 7 08-26-2014 02:56 PM
Primary key issue when running Oracle sql file Wpgn Solaris 1 04-30-2014 12:18 PM
Shell script with Oracle PL/SQL GaneshAnanth Shell Programming and Scripting 8 09-26-2013 08:46 AM
Use of Oracle pl/sql in UNIX shell script diehard UNIX for Advanced & Expert Users 1 05-31-2013 01:47 PM
pass value from Oracle sql to Korn shell megha2525 Programming 14 12-02-2012 06:59 PM
How to run a SQL select query in Oracle database through shell script? vel4ever Shell Programming and Scripting 9 12-21-2011 01:46 PM
problem running shell script (for oracle export) in crontab jsheehan223 Shell Programming and Scripting 1 10-16-2008 04:29 PM
How to capture value in shell variable from oracle sql? sourabhsharma Shell Programming and Scripting 1 09-24-2008 07:12 AM
Calling SQL LDR and SQL plus scripts in a shell script rajagavini Shell Programming and Scripting 5 11-05-2007 06:12 PM
Logging into oracle or SQL from shell script manirsendhil Shell Programming and Scripting 2 04-10-2007 12:46 AM
Shell script for accessing a file in the network drive and invoking oracle sql loader sayydevara Shell Programming and Scripting 0 03-20-2007 04:54 PM
Running file sql from shell without capture the password Aditya Purwanto UNIX for Dummies Questions & Answers 0 08-31-2006 01:30 AM
Running SQL Scripts from Shell script - Need insight! manthasirisha Shell Programming and Scripting 6 07-03-2006 11:55 PM
Running remote shell script containing sql statements Madbreaks Shell Programming and Scripting 4 05-16-2006 10:58 AM
how to pass values from oracle sql plus to unix shell script trichyselva UNIX for Dummies Questions & Answers 2 02-24-2006 10:19 AM