Member Login

Remember Me
Forgot Password?
Join Us!

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
  • 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.

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 status

linux script to check oracle agent's status

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,

RE: linux script to check oracle agent's status

Something like this?


if ! emctl status agent >/dev/null
   emctl start agent

RE: linux script to check oracle agent's status

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?


RE: linux script to check oracle agent's status

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.



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

if ! lsnrctl status >/dev/null
   lsnrctl start

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

if ! emctl status agent >/dev/null
   emctl start agent
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.  

RE: linux script to check oracle agent's status

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

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

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Tek-Tips Forums free from inappropriate posts.
The Tek-Tips staff will check this out and take appropriate action.

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