Running Oracle SQL from shell script


Login or Register to Reply

 
Thread Tools Search this Thread
# 1  
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 03:51 AM..
Login or Register to Reply

|
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
Hi all, $ echo $SHELL /bin/bash Requirement - How to pass oracle sql script as argument to unix shell script? $ ./output.sh users.sql Below are the shell scripts and the oracle sql file in the same folder. Shell Script $ cat output.sh #!/bin/bash ....... Shell Programming and Scripting
7
Shell Programming and Scripting
Shell script with Oracle PL/SQL
GaneshAnanth
Hi Gurus, I am new to this unix world...I need your help to walk through. I want to learn shell scripting..... The shell script which can be able to use with oracle pl/sql... So please suggest me which shell is good. Which Unix/Linux version is good for this to Install to get practice the...... Shell Programming and Scripting
8
Shell Programming and Scripting
Use of Oracle pl/sql in UNIX shell script
diehard
Hi, I have basic knowledge on how to write pl/sql code inside shell script. I am looking for more advance thing. Is there any book for that which can just talk about how to write more advance plsql code inside shell script. Please help Thanks!!!!!!... UNIX for Advanced & Expert Users
1
UNIX for Advanced & Expert Users
Logging into oracle or SQL from shell script
manirsendhil
Hi, I have a shell script where I log on to sqlplus like this log() { sqlplus -s scott/tiger <<! select count(*) from EMP; ! } log Here I have hardcoded/used the username : scott and password : tiger directly to log on to SQLPLUS. If i have my log in information in my profile file...... Shell Programming and Scripting
2
Shell Programming and Scripting
how to pass values from oracle sql plus to unix shell script
trichyselva
how to pass values from oracle sql plus to unix shell script... UNIX for Dummies Questions & Answers
2
UNIX for Dummies Questions & Answers
UNIX and Linux

Unix (trademarked as the UNIX certification mark) is a very mature family of multitasking, multiuser computer operating systems that evolved from the original AT&T Unix. Unix development starting in the 1970s by legendary Bell Labs programmers Ken Thompson, Dennis Ritchie, and others. Unix was first targeted for the Bell System and AT&T licensed Unix to outside parties. In the 1970s time period, this lead to a variety of for-profit as well as not-for-profit Unix variants.
In the early days, this included the University of California, Berkeley (BSD), Microsoft (Xenix), IBM (AIX), and Sun Microsystems (Solaris). In the early 1990s, AT&T sold their Unix rights to Novell. In 1995 Novell sold their Unix business to the Santa Cruz Operation (SCO). The UNIX trademark was passed to The Open Group, a "neutral" industry consortium. The Open Group promoted the use of the UNIX trademark for certified operating systems that comply with the Single UNIX Specification (SUS). In 2014 Apple's macOS became the Unix version with the largest global install base and macOS remains the largest Unix-user base today.
Linux is a family of open source Unix-like operating systems based on the Linux kernel. The Linux kernel is an operating system kernel first released by Linus Torvalds on 17 September 1991. Linux distributions include the Linux kernel, system software and libraries. Popular free open source Linux distributions include Debian, Fedora, and Ubuntu. Commercial Linux distributions include Red Hat Enterprise Linux and SUSE Linux Enterprise Server. Linux may be freely modified and redistributed. Anyone on the planet may create a Linux distribution for any purpose.
Please enjoy and help our forum community by "showing your work" and posting your code, even when your code is not working as expected. To help others help you, please wrap your code blocks, sample input, sample output, error messages, and other data in CODE tags and wrap your short commands and short data objects in ICODE tags. We were all beginners in the beginning. If you have any questions about how to register or how to post, please contact us in Live Chat. Thank you and enjoy this "forever free" technical support community for UNIX, Linux and computer information technology in general.