Linux / UNIX Tech Support Forum
This is a discussion on UNIX shell script within the Shell scripting forums, part of the Development/Scripting category; Hi, Through my Shell script i want to check whether Database is UP or not before executing the SQL commands. ...
|
|||||||
| Shell scripting You can discuss the shell scripting, request shell scripts and scripting techniques |
![]() |
|
|
LinkBack | Thread Tools | Display Modes |
|
|||
|
Hi,
Through my Shell script i want to check whether Database is UP or not before executing the SQL commands. if not then It should throw message of NO Success. currently if database is down still shows the process as success. I am working on UNIX korn shell as I am new to UNIX if any one can help me out Thanks.... |
| Sponsored Links | ||
|
|
|
||||
|
Can you share your database and os name?
__________________
Vivek Gite Linux Evangelist |
|
||||
|
Try this
Code:
#!/bin/sh
DBSTAT=`ps -ef | grep pmon | grep ${ORACLE_SID} | grep -v grep | wc -l`
if [ "$DBSTAT"="0" ]
then
echo "Database down"
else
echo "Database up"
fi
|
![]() |
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) |
|
| Thread Tools | |
| Display Modes | |
|
|
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Access UNIX Shell via PHP Based Frontend | eawedat | Shell scripting | 4 | 08-29-2008 02:16 AM |
| Execute UNIX Command / Shell Script Once In The Future | permalac | Shell scripting | 2 | 08-27-2008 08:13 PM |
| Binary Conversion Of Shell Script (shell script compiler) | chandanperl | Shell scripting | 3 | 07-29-2008 10:22 AM |
| unix shell on windows xp | chiku | Solaris/OpenSolaris | 4 | 03-07-2008 03:17 PM |
| Linux UNIX SFTP in a Shell Script | Nishanthhampali | Shell scripting | 1 | 01-30-2008 01:16 PM |