![]() |
|
|
|
|
|||||||
| Forums | Portal | Register | Forum Rules | FAQ | Contribute | Members List | Arcade | Search | Today's Posts | Mark Forums Read |
| Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts here. |
|
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| sqlplus call | JohnZ1385 | UNIX for Dummies Questions & Answers | 1 | 06-05-2008 07:48 AM |
| how can i call sqlplus? | theodore | HP-UX | 13 | 04-25-2008 11:01 AM |
| help me in sending parameters from sqlplus script to unix shell script | Hara | Shell Programming and Scripting | 2 | 01-29-2008 11:31 AM |
| Shell Script And SQLPLUS | maco_home | UNIX for Dummies Questions & Answers | 6 | 08-25-2007 09:05 AM |
| running shell script from sqlplus | dkr123 | Shell Programming and Scripting | 9 | 07-20-2006 07:52 PM |
|
|
Submit Tools | LinkBack | Thread Tools | Display Modes |
|
|||
|
Call sqlplus in the shell script
Hi,
I am writing a script to test database connection. If the first try fails, it will wait for 1 minutes and then try again. The script is as following: ........ for i in $ORACLE_SID do $ORACLE_HOME/bin/sqlplus $username/$password@$i <<! >/dev/null select * from tab; exit if [ $? -ne 0 ]; then sleep 60 $ORACLE_HOME/bin/sqlplus $username/$password@$i <<! >/u01/app/oracle/local/check_$i.ora select * from tab; exit fi ! done #******************************** # If not, exist and email #******************************** for i in $ORACLE_SID do if [ -s "/u01/app/oracle/local/check_$i.ora" ]; then check_stat=`cat /u01/app/oracle/local/check_$i.ora|grep -i ERROR\wc -l`; if [ $check_stat -ne 0 ]; echo ATG/DBA $i database is down >> /u01/app/oracle/local/dbdown_err fi fi done When I test it and shut down the database, the output file check_orcl.ora is not generated. Please help and where it is not correct. Thanks |
| Forum Sponsor | ||
|
|
|
||||
|
Create yourself an actual .sql job and execute it.
Ensure the first line of the .sql job is a spool statement to the log file you require. Don't really need to test it a second time. You're unix script does not contain a test resulting in a start of the db instance if connectivity isn't available. And I think you might be able to contain everything within one loop. Hope that's been of some help for you. Enjoy your trip to discovery working on your solution. Cheers, Cameron |
||||
| Google The UNIX and Linux Forums |
| Thread Tools | |
| Display Modes | |
|
|