Smart questions
Smart answers
Smart people
INTELLIGENT WORK FORUMS
FOR COMPUTER PROFESSIONALS

Member Login




Remember Me
Forgot Password?
Join Us!

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips now!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!

Join Tek-Tips
*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Donate Today!

Do you enjoy these
technical forums?
Donate Today! Click Here

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.
Jobs from Indeed

Link To This Forum!

Partner Button
Add Stickiness To Your Site By Linking To This Professionally Managed Technical Forum.
Just copy and paste the
code below into your site.

linux script to check oracle agent's statusHelpful Member! 

yorge (Programmer) (OP)
10 Feb 12 7:28
Hi Guys,

Can anybody tell me if it's possible via linux script to check oracle agent's status? If it's stopped/down, then do a emctl start agent. Can anybody please show me some code lines.

Thanks in advance,
yorge
 
Helpful Member!  stefanhei (TechnicalUser)
10 Feb 12 8:06
Something like this?

CODE

#!/bin/bash
if ! emctl status agent >/dev/null
then
   emctl start agent
fi
yorge (Programmer) (OP)
13 Feb 12 3:49
hi stefanhei,

Can I add here?
How about for checking of database and listener status? To check if down or inactive, then start these 2 if ever. Can you please show me how?

thanks,
yorge
 
stefanhei (TechnicalUser)
21 Feb 12 7:49
One method of checking if the database instance is up is to look for its pmon-process.
To check for the listener the returncode of lsnrctl can be used like that of emctl.

CODE

#!/bin/bash

[ -z "$ORACLE_SID" ] && echo "\$ORACLE_SID not set" && exit 1

if ! lsnrctl status >/dev/null
then
   lsnrctl start
fi

if ! ps -eaf |grep -v grep |grep pmon_$ORACLE_SID >/dev/null
then
   sqlplus / as sysdba <<EOF
startup;
EOF
fi

if ! emctl status agent >/dev/null
then
   emctl start agent
fi
The script only checks if $ORACLE_SID is set. It assumes that the environment is set up correctly and the user invoking it can connect as sysdba.  
LKBrwnDBA (MIS)
23 Feb 12 15:57

How about using Enterprise Manager DB console (or Grid control) to send you an email if something is down...
3eyes
 

----------------------------------------------------------------------------
The person who says it can't be done should not interrupt the person doing it. -- Chinese proverb
 

Reply To This Thread

Posting in the Tek-Tips forums is a member-only feature.

Click Here to join Tek-Tips and talk with other members!

Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close