Operating System - HP-UX
1756148 Members
3531 Online
108842 Solutions
New Discussion юеВ

how to check database status

 
SOLVED
Go to solution
Paul_481
Respected Contributor

how to check database status

Hi,

I have a script that starts the oracle database. I want to enhanced this by checking first the database if it is up or down.

If it is up, the script executes. If not the script ends.

I was thinking of the background oracle process. Are there any effective way of checking the status that can be compare to and incorporated on the scrit?

Regds,
Paul
12 REPLIES 12
Ranjith_5
Honored Contributor
Solution

Re: how to check database status

HI Paul,

Use

#ps -ef|grep pmon

This will give a similar output.

oradb 2835 1 0 Feb 12 ? 0:22 ora_pmon_SPICE


Where "SPICE" is the instance ORACLE_SID at my place.


Regards,
Syam
Paul_481
Respected Contributor

Re: how to check database status

so if the pmon process is not present then i can safely assume that the database is down?

rgds,
paul
Ranjith_5
Honored Contributor

Re: how to check database status


Yes.

That's all what I used to do when I need to shutdown the server for a cold backup.

Regards,
Syam
Ravi_8
Honored Contributor

Re: how to check database status

Hi,

Not only pmon represent oracle DB, other processes like dbwr,logwr,smon also represent. check for these process also.
We prefer looking into listerner
#ps -aef|grep -i lsnr
never give up
Ranjith_5
Honored Contributor

Re: how to check database status

Hi Paul/Ravi,

I am mentioning a scenerio where you have a proper db shutdown. Log writer, data base writer and SMON will be stopped after issuing "shutdown immediate" in the 'SQL>" propmt. This case checking of PMON only also will do the purpose. Also you can check the processes related to your ORACLE_SID.
Paul, If you can share the purpose of the script, we can help you in a better way.

regards,
Syam
Paul_481
Respected Contributor

Re: how to check database status

Hi Sya,

Actually this is the pre-exec of our DP5 backup. We have a failed backup before due to script error. The current pre-exec script shutdowns the database and the post-exec restart the database.

What we found out was when database is down and the backup starts and the pre-exec script that shutdown the database runs our DP5 backup fails.

Rgds,
Paul
Paul_481
Respected Contributor

Re: how to check database status

Hi,

Actually this is the pre-exec of our DP5 backup. We have a failed backup before due to script error. The current pre-exec script shutdowns the database and the post-exec restart the database.

What we found out was when database is down and the backup starts and the pre-exec script that shutdown the database runs our DP5 backup fails.

Rgds,
Paul
Ranjith_5
Honored Contributor

Re: how to check database status

Hi paul,

That means , the script is for backup related activity. In that case checking of only PMON will do your purpose.You can also check SMON but not necessory in an ideal condition.

All the data base related processes ( LOGWR,DBWR, and SMON) will be down in a normal scenerio, if the Process MONitor( PMON) is down. Also LOGWR and DBWR are not running as a daemon in unix.ie; you cant find it running/not using ps comand. At the same time SMON status cn be viewed using

#ps -ef|grep -i smon

regards,
Syam
Paul_481
Respected Contributor

Re: how to check database status

Ok, thanks everyone