service [message #139659] |
Thu, 29 September 2005 01:54 |
kinjal
Messages: 124 Registered: June 2001
|
Senior Member |
|
|
Hello,
Is there any way to know through linux command that whether my oracle database is in startup mode or is shutdown?
I want to create a shell script for which I need to know the status of database before doing anything else through that script.
Thanking you,
Kinjal
|
|
|
Re: service [message #139676 is a reply to message #139659] |
Thu, 29 September 2005 02:28 |
tarundua
Messages: 1080 Registered: June 2005 Location: India
|
Senior Member |
|
|
hi kinjal ,
trying a wild guess until other chips in.
( i tried it on a solaris box)
1. When oracle is shutdown and sys is connected to idle instance. At this time the O/P of following command
dogmatix:SID=testdb=>ps -e -o pid -o user -o args
PID USER COMMAND
262 root rpc.metad
267 root /usr/sbin/mdmonitord
272 root /opt/teamquest/manager/bin/tqalm -d production
4206 oracle oracletestdb (DESCRIPTION=(LOCAL=YES)(ADDRESS=(PROTOCOL=beq)))
4171 oracle -ksh
4227 oracle ps -e -o pid -o user -o args
1559 smmsp /usr/lib/sendmail -Ac -q15m
334 oracle /data1/u01/app/oracle/product/9.2.0/bin/tnslsnr LISTENER -inherit
4204 oracle sqlplus
4119 root -ksh
No entry for dbwr, lgwr, ckpt etc. processes.
2. But when i started the database from other session
dogmatix:SID=testdb=>ps -e -o pid -o user -o args
PID USER COMMAND
4171 oracle -ksh
4244 oracle oracletestdb (DESCRIPTION=(LOCAL=YES)(ADDRESS=(PROTOCOL=beq)))
4235 oracle ora_ckpt_testdb
1559 smmsp /usr/lib/sendmail -Ac -q15m
4233 oracle ora_lgwr_testdb
334 oracle /data1/u01/app/oracle/product/9.2.0/bin/tnslsnr LISTENER -inherit
4204 oracle sqlplus
4229 oracle ora_pmon_testdb
4119 root -ksh
4237 oracle ora_smon_testdb
4117 root /usr/lib/ssh/sshd
715 root /usr/lib/ssh/sshd
1560 root /usr/lib/sendmail -bd -q15m
4108 root /usr/lib/ssh/sshd
4110 root -ksh
4130 oracle -ksh
4231 oracle ora_dbw0_testdb
4243 oracle ora_d000_testdb
4239 oracle ora_reco_testdb
really not sure whether it will help you or not but if it then u can user "grep" command on the O/P to check ora_XXXX processes.
Even i want to know the exact way
regards,
tarun
|
|
|
Re: service [message #139680 is a reply to message #139676] |
Thu, 29 September 2005 02:39 |
sunil_v_mishra
Messages: 506 Registered: March 2005
|
Senior Member |
|
|
hi,
What about top command on the linux root ?
you can see which process is running throung top command and how much cpu is been utilised by oracle or any other application.
[root#]$ top
Note :- If oracle is Up then it is definately using CPU (RAM).
Regards
Always Friend Sunilkumar
|
|
|
|
Re: service [message #139875 is a reply to message #139683] |
Thu, 29 September 2005 22:38 |
kinjal
Messages: 124 Registered: June 2001
|
Senior Member |
|
|
Dear all,
Thank you very much for your replies..
Its really helpful to me..
Thanks again,
Kinjal
|
|
|
|
Re: service [message #140231 is a reply to message #139996] |
Mon, 03 October 2005 00:20 |
kinjal
Messages: 124 Registered: June 2001
|
Senior Member |
|
|
Hello,
You r right Tarun that I should post the result also.
Actually I created a shell script for taking clean database backup. But for that I needed to first check whether oracle is in shutdown mode or its up for use..
ps -ef | grep smon
output is,
oracle 7167 1 0 09:39 ? 00:00:00 ora_smon_mudra
This output means that smon is running and so the oracle is up.
Now I can use this command in my shell script and accordingly it will take backup of the database.
Its really helpful.
Kinjal
|
|
|
|
Re: service [message #140278 is a reply to message #140231] |
Mon, 03 October 2005 06:59 |
|
Mahesh Rajendran
Messages: 10708 Registered: March 2002 Location: oracleDocoVille
|
Senior Member Account Moderator |
|
|
kinjal wrote:
Quote: |
ps -ef | grep smon
output is,
oracle 7167 1 0 09:39 ? 00:00:00 ora_smon_mudra
This output means that smon is running and so the oracle is up.
|
A little correction here.
You are checking the status of SMON.
If SMON is up, the instance is up.
But the database may still be closed~.
sys@9i > !ps -ef | grep smon
oracle 8735 1 0 Sep 28 ? 0:27 ora_smon_mutation
oracle 25383 25381 0 07:59:18 pts/3 0:00 grep smon
oracle 25381 25376 0 07:59:17 pts/3 0:00 /bin/bash -c ps -ef | grep smon
sys@9i > shutdown
Database closed.
Database dismounted.
ORACLE instance shut down.
sys@9i > startup nomount
ORACLE instance started.
Total System Global Area 202868968 bytes
Fixed Size 731368 bytes
Variable Size 167772160 bytes
Database Buffers 33554432 bytes
Redo Buffers 811008 bytes
sys@9i > !ps -ef | grep smon
oracle 25401 25376 0 07:59:41 pts/3 0:00 /bin/bash -c ps -ef | grep smon
oracle 25393 1 1 07:59:36 ? 0:00 ora_smon_mutation
oracle 25403 25401 0 07:59:42 pts/3 0:00 grep smon
|
|
|