1753486 Members
4239 Online
108794 Solutions
New Discussion юеВ

Re: Monitor Database

 
Mehmood Ansari
Frequent Advisor

Monitor Database

Hi
I want to shutdown oracle database within the menu. There are two database running ORACLE_SID/ORACLE_SID1. For ORACLE_SID it is working ok, how do I define for ORACLE_SID1 in my script.
Thanks and regards

DB_processes=`ps -ef |grep -c $ORACLE_SID`
if [ $DB_processes -gt 10 ] ; then
echo "\n\t $ORACLE_SID Database is Running Now "
echo "\n\t You cannot Shutdown the system while Database is running.."
echo "\n\t First Shutdown the Database.."
4 REPLIES 4
Michael Selvesteen_2
Trusted Contributor

Re: Monitor Database

The following code may help

********************************************

DB_processes=`ps -ef |grep -c $ORACLE_SID`
DB_processes1=`ps -ef |grep -c $ORACLE_SID1`
if [ $DB_processes -gt 10 -a $DB_processes1 -gt 10 ]
then
echo "\n\t $ORACLE_SID Database & ORACLE_SID/ORACLE_SID is Running Now "
echo "\n\t You cannot Shutdown the system while Database is running.."
echo "\n\t First Shutdown the Database.."

*********************************************

Hope this helps
--
M
Fred Ruffet
Honored Contributor

Re: Monitor Database

One thing goes wrong in Michael script : even if only one DB is running, message should be displayed. I would replace this part :

if [ $DB_processes -gt 10 -a $DB_processes1 -gt 10 ]

by this one :

if [ $DB_processes -gt 10 -o $DB_processes1 -gt 10 ]

One more point : better than counting processes like that would be to look at one background process. For example, monitoring smon process should be ok.

Regards,

Fred
--

"Reality is just a point of view." (P. K. D.)
Steve Steel
Honored Contributor

Re: Monitor Database

Hi


http://www.orafaq.com/scripts/index.htm

Has other options to do this


Steve Steel
If you want truly to understand something, try to change it. (Kurt Lewin)
Mehmood Ansari
Frequent Advisor

Re: Monitor Database

Hi
Thanks Michael/Fred for your assistance. It is working perfectly.

Thanks again.