To Check Oracle Database Status


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting To Check Oracle Database Status
# 1  
Old 09-02-2010
To Check Oracle Database Status

I have to check the oracle database status using ksh, if the database is down then i need to send my dba an email saying database is down and wait for 10 mins and check for the status again and so on. once the database is up then should continue to the next step in the script.
Any help is appriciated.

Thank you.
# 2  
Old 09-02-2010
Code:
#!/bin/ksh
# assumes ORACLE_SID is the instance of oracle you want to check
while :
do
  tnsping $ORACLE_SID
  status=$?
  [[ $status -eq 0 ]] && break
  echo "Oracle instance $ORACLE_SID is down $(date)" | mailx -s 'Oracle down' \
          mydba@mycompany.com
  sleep 600
done
# rest of script goes here

This is an odd request - normally good DBA's go out of their way to see that oracle is up and running - meaning they have their own scripts running to do that.
Login or Register to Ask a Question

Previous Thread | Next Thread

6 More Discussions You Might Find Interesting

1. UNIX and Linux Applications

Oracle Database - How to check if user roles and system roles are separated?

I have these two table. How do I see if user roles and system roles are seperated? SQL> desc DBA_ROLES; Name Null? Type ----------------------------------------- -------- ---------------------------- ROLE NOT NULL... (1 Reply)
Discussion started by: alvinoo
1 Replies

2. UNIX and Linux Applications

Identify a specific environment Oracle variable to connect a remote Oracle database ?

Good evening I nned your help pls, In an unix server i want to connect to a remote oracle databse server by sqlplus. I tried to find out the user/passwd and service name by env variable and all Ive got is this: ORACLE_SID_REPCOL=SCL_REPCOL ORACLE_SID=xmeta ORACLE_SID_TOL=SCL_PROTOLCOL... (2 Replies)
Discussion started by: alexcol
2 Replies

3. UNIX and Linux Applications

Oracle database recovery

Is there a way to recover Oracle database in x86 server from broken sparc server (Solaris10)? (9 Replies)
Discussion started by: orange47
9 Replies

4. Solaris

Can't create database after Oracle Database installation

I installed Oracle 10 software on Solaris 11 Express, everything was fine execpt I can't create database using dbca.rsp file. I populated file with following options. OPERATION_TYPE = "createDatabase" GDBNAME = "solaris_user.domain.com" SID = "solaris_user" TEMPLATENAME = "General... (0 Replies)
Discussion started by: solaris_user
0 Replies

5. Shell Programming and Scripting

Exit status always zero in KSH from Oracle Scheduler

Hi, Running Oracle Scheduler 11g2 on an AIX 6.01. I want to run a shell script (called "external program" in Oracle terminology) which executes some commands and react on the outcome using the exit status $?. For example a "cat thisfiledoesnotexist" and then get the $? which should be not zero.... (6 Replies)
Discussion started by: hermanmol
6 Replies

6. Shell Programming and Scripting

check the status and send an email with status

Hi, We have a text file which has the following data. ISA~00~ ~00~ ~ZZ~VISTN ~ZZ~U1CAD ~051227~183 7~U~00200~000011258~0~P~< GS~FA~EE05J~U1CAD~051227~1831~000011258~X~002002 ST~997~0001 AK1~SH~247 AK2~856~2470001 AK5~A AK2~856~2470002 AK5~A... (3 Replies)
Discussion started by: isingh786
3 Replies
Login or Register to Ask a Question