DataBase Online Or Not

 
Thread Tools Search this Thread
Special Forums UNIX and Linux Applications DataBase Online Or Not
# 1  
Old 08-14-2007
DataBase Online Or Not

Hey every one,

I am new here, and work as DBA ,can I ask if there any tools can installed or command help me to know if the current DB still connected or not ? The DB that work on is so disturbing, your response are highly appreciated,

Note : DB is Oracle and the OS is certain Unix.


Best Regards
# 2  
Old 08-14-2007
I'm a sysadmin, not a DBA (we have our own Oracle DBAs in house), but I know that you can use the lsnrctl command to show if the listeners are active

Code:
$ORACLE_HOME/bin/lsnrctl status

Cheers
ZB
# 3  
Old 08-14-2007
Testing if "the current DB still connected or not" doesn't really mean anything. I think you need to know "if the database is open", and so if user's connections are allowed. For that, you can run this simple script on the Oracle server machine:

Code:
USER="myuser"
PASS="mypassword"
$ORACLE_HOME/bin/sqlplus -s ${USER}/${PASS} <<EOF >/dev/null 2>&1
whenever oserror exit 98;
whenever sqlerror exit 99;
exit 140;
EOF

if [ "$?" -ne 140 ]
then
   echo "Oracle is down!"
else
   echo "Oracle is up."
fi

Of course, you can try to run this also on a client machine, although the result will be inaccurate: you may not be able to connect to the database for other problems (i.e. listener down) but the database on the server is up & running.

Hope this helps Smilie

Last edited by robotronic; 08-22-2007 at 01:57 PM..
# 4  
Old 07-21-2008
hi,

you can aslo use the commande:

# ps - ef | grep ora

just to see if all process are up or not.

Not: this can be used as first in order to know if the process which are handling oracle are Up or Not.

Thx.
# 5  
Old 09-26-2008
Hiii...
I am also System Admin, but usually we take offline backup by taking database and Applications offline and we do something like this:

We use following command :
#ps -ef | grep pmon | grep -v grep #Check pmon process.

and if this shows some output, that means Database is online, else it is offline.....


To make database offline,we do following :

1. Get sql prompt :
#sqlplus "/as sysdba"
2. Shut down database:
SQL> shutdown immediate

3. Exit from sql prompt :
SQL> quit


And then again check "pmon" process.

Hope this will help you...

Cheers...

Last edited by Reboot; 10-04-2008 at 05:07 PM..
Login or Register to Ask a Question

Previous Thread | Next Thread

2 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

CRON Job to copy database and replace existing database

I have a reseller account with hostgator, which means i have WHM and Cpanel. I have set up a staging environment for one of my wordpress installations (client website), which is essentially sitting at staging.domain.com (live site is at domain.com). The staging website is a complete copy of the... (1 Reply)
Discussion started by: nzrobert
1 Replies

2. Programming

How to reconnect to online database?

HI, I am using perl LWP for connecting to online databases. some times i will get connection fail. I want to keep track of that error and again i want to connect. i.e when i get connection fail the program should not stop it should try to connect. I can check connection fail has... (1 Reply)
Discussion started by: vanitham
1 Replies
Login or Register to Ask a Question